We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey everyone. I'm trying to create a simple keyboard toggle switch. When a key is pressed, the application should pause. When the same key is pressed again, the application should resume. Here's what I have so far. Many thanks for the help.
boolean pause = false;
void keyPressed() {
if ((key == 'x' || key == 'X') && (pause = false)) pause = true; noLoop();
if ((key == 'x' || key == 'X') && (pause = true)) pause = false; loop();
}
Answers
Wonderful. Thank you!