Don't max out fps if engine runs in the background or is unfocused

This commit is contained in:
Robert Beckebans 2025-01-22 21:37:56 +01:00
parent 4904fdbf1b
commit 3382365feb

View file

@ -688,12 +688,16 @@ void idCommonLocal::Frame()
gameTimeResidual += clampedDeltaMilliseconds * timescale.GetFloat();
// don't run any frames when paused
/*
RB moved down
if( pauseGame )
{
gameFrame++;
gameTimeResidual = 0;
break;
}
*/
// debug cvar to force multiple game tics
if( com_fixedTic.GetInteger() > 0 )
@ -753,6 +757,14 @@ void idCommonLocal::Frame()
}
}
// don't run any frames when paused
// RB: reset numGameFrames here so we use the sleep above
// and don't run as many frames as possible on the GPU
if( pauseGame )
{
numGameFrames = 0;
}
//--------------------------------------------
// It would be better to push as much of this as possible
// either before or after the renderSystem->SwapCommandBuffers(),