Skip to content

Instantly share code, notes, and snippets.

@atduskgreg
Last active November 15, 2023 13:29
Show Gist options
  • Save atduskgreg/666e46c8408e2a33b09a to your computer and use it in GitHub Desktop.
Save atduskgreg/666e46c8408e2a33b09a 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");
}
}
@indirawrs
Copy link

first off, thanks for this
second, can you load libraries in separate applet windows?
let's say i'm making a third one of those and i want to play a video in there. it says it can't load the movie file. I can't seem to find my mistake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment