Added SDL_DelayPrecise()
SDL_DelayNS() now passes through to the high precision OS delay function, and SDL_DelayPrecise() tries to busy wait to get as close as possible to the desired wait time. Fixes https://github.com/libsdl-org/SDL/issues/11141
This commit is contained in:
@@ -65,7 +65,7 @@ int SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit,
|
||||
} else {
|
||||
const Uint64 now = SDL_GetTicksNS();
|
||||
if (next_iteration > now) { // Running faster than the limit, sleep a little.
|
||||
SDL_DelayNS(next_iteration - now);
|
||||
SDL_DelayPrecise(next_iteration - now);
|
||||
} else {
|
||||
next_iteration = now; // running behind (or just lost the window)...reset the timer.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user