We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So the objective of this project is to make a main menu screen where a user can click either capital A, B, C or lower case or also click on the boxes to get to the sub screens. I can get the screens to show hoever i have problem making them stay can anyone please help me with this in a simple enough way. Thank You
int r=255, g=128, b=128;
boolean keyIsPressed = false;
void setup() {
size(500, 500);
}
void draw() {
background(150);
if (keyIsPressed) {
background(255, 0, 0);
}
if (keyPressed) {
if (key == 'A' || key == 'a') {
background(255, 0, 0);
keyIsPressed = true;
} else {
if (key == 'B' || key == 'b') {
background(0, 255, 0);
if(keyIsPressed) {
if (key =='C' || key == 'c') {
background(0,0,255);
}
}
}
}
}
}
Answers
This is the main screen where everything starts
http://studio.SketchPad.cc/sp/pad/view/ro.9$Bjf6i21oXBw/latest
https://forum.Processing.org/two/discussion/12532/windowjs-cross-mode-alert-confirm-prompt-other-js-api-for-java
http://studio.SketchPad.cc/sp/pad/view/ro.9eDRvB4LRmLrr/latest
Thanks for the help however do you know how to get the screen to change when a mouse is clicked in a specific rectangle using the mouseClicked() function
If you have an array of instances of class Button, you just need to find out which 1 was clicked inside mousePressed() by iterating each 1 in a loop.
Once found the clicked Button via isMouseOver(), invoke its custom action() method.
When instantiating the Button, you just need to
@Override
its empty action() method using your own implementation. *-:)So here's another example just to demo the idea: B-)