initial commit
This commit is contained in:
84
source/Button.pde
Normal file
84
source/Button.pde
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
class Button {
|
||||
boolean hover;
|
||||
String title;
|
||||
int x, y, w, h;
|
||||
Button(String title_, int x_, int y_) {
|
||||
title = title_;
|
||||
x = x_;
|
||||
y = y_;
|
||||
w = int(textWidth(title));
|
||||
h = int(ts);
|
||||
}
|
||||
|
||||
void update() {
|
||||
if (mouseX > x && mouseX < x + w && mouseY > y-h && mouseY < y) {
|
||||
hover = true;
|
||||
} else {
|
||||
hover = false;
|
||||
}
|
||||
w = int(textWidth(title));
|
||||
h = int(ts);
|
||||
}
|
||||
void display() {
|
||||
if (hover) {
|
||||
fill(195, 231, 182, 127);
|
||||
rect(x-(w/5), y+(h/5)+3, w+(2*(w/5)), -h-(2*(h/5)), 5);
|
||||
fill(255);
|
||||
}
|
||||
textAlign(CORNER);
|
||||
text(title, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mousePressed() {
|
||||
|
||||
if (buttons[0].hover) {
|
||||
sa.loadMRAO(true, false, false);
|
||||
buttons[0].hover = false;
|
||||
} else if (buttons[1].hover) {
|
||||
sa.loadMRAO(false, true, false);
|
||||
buttons[1].hover = false;
|
||||
} else if (buttons[2].hover) {
|
||||
sa.loadMRAO(false, false, true);
|
||||
buttons[2].hover = false;
|
||||
} else if (buttons[3].hover) {
|
||||
saveImage();
|
||||
buttons[3].hover = false;
|
||||
} else if (buttons[4].hover) {
|
||||
sa.flipRGB[0] = false;
|
||||
sa.flipRGB[1] = false;
|
||||
sa.flipRGB[2] = false;
|
||||
sa.loadMRAO(false, false, false);
|
||||
buttons[4].hover = false;
|
||||
} else if (buttons[5].hover) {
|
||||
skip();
|
||||
if (readPhase_i == 3 && imgCount == 0) {
|
||||
skip();
|
||||
}
|
||||
|
||||
buttons[5].hover = false;
|
||||
} else if (buttons[6].hover) {
|
||||
isStaticProp = true;
|
||||
nextPhase();
|
||||
buttons[6].hover = false;
|
||||
} else if (buttons[7].hover) {
|
||||
isStaticProp = false;
|
||||
nextPhase();
|
||||
buttons[7].hover = false;
|
||||
} else if (buttons[8].hover) {
|
||||
|
||||
if (imgCount == 0 && readPhase_i == 4) {
|
||||
readPhase_i--;
|
||||
}
|
||||
readPhase_i--;
|
||||
buttons[8].hover = false;
|
||||
} else if (buttons[9].hover) {
|
||||
compile();
|
||||
buttons[9].hover = false;
|
||||
} else if (adhover) {
|
||||
link("http://www.epistle3.org/");
|
||||
adhover = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user