diff options
author | HybridDog <3192173+HybridDog@users.noreply.github.com> | 2020-10-03 18:33:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-03 17:33:51 +0100 |
commit | 9dc29a75b416c6dab27ce93d0129383309cbf2c2 (patch) | |
tree | dabdf0456227196499a02a2db8717788dd80a1f7 /src/client/game.cpp | |
parent | 4b423ee9b12aabe6ccd6a8e7dbc7db1d89dc365b (diff) | |
download | minetest-9dc29a75b416c6dab27ce93d0129383309cbf2c2.tar.gz minetest-9dc29a75b416c6dab27ce93d0129383309cbf2c2.tar.bz2 minetest-9dc29a75b416c6dab27ce93d0129383309cbf2c2.zip |
Reduce the FPS when the window is unfocused (#8837)
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r-- | src/client/game.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp index 920383aaf..8f9d51417 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -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; |