Skip to content

Instantly share code, notes, and snippets.

Created March 28, 2011 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/889796 to your computer and use it in GitHub Desktop.
Save anonymous/889796 to your computer and use it in GitHub Desktop.
eschere (main class)
AccelerometerManager accel;
boolean menu = true;
float logoX, logoY, logoScaleX, logoScaleY;
float yIncrement;
float stageBarX, stageBarLength;
float dividerHeight, heightMinusDivider;
float dockX, dockRadius, dockLength;
String logoName = "logo.svg";
PShape logo;
PShape usozoCoreIcon;
PShape liophytCoreIcon;
ArrayList elements;
void setup() {
noFill();
dockRadius = width/6;
logoScaleX = screenWidth/1.5;
logoScaleY = screenHeight/8;
dividerHeight = height/9;
dockX = width*.8;
accel = new AccelerometerManager(this);
logo = loadShape(logoName);
elements = new ArrayList();
float randY = random(dividerHeight, screenHeight);
elements.add(new Element("UsozoCore", accel));
elements.add(new Element("LiophytCore", accel));
heightMinusDivider = (height/1.5) - dividerHeight;
yIncrement = heightMinusDivider/(elements.size());
}
void draw() {
background(40);
if (menu) {
shape(logo, 0, 0, logoScaleX, logoScaleY);
drawElementDock();
stroke(100);
line(0, dividerHeight, screenWidth, dividerHeight);
stroke(0);
line(0, dividerHeight-1, screenWidth, dividerHeight-1);
stroke(255);
for (int i = elements.size()-1; i >= 0; i--) {
Element element = (Element) elements.get(i);
element.updateIcon(width/8, (yIncrement * (i+1)) + dividerHeight);
}
}
else {
}
}
void detectTouch() {
}
void drawElementDock() {
stroke(255);
line(dockX, dividerHeight + dockRadius, dockX, height);
beginShape();
curveVertex(dockX - dockRadius, dividerHeight);
curveVertex(dockX - dockRadius, dividerHeight);
curveVertex(dockX, dividerHeight + dockRadius);
curveVertex(dockX + dockRadius, dividerHeight);
curveVertex(dockX + dockRadius, dividerHeight);
endShape();
noStroke();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment