SHARE
TWEET
renderloop
a guest
Dec 21st, 2014
154
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- procedure TEVApplication.MainLoop;
- var
- st: Single; //sleep time
- t: NativeUInt; //rendertime
- begin
- fRunning := true;
- st := 0;
- repeat
- t := SDL_GetTicks;
- HandleEvents;
- //of course only if there's a fps-limit
- if fMaxFPS > 0 then
- begin
- //calculate sleeptime
- st := (1000 / fMaxFPS - (SDL_GetTicks - t)) + st;
- if st > 0 then
- begin
- SDL_Delay(Trunc(st));
- //added correction
- //minimizes rounding-faults
- st := st - Trunc(st);
- end;
- end;
- //calculate fps
- t := SDL_GetTicks - t;
- if t > 0 then
- fFPS := Round(1000 / t);
- until not fRunning;
- end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

