Pump events while waiting in fps limiter (#1770)

This commit is contained in:
gendlin 2024-07-14 01:40:24 -04:00 committed by GitHub
parent 4b1a859f95
commit 3040d384b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -830,6 +830,7 @@ void I_FinishUpdate(void)
if (use_limiter)
{
uint64_t target_time = 1000000ull / targetrefresh;
uint64_t last_pump = 0;
while (true)
{
@ -842,7 +843,14 @@ void I_FinishUpdate(void)
break;
}
if (target_time - elapsed_time > 1000)
uint64_t remaining_time = target_time - elapsed_time;
if (remaining_time > 200 && current_time - last_pump > 200)
{
last_pump = current_time;
SDL_PumpEvents();
}
else if (remaining_time > 1000)
{
I_SleepUS(500);
}