-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.pde
More file actions
41 lines (33 loc) · 714 Bytes
/
GUI.pde
File metadata and controls
41 lines (33 loc) · 714 Bytes
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
class GUI {
Boolean resetTimer = false;
int currentTime, oldTime = 0;
GUI() {
}
void draw() {
drawBG();
timerDraw();
}
void drawBG() {
rectMode(CORNER);
background(100);
fill(0);
rect(0, height - 35, width, 35);
}
void timerDraw() {
if (!pauseTimer) {
if (resetTimer) {
oldTime = millis();
resetTimer = false;
}
currentTime = millis() - oldTime;
int timerLength = (ping.get(0).variableTimer) * 1000;
int offsetTimer = millis() % timerLength - currentTime;
fill(255);
if (offsetTimer > 0) {
rect(0, height - 35, map(currentTime % timerLength, 0, timerLength - offsetTimer, 0, width), 35);
} else {
rect(0, height - 35, width, 35);
}
}
}
}