-
Notifications
You must be signed in to change notification settings - Fork 0
/
Boton.pde
47 lines (42 loc) · 1.04 KB
/
Boton.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
class Boton {
float posX, posY;
int sizeX, sizeY;
int[] colorActive;
int id;
boolean over = false;
boolean selected = false;
String name;
Boton(float posX_, float posY_, int sizeX_, int sizeY_, int[] colorActive_, int id_, String name_) {
posX = posX_;
posY = posY_;
sizeX = sizeX_;
sizeY = sizeY_;
colorActive = colorActive_;
id = id_;
name = name_;
}
void display() {
lights();
rectMode(CENTER);
if (over == true) {
fill(255);
text(name, 30, posY - 30);
fill(colorActive[0], colorActive[1], colorActive[2], colorActive[3]);
rect(posX, posY, sizeX + 10, sizeY + 10, 7);
} else {
fill(colorActive[0] - 25, colorActive[1] - 25, colorActive[2] - 25);
rect(posX, posY, sizeX, sizeY, 7);
}
}
void displayRed() {
fill(255, 0, 0);
rect(posX, posY, sizeX + 10, sizeY + 10, 7);
}
void isActive() {
if (id == currentState) {
over = true;
} else {
over = false;
}
}
}