We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, there. I have a question about using class. I can use only one 'draw' but i would like to mix several examples. How I can use draw in class? Or is there any way to get class instead of draw?
for example, I would like to make, when I press '1' -> show example 1. when I press '2' -> show example 2. like this.
Thank you for reading this.
void keyPressed() {
int keyIndex = -1;
if (key >= 'A' && key <= 'Z') {
keyIndex = key - 'A';
} else if (key >= 'a' && key <= 'z') {
keyIndex = key - 'a';
}
if (key== '1') {
bground.update();
bground.display();
}
if (key == '2'){
}
else {
//bg.fill(255);
//bg.rect(0,0,1280,720);
fc001=0;
pg.background(255);
pg.clear();
pg.text(key, random(100,width-100), random(250,height-250));
}
}
Answers
Use some internal sketch state.
Wow....thanks a lot! I will try with this code!!!!!!!! Appreciate a lot!!!