-
Notifications
You must be signed in to change notification settings - Fork 0
/
Style.pde
61 lines (44 loc) · 1.11 KB
/
Style.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
class Style
{
ColorRef lineColor = new ColorRef(color(255, 255, 255), "lineColor");
ColorRef backgroundColor = new ColorRef(color(0, 0, 0), "backgroundColor");
float lineWidth = 1;
void LoadJson(JSONObject src)
{
if (src == null)
return;
backgroundColor.LoadJson(src);
lineColor.LoadJson(src);
lineWidth = src.getFloat("lineWidth", lineWidth);
}
JSONObject SaveJson()
{
JSONObject dest = new JSONObject();
backgroundColor.SaveJson(dest);
lineColor.SaveJson(dest);
dest.setFloat("lineWidth", lineWidth);
return dest;
}
}
class StyleGUI extends UI_Panel
{
Slider lineWidth;
Style style;
ColorGroup backgroundColor;
ColorGroup lineColor;
void setGUIValues()
{
lineWidth.setValue(style.lineWidth);
}
void setupControls(ControlP5 cp5)
{
style = data.style;
super.Init("Style", cp5);
lineWidth = addSlider("lineWidth", "Line Width", style, 0, 5, false);
lineColor = addColorGroup("Line Color", style.lineColor);
backgroundColor = addColorGroup("background Color", style.backgroundColor);
}
void update()
{
}
}