polargraphcontroller/ControlFrame.pde

53 lines
1.0 KiB
Plaintext
Raw Normal View History

// 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() {
2015-09-05 17:00:22 +02:00
if (this.cp5 == null) {
this.cp5 = this.setupControlP5();
}
return this.cp5;
}
2015-09-05 17:00:22 +02:00
public PApplet getParent() {
return this.parent;
}
public void setup() {
size(w, h);
frameRate(5);
}
2015-09-05 17:00:22 +02:00
public ControlP5 setupControlP5() {
2015-09-05 17:00:22 +02:00
println("About to create new ControlP5");
ControlP5 cp5 = new ControlP5(this);
2015-09-05 17:00:22 +02:00
println("Created: " + cp5);
while (cp5 == null) {
println("Was null: " + cp5);
2015-09-05 17:00:22 +02:00
}
println("Finally created: " + cp5);
return cp5;
}
public void draw() {
2015-09-05 17:00:22 +02:00
background(abc);
}
2015-09-05 17:00:22 +02:00
}