diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-07 20:05:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-07 20:05:56 +0300 |
commit | 327312c8f5a4fb89b0d38ae179c76e9885bfb698 (patch) | |
tree | 0e9f1eb4fa3ccdcf20f30b2bfbcd678ed402371f /src/game.cpp | |
parent | c89329623cbe5a2c3d5baf25fc58808f13af6069 (diff) | |
download | manaverse-327312c8f5a4fb89b0d38ae179c76e9885bfb698.tar.gz manaverse-327312c8f5a4fb89b0d38ae179c76e9885bfb698.tar.bz2 manaverse-327312c8f5a4fb89b0d38ae179c76e9885bfb698.tar.xz manaverse-327312c8f5a4fb89b0d38ae179c76e9885bfb698.zip |
move window events handling into eventsmanager.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/game.cpp b/src/game.cpp index 971352234..1e8d19398 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -877,109 +877,6 @@ void Game::moveInDirection(const unsigned char direction) } } -#ifdef USE_SDL2 -void Game::handleSDL2WindowEvent(const SDL_Event &event) -{ - int fpsLimit = 0; - const int eventType = event.window.event; - switch (eventType) - { - case SDL_WINDOWEVENT_RESIZED: - client->resizeVideo(event.window.data1, event.window.data2, false); - break; - case SDL_WINDOWEVENT_ENTER: - client->setMouseFocused(true); - break; - case SDL_WINDOWEVENT_LEAVE: - client->setMouseFocused(false); - break; - case SDL_WINDOWEVENT_FOCUS_GAINED: - client->setInputFocused(true); - break; - case SDL_WINDOWEVENT_FOCUS_LOST: - client->setInputFocused(false); - break; - case SDL_WINDOWEVENT_MINIMIZED: - client->setIsMinimized(true); - if (player_node && !player_node->getAway()) - { - fpsLimit = config.getIntValue("altfpslimit"); - player_node->setHalfAway(true); - } - setPriority(false); - break; - case SDL_WINDOWEVENT_RESTORED: - case SDL_WINDOWEVENT_MAXIMIZED: - client->setIsMinimized(false); - if (player_node) - { - if (!player_node->getAway()) - fpsLimit = config.getIntValue("fpslimit"); - player_node->setHalfAway(false); - } - setPriority(true); - break; - default: - break; - } - - if (eventType == SDL_WINDOWEVENT_MINIMIZED - || eventType == SDL_WINDOWEVENT_RESTORED - || eventType == SDL_WINDOWEVENT_MAXIMIZED) - { - if (player_node) - { - player_node->updateStatus(); - player_node->updateName(); - } - updateFrameRate(fpsLimit); - } -} -#else -void Game::handleActive(const SDL_Event &event) -{ - int fpsLimit = 0; - if (event.active.state & SDL_APPACTIVE) - { - if (event.active.gain) - { // window restore - client->setIsMinimized(false); - if (player_node) - { - if (!player_node->getAway()) - fpsLimit = config.getIntValue("fpslimit"); - player_node->setHalfAway(false); - } - setPriority(true); - } - else - { // window minimization -#ifdef ANDROID - client->setState(STATE_EXIT); -#else - client->setIsMinimized(true); - if (player_node && !player_node->getAway()) - { - fpsLimit = config.getIntValue("altfpslimit"); - player_node->setHalfAway(true); - } - setPriority(false); -#endif - } - if (player_node) - player_node->updateStatus(); - } - if (player_node) - player_node->updateName(); - - if (event.active.state & SDL_APPINPUTFOCUS) - client->setInputFocused(event.active.gain); - if (event.active.state & SDL_APPMOUSEFOCUS) - client->setMouseFocused(event.active.gain); - updateFrameRate(fpsLimit); -} -#endif - void Game::updateFrameRate(int fpsLimit) { if (!fpsLimit) |