Created
November 20, 2015 16:15
-
-
Save codeanticode/9bb6ab7d64e7206c360e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
PGraphics pg; | |
PSurface surf; | |
void settings() { | |
size(320, 240); | |
} | |
void setup() { | |
pg = createGraphics(500, 200); | |
surf = pg.createSurface(); | |
surf.initFrame(this); | |
surf.placeWindow(new int[] {100, 100}, null); | |
surf.setVisible(true); | |
surf.startThread(); | |
} | |
void draw() { | |
background(255, 0, 0); | |
fill(255); | |
rect(10, 10, frameCount, 10); | |
} | |
void mousePressed(){ | |
println("mousePressed"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actually, previous code is wrong, because you still need a PApplet to drive the rendering loop of the secondary surface. This is a better solution.