Last active
November 15, 2023 13:29
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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