Hi, im playing around with multiple windows with PApplet and just wondering if there’s any good resources available, cant seem to find any help on the things im trying to do like switch between windows being active by pressing the space bar or something, not sure if its even possible, if so can anyone help, here’s my code so far
PWindow win;
void settings() {
size(1000, 1000);
}
void setup() {
win = new PWindow();
}
void draw() {
}
class PWindow extends PApplet {
PWindow() {
super();
PApplet.runSketch(new String[]{this.getClass().getName()}, this);
}
int count = 3;
int[][] grid = new int[count][count];
float w;
void settings() {
size(500, 500);
}
void setup() {
surface.setTitle("Kernal");
w = (float)width/count;
noStroke();
}
void draw() {
for (int y = 0; y < count; y++) {
for (int x = 0; x < count; x++) {
fill(grid[x][y] == 1 ? 255 : 0);
rect(x*w, y*w, w, w);
}
}
}
void mousePressed() {
if (mouseButton == LEFT) {
int x = floor(mouseX/w);
int y = floor(mouseY/w);
grid[x][y] = grid[x][y] == 1 ? 0 : 1;
}
}
}