I found that 2 loops are executed each frame on the ‘Main’; they are ‘Draw’ and ‘Touch’; in the ‘Draw’ loop, I call the draw loops of my class / classes which draw the graphics; in the ‘Touch’ loop, i call the touch loop of the class / classes (which need it).
I miss some loops for update (which update logic); I create this loops on my classes (Update), and I call from ‘Draw’ loop of the ‘Main’; It will be great to get another ‘executed each frame loop’ on the ‘Main’ to include the update of logic.
Is there any way to include more ‘executed each frame loop’ on the ‘Main’?
Thanks in advance,
Your description of what happens is not quite correct. The
touched function is executed once for each touch between each
draw call. So there’s only one function that you can rely on being called once each cycle. You could simply add an update function to the draw loop:
-- draw some stuff
-- update all stuff
Some here like to hide this sort of thing. Put this somewhere where it will be executed after the
draw function is defined (could do it in setup, could just do it at the end of the
_draw = draw
Thanks so much for clarify me the ‘draw’ and ‘touch’ loops (it’s great to know really how it works!).
Regarding the ‘update’ loop, i did exactly that, but I think that it will be more clean to get 2 loops (draw & update), independents. (Although I understand that not all people wants to add complexity).
Thanks so much!