public
anonymous / gist:889796
Created

eschere (main class)

  • Download Gist
gistfile1.java
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
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();
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.