I've been trying to make my page move to the next one by using a button how do i do this? Heres my code :
int currentScreen; import controlP5.*;
ControlP5 cp5;
void setup() { size(280, 440); background (37, 44, 127);
cp5 = new ControlP5(this);
Button b1 = cp5.addButton("Next") .setPosition(100,280) .setSize(100,50);
b1.addCallback(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { switch(theEvent.getAction()) { case(ControlP5.ACTION_PRESSED): println("start"); break; case(ControlP5.ACTION_RELEASED): println("stop"); break; } } } );
}
void draw() { background(37, 44, 127); switch(currentScreen) { case 0: quizScreenZero(); break; case 1: quizScreenOne(); break; case 2: quizScreenTwo(); break; case 3: quizScreenThree(); break; } }
void mousePressed() { currentScreen++; if (currentScreen > 3) { currentScreen = 0; } }
void quizScreenZero() { textAlign(CENTER, CENTER); fill(255); textSize(35); text("Maths Quiz 0", height/3, width/4); }
void quizScreenOne() { textAlign(CENTER, CENTER); fill(255); textSize(35); text("Maths Quiz 1", height/3, width/4); }
void quizScreenTwo() { textAlign(CENTER, CENTER); fill(255); textSize(35); text("Maths Quiz 2", height/3, width/4); }
void quizScreenThree() { textAlign(CENTER, CENTER); fill(255); textSize(35); text("Maths Quiz 3", height/3, width/4); }