12-09-2023, 09:26 AM
When reading that Wiki page correctly, then its almost the same thing I do here:
Measuring time myself in that way is what I do to keep approx. 25FPS, you find those kind of constructs a lot in my GuiTools Framework eg. to avoid flicker when moving slider/scroller knobs etc..
Measuring time myself in that way is what I do to keep approx. 25FPS, you find those kind of constructs a lot in my GuiTools Framework eg. to avoid flicker when moving slider/scroller knobs etc..
Code: (Select All)
_DISPLAY 'stop _AUTODISPLAY
stim# = TIMER(0.001) 'get start time
DO
'---------------------
'do drawing stuff here
'---------------------
etim# = TIMER(0.001) - stim# 'time needed for drawing (delta time)
IF etim# < 0 THEN etim# = etim# + 86400 'midnight fix
IF etim# >= 0.04 THEN 'desired FPS 1/25 = 0.04
_DISPLAY
stim# = TIMER(0.001) 'restart timer
END IF
LOOP UNTIL done%
_AUTODISPLAY 'back to normal
GuiTools, Blankers & other Projects:
https://qb64phoenix.com/forum/forumdisplay.php?fid=32
Libraries & useful Functions:
https://qb64phoenix.com/forum/forumdisplay.php?fid=23
https://qb64phoenix.com/forum/forumdisplay.php?fid=32
Libraries & useful Functions:
https://qb64phoenix.com/forum/forumdisplay.php?fid=23