Don't update frames, when window is not focused
parent
1920bd851e
commit
568ad2ef97
12
src/game.cpp
12
src/game.cpp
|
@ -1697,12 +1697,16 @@ void Game::run()
|
|||
while (device->run()
|
||||
&& !(*kill || g_gamecallback->shutdown_requested
|
||||
|| (server && server->getShutdownRequested()))) {
|
||||
#ifdef __IOS__
|
||||
if (device->isWindowMinimized())
|
||||
#if defined(__MACH__) && defined(__APPLE__) && !TARGET_OS_IOS
|
||||
if (!device->isWindowFocused()) {
|
||||
sleep_ms(50);
|
||||
continue;
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
if (!device->isWindowFocused())
|
||||
}
|
||||
#elif defined(__ANDROID__) || defined(__IOS__)
|
||||
if (device->isWindowMinimized()) {
|
||||
sleep_ms(50);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
const irr::core::dimension2d<u32> ¤t_screen_size =
|
||||
|
|
|
@ -279,11 +279,13 @@ void GUIEngine::run()
|
|||
while (m_device->run() && (!m_startgame) && (!m_kill)) {
|
||||
#ifdef __IOS__
|
||||
if (m_device->isWindowMinimized())
|
||||
continue;
|
||||
#elif defined(__ANDROID__)
|
||||
#else
|
||||
if (!m_device->isWindowFocused())
|
||||
continue;
|
||||
#endif
|
||||
{
|
||||
sleep_ms(50);
|
||||
continue;
|
||||
}
|
||||
|
||||
const irr::core::dimension2d<u32> ¤t_screen_size =
|
||||
m_device->getVideoDriver()->getScreenSize();
|
||||
|
@ -321,9 +323,7 @@ void GUIEngine::run()
|
|||
|
||||
driver->endScene();
|
||||
|
||||
u32 frametime_min = 2000 / (!m_device->isWindowFocused()
|
||||
? g_settings->getFloat("pause_fps_max")
|
||||
: g_settings->getFloat("fps_max"));
|
||||
u32 frametime_min = 1000 / g_settings->getFloat("pause_fps_max") / 2;
|
||||
|
||||
if (m_clouds_enabled)
|
||||
cloudPostProcess();
|
||||
|
|
Loading…
Reference in New Issue