-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.pde
122 lines (109 loc) · 2.47 KB
/
application.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
window.smallSize = 30;
var bigSize = 50;
window.iconHeight = 500;
var buttonHeight = 410;
var count = 2;
PImage logo;
PImage t;
PImage h,k,l;
void setup() {
size(800, 600);
logo = loadImage("/GaiaTouch/img/download.png");
t = loadImage("/GaiaTouch/img/temperature.png");
h = loadImage("/GaiaTouch/img/humidity.png");
k = loadImage("/GaiaTouch/img/noise.png");
l = loadImage("/GaiaTouch/img/luminosity.png");
}
window.color_White=#FFFFFF;
window.color_Red=#FF0000;
window.color_Green=#00FF00;
window.color_Blue=#0000FF;
window.color_Purple=#FFFF00;
window.colorT=color_White;
window.colorH=color_White;
window.colorK=color_White;
window.colorL=color_White;
window.valueT="--";
window.valueH="--";
window.valueK="--";
window.valueL="--";
void draw(){
background(100);
stroke(0);
fill(colorT);
ellipse(100, buttonHeight, smallSize, smallSize);
fill(colorH);
ellipse(200, buttonHeight, smallSize, smallSize);
fill(color_White);
ellipse(400, buttonHeight, bigSize, bigSize);
fill(colorK);
ellipse(600, buttonHeight, smallSize, smallSize);
fill(colorL);
ellipse(700, buttonHeight, smallSize, smallSize);
fill(color_White);
image(t, 100-50,iconHeight-50, 100,100);
image(h, 200-50,iconHeight-50, 100,100);
image(logo, 400-50,iconHeight-25, 100,50);
image(k, 600-50,iconHeight-50, 100,100);
image(l, 700-50,iconHeight-50, 100,100);
for (var i=0;i<count;i++){
println('');
}
textSize(50);
text(int(valueT), 100-25, 300);
text(int(valueH), 200-25, 300);
text(int(valueK), 600-25, 300);
text(int(valueL), 700-25, 300);
textSize(30);
text("°C", 100-15, 350);
text("%", 200-15, 350);
text("db", 600-15, 350);
text("lum", 700-15, 350);
}
interface Javascript {}
Javascript javascript=null;
void bindJavascript(Javascript js) { javascript=js; }
void keyPressed()
{
switch(int(key)){
case 43:
iconHeight++;
break;
case 45:
iconHeight--;
break;
case 113:
if (colorT==color_Red){
colorT=color_White;
} else {
colorT=color_Red;
}
break;
case 119:
if (colorH==color_Green){
colorH=color_White;
} else {
colorH=color_Green;
}
break;
case 101:
if (colorK==color_Blue){
colorK=color_White;
} else {
colorK=color_Blue;
}
break;
case 114:
if (colorL==color_Purple){
colorL=color_White;
} else {
colorL=color_Purple;
}
break;
// case 65535:
// location.reload();
// break;
default:
console.log(key);
}
}