-
Notifications
You must be signed in to change notification settings - Fork 62
/
ControlFrame.pde
52 lines (42 loc) · 1.02 KB
/
ControlFrame.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
// the ControlFrame class extends PApplet, so we
// are creating a new processing applet inside a
// new frame with a controlP5 object loaded
public class ControlFrame extends PApplet {
public int w, h;
int abc = 100;
public ControlP5 cp5;
protected PApplet parent;
private ControlFrame() {
}
public ControlFrame(PApplet theParent, int theWidth, int theHeight) {
this.parent = theParent;
this.w = theWidth;
this.h = theHeight;
}
public ControlP5 cp5() {
if (this.cp5 == null) {
this.cp5 = this.setupControlP5();
}
return this.cp5;
}
public PApplet getParent() {
return this.parent;
}
public void setup() {
size(w, h);
frameRate(5);
}
public ControlP5 setupControlP5() {
println("About to create new ControlP5");
ControlP5 cp5 = new ControlP5(this);
println("Created: " + cp5);
while (cp5 == null) {
println("Was null: " + cp5);
}
println("Finally created: " + cp5);
return cp5;
}
public void draw() {
background(abc);
}
}