Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For everyone who makes games !
#6
(12-09-2023, 09:26 AM)RhoSigma Wrote: 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..

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
The option I showed helps in that if the timing of the main cycle is changed (with _limit or _timer, this is irrelevant now), then the movement and speed of the animations will remain unchanged. What you have shown is a possible solution to a fixed timing.
Reply


Messages In This Thread
For everyone who makes games ! - by MasterGy - 12-08-2023, 11:02 PM
RE: For everyone who makes games ! - by NakedApe - 12-09-2023, 01:02 AM
RE: For everyone who makes games ! - by grymmjack - 12-09-2023, 02:21 AM
RE: For everyone who makes games ! - by RhoSigma - 12-09-2023, 09:26 AM
RE: For everyone who makes games ! - by MasterGy - 12-09-2023, 03:14 PM



Users browsing this thread: 1 Guest(s)