summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-07 18:35:19 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-07 18:35:19 +0300
commit29cae530ae1796f37fe923fe372c695783b559de (patch)
tree0b02e47dbd52b1fada0b94b2b9956ab0b6308f6c /src/game.cpp
parent3eb27b1cb9b1f645ab5bf9d972ce3d73ec743226 (diff)
downloadmv-29cae530ae1796f37fe923fe372c695783b559de.tar.gz
mv-29cae530ae1796f37fe923fe372c695783b559de.tar.bz2
mv-29cae530ae1796f37fe923fe372c695783b559de.tar.xz
mv-29cae530ae1796f37fe923fe372c695783b559de.zip
Move some events code from game into eventsmanager.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp57
1 files changed, 1 insertions, 56 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6592e6ae9..971352234 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1009,62 +1009,7 @@ void Game::handleInput()
if (joystick)
joystick->logic();
- // Events
- SDL_Event event;
-#ifdef USE_SDL2
- while (SDL_WaitEventTimeout(&event, 0))
-#else
- while (SDL_PollEvent(&event))
-#endif
- {
- BLOCK_START("Game::handleInput 2")
-// if (eventsManager.handleEvent(event))
-// continue;
-
- if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP)
- updateHistory(event);
- checkKeys();
-
- if (inputManager.handleEvent(event))
- {
- BLOCK_END("Game::handleInput 2")
- BLOCK_END("Game::handleInput 1")
- return;
- }
-
- switch (event.type)
- {
-#ifdef USE_SDL2
- case SDL_WINDOWEVENT:
- {
- handleSDL2WindowEvent(event);
- break;
- }
-#else
- case SDL_VIDEORESIZE:
- client->resizeVideo(event.resize.w, event.resize.h);
- break;
- // Active event
- case SDL_ACTIVEEVENT:
- handleActive(event);
- break;
-#endif
- // Quit event
- case SDL_QUIT:
- client->setState(STATE_EXIT);
- break;
-#ifdef ANDROID
-#ifndef USE_SDL2
- case SDL_KEYBOARDSHOW:
- client->updateScreenKeyboard(event.user.code);
- break;
-#endif
-#endif
- default:
- break;
- }
- BLOCK_END("Game::handleInput 2")
- } // End while
+ eventsManager.handleGameEvents();
// If the user is configuring the keys then don't respond.
if (!player_node || !keyboard.isEnabled() || player_node->getAway())