diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-07 18:09:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-07 18:09:16 +0300 |
commit | 3eb27b1cb9b1f645ab5bf9d972ce3d73ec743226 (patch) | |
tree | de179f0ddf32d77da14646127fe5b612149ec73c /src/client.cpp | |
parent | 60ad04e80489e73a0765530dbfffc18322043b1c (diff) | |
download | manaverse-3eb27b1cb9b1f645ab5bf9d972ce3d73ec743226.tar.gz manaverse-3eb27b1cb9b1f645ab5bf9d972ce3d73ec743226.tar.bz2 manaverse-3eb27b1cb9b1f645ab5bf9d972ce3d73ec743226.tar.xz manaverse-3eb27b1cb9b1f645ab5bf9d972ce3d73ec743226.zip |
Move some events code from client into eventsmanager.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 111 |
1 files changed, 3 insertions, 108 deletions
diff --git a/src/client.cpp b/src/client.cpp index 5d1fbdb93..b5ae5ee09 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -959,8 +959,6 @@ int Client::gameExec() mumbleManager = new MumbleManager(); #endif - SDL_Event event; - if (Theme::instance()) mSkin = Theme::instance()->load("windowmenu.xml", ""); if (mSkin) @@ -973,113 +971,10 @@ int Client::gameExec() { PROFILER_START(); BLOCK_START("Client::gameExec 1") - if (mGame) - { - // Let the game handle the events while it is active - mGame->handleInput(); - } - else - { - BLOCK_START("Client::gameExec 2") - // Handle SDL events -#ifdef USE_SDL2 - while (SDL_WaitEventTimeout(&event, 0)) -#else - while (SDL_PollEvent(&event)) -#endif - { - if (eventsManager.handleEvent(event)) - continue; - - switch (event.type) - { - case SDL_QUIT: - mState = STATE_EXIT; - logger->log1("force exit"); - break; - - case SDL_KEYDOWN: - if (inputManager.handleAssignKey( - event, INPUT_KEYBOARD)) - { - continue; - } - inputManager.updateConditionMask(); - break; - - case SDL_KEYUP: - if (inputManager.handleAssignKey( - event, INPUT_KEYBOARD)) - { - continue; - } - inputManager.updateConditionMask(); - break; - - case SDL_JOYBUTTONDOWN: - inputManager.handleAssignKey(event, INPUT_JOYSTICK); - break; - - case SDL_MOUSEMOTION: - break; - -#ifdef ANDROID -#ifdef USE_SDL2 - // +++ need add support -#else - case SDL_ACTIVEEVENT: - if ((event.active.state & SDL_APPACTIVE) - && !event.active.gain) - { - mState = STATE_EXIT; - logger->log1("exit on lost focus"); - } - break; - - case SDL_KEYBOARDSHOW: - updateScreenKeyboard(event.user.code); - break; - - case SDL_ACCELEROMETER: - break; -#endif -#endif - - default: -// logger->log("unknown event: %d", event.type); - break; - -#ifdef USE_SDL2 - case SDL_WINDOWEVENT: - handleSDL2WindowEvent(event); - break; -#else -#ifndef ANDROID - case SDL_ACTIVEEVENT: - handleActive(event); - break; -#endif - case SDL_VIDEORESIZE: - resizeVideo(event.resize.w, event.resize.h, false); - break; -#endif - } + if (eventsManager.handleEvents()) + continue; - if (inputManager.handleEvent(event)) - continue; - -#ifdef USE_MUMBLE - if (player_node && mumbleManager) - { - mumbleManager->setPos(player_node->getTileX(), - player_node->getTileY(), player_node->getDirection()); - } -#endif - } - if (mState == STATE_EXIT) - continue; - BLOCK_END("Client::gameExec 2") - } + BLOCK_END("Client::gameExec 1") BLOCK_START("Client::gameExec 3") if (Net::getGeneralHandler()) |