Repository navigation
Expand file tree
/
Copy pathWidget.pde
More file actions
66 lines (61 loc) · 1.81 KB
/
Copy pathWidget.pde
File metadata and controls
66 lines (61 loc) · 1.81 KB
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
class Widget
{
float x, y, width, height;
String label;
color widgetColor, labelColor, borderColor, screenNumber;
Widget(float x, float y, float width, float height, String label, color widgetColor, int screenNumber)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.label = label;
this.widgetColor = widgetColor;
this.screenNumber = screenNumber;
labelColor = color(0);
}
void display() // display is used to draw home screen buttons
{
strokeWeight(5);
stroke(borderColor);
fill(widgetColor);
rect(x, y, width, height, 15);
fill(labelColor);
textAlign(CENTER, CENTER);
text(label, x + width / 2, y + height / 2);
textSize(50);
}
void display1() // display1 is used to draw the tabs menu at the top of each screen
{
strokeWeight(5);
stroke(borderColor);
fill(widgetColor);
rect(x, y, width, height, 15, 15, 0, 0);
fill(labelColor);
textAlign(CENTER, CENTER);
text(label, x + width / 2, y + height / 2);
textSize(25);
}
boolean checkBorder(float mx, float my) // checks the border of each button and highlights if the mouse is over
{
if (mx > x && mx < x + width && my > y && my < y + height)
{
borderColor = 255;
return true;
}
if (mx < x || mx > x + width || my < y || my > y + height)
{
borderColor = 0;
return true;
}
return false;
}
boolean checkMouse(float mx, float my) { // is used to see if a button is clicked
if (mx > x && mx < x + width && my > y && my < y + height)
{
count = screenNumber;
return true;
}
return false;
}
}