-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDisplay.pde
79 lines (69 loc) · 2 KB
/
Display.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
class Display
{
int rolling = 0;
Display(int background_greylevel) {
background(background_greylevel);
textFont(createFont("LucidaGrande", 18));
}
void update_value_display() {
String label;
textSize(20);
textAlign(LEFT, CENTER);
// print values of axis
for(int j=0; j<NUMBER_OF_SIGNALS; j++) {
fill(line_color(j),200);
text(input.axis_dim[j].status_string(), 10, 20*j+10);
}
// print button states
fill(#ffffff, 200);
for(int j=0; j<NUMBER_OF_BUTTONS; j++) {
text(input.button_dim[j].status_string(), 10, 20*(j+NUMBER_OF_SIGNALS)+10);
}
}
void update_graphs() {
// display values as graph
rolling = (rolling+ROLLING_INCREMENT)%width;
strokeWeight(2);
for(j=0; j<NUMBER_OF_SIGNALS; j++) {
stroke(line_color(j), 200);
line(this.rolling, round(height*input.axis_dim[j].normalized_old_value()), this.rolling+ROLLING_INCREMENT,
round(height*input.axis_dim[j].normalized_value()));
}
}
void draw_vertical_line(int axis_nr) {
stroke( line_color(axis_nr), 200 );
line( this.rolling+ROLLING_INCREMENT,0,this.rolling+ROLLING_INCREMENT,height);
}
void simple_blenddown(int alpha) {
noSmooth();
noStroke();
fill(#000000, alpha);
rect(0, 0, width, height);
smooth();
}
void alert(String message) {
textSize(20);
textAlign(CENTER, CENTER);
fill(#FFFFFF);
text(message,width/2,height/2);
}
void huge_alert(String message) {
textSize(200);
textAlign(CENTER, CENTER);
fill(#FFFFFF);
text(message,width/2,height/2);
}
void draw_progress_bar(float fraction) {
float bounded_fraction = min( 1.0, max(0.0, fraction) );
noSmooth();
noFill();
stroke(#ffffff);
rect(width/4.0, height*0.666, round(width/2.0)+1, height/20.0);
noStroke();
fill(#ffffff);
rect(width/4.0, height*0.666, round(bounded_fraction*width/2.0)+1, height/20.0);
}
}
color line_color(int j) {
return LINE_COLORS[j%(LINE_COLORS.length)];
}