-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathGuiElement.pde
69 lines (55 loc) · 1.21 KB
/
GuiElement.pde
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
65
66
67
68
69
class GuiElement {
int x, y;
color basecolor;
boolean hidden = false;
boolean disabled = false;
private boolean old_disabled = false;
GuiElement(int ix, int iy, color icolor) {
this.x = ix;
this.y = iy;
this.basecolor = icolor;
}
public void disable() {
old_disabled = disabled;
disabled = true;
}
public void enable() {
old_disabled = disabled;
disabled = false;
}
public void toggle() {
disabled = old_disabled;
hidden = false;
}
public void hide() {
hidden = true;
disable();
}
public void show() {
hidden = false;
enable();
}
public boolean display() {
if(this.hidden) return false;
stroke(30);
fill(current_color());
return true;
}
/* ************************************************************************** */
protected color current_color() {
return this.basecolor;
}
}
class TextElement extends TextButton {
TextElement( String itext, int ix, int iy ) {
super(itext, ix, iy, 0, 0, #000000, #000000);
this.disable();
}
protected color current_text_color() {
return #FFFFFF;
}
protected void update_offset() {
x_offset = x;
y_offset = y + 25;
}
}