Skip to content

Instantly share code, notes, and snippets.

@zawa-works
Created December 7, 2019 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zawa-works/104b3f0122ef160c82b9d4f07f832bd1 to your computer and use it in GitHub Desktop.
Save zawa-works/104b3f0122ef160c82b9d4f07f832bd1 to your computer and use it in GitHub Desktop.
2番目の画面内でクラスを使うときの注意
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