I am using " delay() " inside while loop and making some changes in the screen. I was hoping the changes will be visiable since I am using delay(1000) in every while loop but only the final result is printed on screen . I am not doing anything inside draw function. I am trying to make a event based system where user can interact with just mouse and keyboard.
I want to run while loop such that it will show me the changes I made on screen after every iteration for 1sec then proceed forward.
The rects(),and every shape,text… is displayed everytime draw() is called, this means everything u change in your while, cant be seen until your while terminates and draw() is called once again.
" draw() is called automatically and should never be called explicitly. All Processing programs update the screen at the end of draw(), never earlier. " https://processing.org/reference/draw_.html
“The screen only updates when the end of draw() is reached, so delay() cannot be used to slow down drawing. For instance, you cannot use delay() to control the timing of an animation.” https://processing.org/reference/delay_.html
Sorry for replying late , I was busy implementing max heap and some other stuff in processing. I didn’t knew that screen was updated after draw() xD .