don't call SDL_Delay with 0 argument

This commit is contained in:
Andrei "Akari" Alexeyev 2017-09-25 23:06:17 +03:00
parent 3c5903ec86
commit d63360997b
No known key found for this signature in database
GPG key ID: 048C3D2A5648B785

View file

@ -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();