Created
December 7, 2019 07:17
-
-
Save zawa-works/104b3f0122ef160c82b9d4f07f832bd1 to your computer and use it in GitHub Desktop.
2番目の画面内でクラスを使うときの注意
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
SecondWindow secondWindow; | |
void settings() { | |
size(200, 200); | |
} | |
void setup() { | |
secondWindow = new SecondWindow(); | |
} | |
void draw() { | |
background(255, 0, 0); | |
} | |
class SecondWindow extends PApplet { | |
Test test; | |
SecondWindow() { | |
super(); | |
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this); | |
} | |
void settings() { | |
size(200, 200); | |
} | |
void setup() { | |
test = new Test(this); | |
background(0, 0, 255); | |
} | |
void draw() { | |
test.display(); | |
} | |
} | |
class Test { | |
PApplet applet; | |
Test(PApplet _applet) { | |
applet = _applet; | |
} | |
void display() { | |
applet.background(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment