don't call SDL_Delay with 0 argument
This commit is contained in:
parent
3c5903ec86
commit
d63360997b
1 changed files with 3 additions and 2 deletions
|
@ -279,9 +279,10 @@ void limit_frame_rate(uint64_t *lasttime) {
|
|||
|
||||
double passed = (double)(SDL_GetPerformanceCounter() - *lasttime) / SDL_GetPerformanceFrequency();
|
||||
double delay = 1.0 / FPS - passed;
|
||||
uint32_t delay_ms = (uint32_t)(delay * 1000.0);
|
||||
|
||||
if(delay > 0) {
|
||||
SDL_Delay((uint32_t)(delay * 1000.0));
|
||||
if(delay > 0 && delay_ms > 0) {
|
||||
SDL_Delay(delay_ms);
|
||||
}
|
||||
|
||||
*lasttime = SDL_GetPerformanceCounter();
|
||||
|
|
Loading…
Reference in a new issue