We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Quick question, is there a global variable or something equivalent I can use to get a boolean for whether loop() is currently running? I appreciate I can just make one, but if there's one that already exists within Processing I feel it would be best to use it.
I want to have the mousePressed() function to do something similar to below but can't seem to find anything specific for Processing:
void mousePressed(){
if(looping)
noLoop();
else
loop();
}
Sorry if I've missed an article that covers this :-)
Many thanks.
Answers
There is a variable called looping in the PApplet source. can't investigate further at the moment.
https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L693
oh, also a public method called 'isLooping' which would be better
https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L2565
That's exactly what I needed, thank you. Can't believe I didn't look in the source files...
Yes, it would be a good idea if
isLooping()
was documented on theloop()
/noLoop()
reference pages. It has been around for a long time -- I don't think it is going anywhere....