Hi!
I recently saw someone’s code which allowed for 2 windows. I tried to adapt one of my programs to it but it didn’t work too well. I know I can just declare them at the beginning and be done with it, but is there a way to do it differently?
MultiWindows sketch2;
void settings() {
size(400, 400);
}
void setup() {
surface.setLocation(0, 0);
surface.setTitle("Input window");
sketch2 = new MultiWindows();
}
void draw() {
background(255);
stroke(255, 0, 0);
println(txt);
}
class MultiWindows extends PApplet {
String txt = "";
MultiWindows() {
super();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
}
public void settings() {
size(400, 400);
}
public void setup() {
surface.setLocation(400, 0);
surface.setTitle("Display window");
}
public void draw() {
background(0);
fill(255);
text(txt,width/2,height/2);
}
public void keyPressed() {
txt += key;
}
}