mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
don't assume first frame happens at 0 ticks
This commit is contained in:
parent
5c7de32a7c
commit
5aaa4e399a
1 changed files with 2 additions and 0 deletions
|
@ -328,6 +328,8 @@ static bool gfx_sdl_start_frame(void) {
|
|||
|
||||
static inline void sync_framerate_with_timer(void) {
|
||||
static Uint32 last_time = 0;
|
||||
// get base timestamp on the first frame (might be different from 0)
|
||||
if (last_time == 0) last_time = SDL_GetTicks();
|
||||
const int elapsed = SDL_GetTicks() - last_time;
|
||||
if (elapsed < frame_time)
|
||||
SDL_Delay(frame_time - elapsed);
|
||||
|
|
Loading…
Reference in a new issue