blob: 3899994dde3dcf897ab352d4462f1ca287f5743c (
plain)
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
|
public class OSCGraphicsBox extends OSCGraphicsLayer {
class ColorPort extends OSCGraphicsPort {
OSCGraphicsBox @layer;
int color[];
int index;
fun void
tick(float in, float prev)
{
in $ int => color[index];
/* optimize: avoid sending unnecessary messages */
if (color[index] != (prev $ int))
color => layer.color;
}
}
fun OSCGraphicsPort @
getColorPort(int color[], int index)
{
ColorPort p;
this @=> p.layer;
color @=> p.color;
index => p.index;
return p;
}
fun int[]
color(int color[])
{
osc_send.startMsg("/layer/"+name+"/color", "iii");
for (0 => int i; i < 3; i++)
color[i] => osc_send.addInt;
return color;
}
}
|