Second applet and Classes

edited February 2018 in Questions about Code

Hey, i`ve this simple code:

PWindow w;
Radar r;

void settings() {
  size(500, 500, P3D);
}
void setup() {
  w = new PWindow();
  r = new Radar();
}


void draw() {

  translate(width/2, height/2);
  box(200);
}

class Radar{

Radar(){
}

void display(){
  stroke(255);
  ellipse(width/2, height/2, 100, 100);
}

}

class PWindow extends PApplet {

  PWindow() {
    super();
    PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);

  }

  void settings() {
    size(500, 500, P2D);
  }

void setup(){
background(0);
}

  void draw(){
  r.display();
  }
}

but it doesn't work (crash). im really don't know how use a class inside a extra applet. any suggestion?

Answers

  • We can't have more than 1 PApplet using a OpenGL renderer at the same sketch! [-X

Sign In or Register to comment.