diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-24 12:09:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 21:08:17 +0300 |
commit | 9b727d191c9cea2324a8505296b08d0719a49207 (patch) | |
tree | 819b7af1ab2c71ed2c9ccda725f51ead590fdbd7 /src | |
parent | fe8eaac0bddd1d6416bf16abdb9206290fcced2f (diff) | |
download | manaverse-9b727d191c9cea2324a8505296b08d0719a49207.tar.gz manaverse-9b727d191c9cea2324a8505296b08d0719a49207.tar.bz2 manaverse-9b727d191c9cea2324a8505296b08d0719a49207.tar.xz manaverse-9b727d191c9cea2324a8505296b08d0719a49207.zip |
fix delays is window minimized in SDL2.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/client.cpp b/src/client.cpp index 8a197d5aa..9c3397f72 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1051,15 +1051,8 @@ int Client::gameExec() // This is done because at some point tick_time will wrap. lastTickTime = tick_time; -#ifdef USE_SDL2 - // +++ need check active state - frame_count++; - if (gui) - gui->draw(); - mainGraphics->updateScreen(); -#else - // Update the screen when application is active, delay otherwise. - if (SDL_GetAppState() & SDL_APPACTIVE) + // Update the screen when application is visible, delay otherwise. + if (!mIsMinimized) { frame_count++; if (gui) @@ -1070,7 +1063,6 @@ int Client::gameExec() { SDL_Delay(100); } -#endif BLOCK_START("~Client::SDL_framerateDelay") if (mLimitFps) @@ -3132,6 +3124,13 @@ void Client::handleSDL2WindowEvent(const SDL_Event &event) case SDL_WINDOWEVENT_FOCUS_LOST: setInputFocused(false); break; + case SDL_WINDOWEVENT_MINIMIZED: + setIsMinimized(true); + break; + case SDL_WINDOWEVENT_RESTORED: + case SDL_WINDOWEVENT_MAXIMIZED: + setIsMinimized(false); + break; default: break; } |