I’m equally confused by your confusion.
The code snippet is not meant to be complete or even functional, its merely an example to show (what I think is) anomalous behavior. Instead of dumping my entire code here, I’ve done my homework and posted just a summary of my problem. I couldn’t find any documentation about how the mousePressed variable actually updates, which is why i’m posting here.
Now I understand there are probably twenty easier ways to register a mouse click, but for now I’m trying to understand why this particular way doesn’t work.
Hope this clears things up.
- You might have guessed, but the delay(10000) is throwaway. It only exists to make execution success (print “OK”) easier for me to observe.
- Best coding practices aside, there is no reason why I can’t break a while loop with
break. In fact, the following doesn’t work as well:
void draw(){
while (mousePressed == false) {
println("Still False");
delay(100);
}
println("Now True");
delay(10000);
}
Is there documentation somewhere I can refer to for this?