-
Notifications
You must be signed in to change notification settings - Fork 1
/
screenSize.pde
47 lines (38 loc) · 980 Bytes
/
screenSize.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
class ScreenSize extends SensorReading {
// temp stuff
// final values
int width, height;
public ScreenSize() {
super("screenSize");
}
void init() {
}
void execute() {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.width = (int)screenSize.getWidth();
this.height =(int) screenSize.getHeight();
send();
}
OscMessage createMessage(String adrPattern) {
OscMessage m = new OscMessage(adrPattern);
m.add(name);
m.add(this.width);
m.add(this.height);
return m;
}
void send() {
OscMessage m = createMessage("/data");
oscP5.send(m, serverLocation);
// this is important
readingDone = true;
}
SensorReading createFromMessage(OscMessage msg) {
ScreenSize sr = new ScreenSize();
sr.width = msg.get(1).intValue();
sr.height = msg.get(2).intValue();
return sr;
}
void print() {
println(name + " width: "+this.width+" height: "+this.height);
}
}