Multiple windows with extending PApplet
in
Programming Questions
•
7 months ago
So I'm trying to write code to start a second window and I'm setting a token unexpected token 'void' on the void before my main setup() method. The mandala refers to another class in the project folder, it works without the PApplet, so I'm pretty sure you can safely ignore that, as well as the generateCenterPoints().
int centerX, centerY, xBound, yBound;
PFrame messageFrame;
messageView mView;
void setup(){
messageFrame = new PFrame();
xBound = 900;
yBound = 900;
size(xBound,yBound);
centerX = xBound/2;
centerY = yBound/2;
background(220);
noFill();
strokeWeight(1);
stroke(#CAEBFA);
smooth();
rectMode(CENTER);
generateCenterPoints(yBound);
}
void draw(){
// drawGrid(800);
color c = color(150,100,255);
Mandala m = new Mandala(1,c,1.0,1.0, yBound);
m.drawMandala(centerX, centerY);
}
int[][] generateCenterPoints(int yB){
int[][] centerPoints = new int[4][4];
//centerPoints[0][i] are for size 1/3 of the diameter of mandala
centerPoints[0][0] = 0;
centerPoints[0][1] = yB/4;
centerPoints[0][2] = 5*yB/12;
centerPoints[0][3] = 2*yB/3;
//centerPoints[1][i] are for size 1/2 of mandala
centerPoints[1][0] = 0;
centerPoints[1][1] = yB/4;
//centerPoints[2][i] are for size 2/3 of mandala
centerPoints[2][0] = 0;
centerPoints[2][1] = 2*yB/3;
//centerPoints[3][i] are for the full size of mandala
centerPoints[3][0] = 0;
return centerPoints;
}
public class PFrame extends Frame{
public PFrame(){
setBounds(10, 10, 400, 400)
mView = new messageView();
add(mView);
mView.init();
show();
}
}
public class messageView extends PApplet {
public void setup() {
size(400,400);
noLoop();
}
public void draw() {
}
}
1