Implemented VSync timer using SDL

This commit is contained in:
n00b
2024-12-20 17:04:40 -05:00
parent 6f93be7a23
commit 8b8be85dea
4 changed files with 22 additions and 2 deletions

View File

@@ -79,6 +79,13 @@ void rc_preUpdate()
bool rc_update()
{
if(rc_window_vsync)
{
int frame_delay = 1000/rc_vsync_refresh_rate;
while( (SDL_GetTicks()-rc_vsync_timer) < frame_delay ){}
rc_vsync_timer = SDL_GetTicks();
}
if(!device->run())
return false;