-
Notifications
You must be signed in to change notification settings - Fork 0
/
SSURE.pde
171 lines (160 loc) · 3.55 KB
/
SSURE.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import controlP5.*;
//Declare
//ControlP5 jControl;
//int rColor = 100, gColor=100, bColor =100;
LineGraph line;
BarGraph bar;
Pace pc;
ButtonLine btl;
ButtonGraph btg;
ButtonPace btp;
ButtonPlay bp;
ButtonStop bs;
ButtonPause bpa;
ButtonPlay bpp;
ButtonRestart brs;
Duration dt;
Distance ds;
Tracking tck;
Menu mn;
Result rt;
Information target;
Information actual;
char mode = 'P';
char work = 'I';
void setup() {
size(400,640);
//initialise
//jControl = new ControlP5(this);
background(0);
//Slider s1 = jControl.addSlider("rColor", 0, 255, 100, 10, 10, 255, 30);
//Slider s2 = jControl.addSlider("gColor", 0, 255, 100, 10, 110, 255, 30);
//Slider s3 = jControl.addSlider("bColor", 0, 255, 100, 10, 210, 255, 30);
fill(50);
noStroke();
rect(0, 0, width, 30);
fill(255);
textSize(24);
text("SSURE", 10, 24);
line = new LineGraph(0,30);
bar = new BarGraph(0,30);
pc = new Pace(0,30);
dt = new Duration(20, 35+height/3.2);
ds = new Distance(20,55+height/3.2);
btl = new ButtonLine(width-80,60);
btg = new ButtonGraph(width-80,110);
btp = new ButtonPace(width-80,160);
bp = new ButtonPlay(0,50+height/3.2, false);
bs = new ButtonStop(width/2,90+height/3.2);
bpa = new ButtonPause(0,90+height/3.2);
bpp = new ButtonPlay(0,90+height/3.2, true);
brs = new ButtonRestart(0,height-100);
tck = new Tracking(0,220+height/3.2);
mn = new Menu(0,150+height/3.2);
target = new Information();
actual = new Information();
}
void draw() {
clearScreen();
if(work == 'P') {
if(mode == 'L') {
line.run();
} else if(mode == 'G') {
bar.run();
} else if(mode == 'P') {
pc.run();
}
dt.run();
ds.run();
tck.run();
btl.run();
btg.run();
btp.run();
bs.run();
bpa.run();
} else if(work == 'I') {
dt.restart();
ds.restart();
line.restart();
bar.restart();
pc.restart();
if(mode == 'L') {
line.pause();
} else if(mode == 'G') {
bar.pause();
} else if(mode == 'P') {
pc.pause();
}
btl.run();
btg.run();
btp.run();
bp.run();
mn.run();
} else if(work == 'S') {
//stop
actual.setDuration(dt.time);
actual.setDistance(ds.move);
actual.setPace(pc.numPace);
rt = new Result(0,30,actual, target);
rt.run();
brs.run();
} else if(work == 'F') {
if(mode == 'L') {
line.pause();
} else if(mode == 'G') {
bar.pause();
} else if(mode == 'P') {
pc.pause();
}
dt.pause();
ds.pause();
tck.pause();
btl.run();
btg.run();
btp.run();
bpp.run();
bs.run();
}
//background(rColor,gColor,bColor);
}
void mousePressed() {
if(btl.rectOver) {
mode = 'L';
} else if(btg.rectOver) {
mode = 'G';
} else if(btp.rectOver) {
mode = 'P';
} else if((work == 'P' || work == 'F') && bs.rectOver) {
work = 'S';
} else if(work == 'S' && brs.rectOver) {
work = 'I';
} else if(work == 'P' && bpa.rectOver) {
work = 'F';
} else if(work == 'F' && bpp.rectOver) {
work = 'P';
} else if(work == 'I' && bp.rectOver) {
work = 'P';
target.setDuration(mn.getDuration());
target.setDistance(mn.getDistance());
target.setPace(mn.getPace());
} else if(work == 'I' && mn.OverM1) {
if(mn.mode=='E') {
mn.mode = 'C';
} else {
mn.mode = 'E';
}
} else if(work == 'I' && mn.OverM2) {
if(mn.mode=='T') {
mn.mode = 'C';
} else {
mn.mode = 'T';
}
} else if(work == 'I') {
mn.setBar();
}
}
void clearScreen() {
fill(0);
noStroke();
rect(0, 30, width, height);
}