1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Don't use fps_max_unfocused for the pause menu

Nowadays, we have things like buttons that change appearance on hover, or scoll bars
in the pause menu. These do not work fine with low fps.
This commit is contained in:
Desour 2025-02-10 17:15:57 +01:00 committed by DS
parent a57677120a
commit 191cb117f9
4 changed files with 7 additions and 7 deletions

View file

@ -968,7 +968,7 @@ void Game::run()
// Calculate dtime =
// m_rendering_engine->run() from this iteration
// + Sleep time until the wanted FPS are reached
draw_times.limit(device, &dtime, g_menumgr.pausesGame());
draw_times.limit(device, &dtime);
framemarker.start();
@ -2504,7 +2504,7 @@ inline void Game::step(f32 dtime)
ZoneScoped;
if (server) {
float fps_max = (!device->isWindowFocused() || g_menumgr.pausesGame()) ?
float fps_max = !device->isWindowFocused() ?
g_settings->getFloat("fps_max_unfocused") :
g_settings->getFloat("fps_max");
fps_max = std::max(fps_max, 1.0f);

View file

@ -34,9 +34,9 @@ void FpsControl::reset()
last_time = porting::getTimeUs();
}
void FpsControl::limit(IrrlichtDevice *device, f32 *dtime, bool assume_paused)
void FpsControl::limit(IrrlichtDevice *device, f32 *dtime)
{
const float fps_limit = (device->isWindowFocused() && !assume_paused)
const float fps_limit = device->isWindowFocused()
? g_settings->getFloat("fps_max")
: g_settings->getFloat("fps_max_unfocused");
const u64 frametime_min = 1000000.0f / std::max(fps_limit, 1.0f);

View file

@ -45,7 +45,7 @@ struct FpsControl {
void reset();
void limit(IrrlichtDevice *device, f32 *dtime, bool assume_paused = false);
void limit(IrrlichtDevice *device, f32 *dtime);
u32 getBusyMs() const { return busy_time / 1000; }