-
-
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)
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