event and program flow
Posted: Wed Jul 31, 2019 10:29 pm
I was reading the example code in this post,
viewtopic.php?f=4&t=2099#p11046
I did test the program example and it is working as intended.
But there is probably something about event handling that I did not get yet, since I struggle to understand this.
First two lines in the main loop:
at this point both these are set to false false, so far so good. Next the code within the funtion is executed:
And here I must be missing something. At first look that first line looks redundant, since both the variables are still false. The IsLeftMouse command isnt called yet, so it looks like laststate still must be false.
But clearly it isnt, because else the program would not work.
I was thinking that since IsLeftMouse is listed in the eventlibrary, it sort of would be monitored even when the program is elswhere in the loop. But if that was the case, why would Isleftmouse to be in the loop at all, could it not just be called once at program start?
viewtopic.php?f=4&t=2099#p11046
I did test the program example and it is working as intended.
But there is probably something about event handling that I did not get yet, since I struggle to understand this.
First two lines in the main loop:
Code: Select all
laststate=currentstate=0
p_Update_input() Code: Select all
laststate=currentstate
currentstate=IsLeftMouse()But clearly it isnt, because else the program would not work.
I was thinking that since IsLeftMouse is listed in the eventlibrary, it sort of would be monitored even when the program is elswhere in the loop. But if that was the case, why would Isleftmouse to be in the loop at all, could it not just be called once at program start?