Skip to content

Instantly share code, notes, and snippets.

@hiorws
Forked from atduskgreg/PWindow.pde
Created June 18, 2019 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiorws/cda779e41848173a636dafcfeb651849 to your computer and use it in GitHub Desktop.
Save hiorws/cda779e41848173a636dafcfeb651849 to your computer and use it in GitHub Desktop.
Example of creating a Processing sketch with multiple windows (works in Processing 3.0)
PWindow win;
public void settings() {
size(320, 240);
}
void setup() {
win = new PWindow();
}
void draw() {
background(255, 0, 0);
fill(255);
rect(10, 10, frameCount, 10);
}
void mousePressed() {
println("mousePressed in primary window");
}
class PWindow extends PApplet {
PWindow() {
super();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
}
void settings() {
size(500, 200);
}
void setup() {
background(150);
}
void draw() {
ellipse(random(width), random(height), random(50), random(50));
}
void mousePressed() {
println("mousePressed in secondary window");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment