Last active
August 29, 2015 14:25
-
-
Save mactkg/5bebc794862114bd22c3 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
class Jack { | |
PGraphics g_local, g_global; | |
Jack() { | |
g_local = createGraphics(width, height); | |
} | |
void begin() { | |
g_local.beginDraw(); | |
g_global = g; | |
g = g_local; | |
} | |
void end() { | |
g_local = g; | |
g = g_global; | |
g_local.endDraw(); | |
} | |
void draw(float x, float y) { | |
image(g_local, x, y); | |
} | |
} | |
Jack jack; | |
void setup() { | |
size(800, 400); | |
jack = new Jack(); | |
} | |
void draw() { | |
background(0); | |
jack.begin(); | |
background(128); | |
fill(255); | |
ellipse(width/2, height/2, 50, 50); | |
jack.end(); | |
jack.draw(frameCount%width, frameCount%height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment