Hi, I’m very new to processing,
I’m trying to write a piece of code which plays and pauses a video, and want it so that when i press a certain area of the GUI it pauses the video (and displays a pause symbol) and when pressed again it plays it… However I cannot get this to work. It seems to only like to do one or the other, (depending on the placement of code), I think what it is doing is registering once - executing the command, but then registering another click, hence pausing the video. I hope this makes sense (i’m not sure i really understand myself!)
Here is the code:
void mousePressed(){
if ((pause == true)&& (mousePressed == true) && (mouseX > 540) && (mouseX < 600) && (mouseY > 0) && (mouseY < 45)){
pause = false;
println(pause + "1");
}
if ((pause == false)&& (mousePressed == true) && (mouseX > 540) && (mouseX < 600) && (mouseY > 0) && (mouseY < 45)){
pause = true;
println(pause + "2");
}
}
(the println() is there for troubleshooting)
Thanks so much for any help or light you can spread on this for me
Ben