1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Reduce the FPS when the window is unfocused (#8837)

This commit is contained in:
HybridDog 2020-10-03 18:33:51 +02:00 committed by GitHub
parent 4b423ee9b1
commit 9dc29a75b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 16 deletions

View file

@ -3996,9 +3996,10 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime)
else
fps_timings->busy_time = 0;
u32 frametime_min = 1000 / (g_menumgr.pausesGame()
? g_settings->getFloat("pause_fps_max")
: g_settings->getFloat("fps_max"));
u32 frametime_min = 1000 / (
device->isWindowFocused() && !g_menumgr.pausesGame()
? g_settings->getFloat("fps_max")
: g_settings->getFloat("fps_max_unfocused"));
if (fps_timings->busy_time < frametime_min) {
fps_timings->sleep_time = frametime_min - fps_timings->busy_time;