From: Ingo Ruhnke Date: Wed, 27 Aug 2014 08:12:05 +0000 (+0200) Subject: Split Controller::PAUSE_MENU into ESCAPE and START, as they need to act different... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=06a023bf3e11d92a5c0b1127823527110b732745;p=supertux.git Split Controller::PAUSE_MENU into ESCAPE and START, as they need to act different in some contexts --- diff --git a/src/control/controller.hpp b/src/control/controller.hpp index ab9decd61..210159dcd 100644 --- a/src/control/controller.hpp +++ b/src/control/controller.hpp @@ -31,7 +31,8 @@ public: JUMP, ACTION, - PAUSE_MENU, + START, + ESCAPE, MENU_SELECT, MENU_BACK, diff --git a/src/control/game_controller_manager.cpp b/src/control/game_controller_manager.cpp index 4c9ccbf15..6680c0411 100644 --- a/src/control/game_controller_manager.cpp +++ b/src/control/game_controller_manager.cpp @@ -75,7 +75,7 @@ GameControllerManager::process_button_event(const SDL_ControllerButtonEvent& ev) break; case SDL_CONTROLLER_BUTTON_START: - set_control(Controller::PAUSE_MENU, ev.state); + set_control(Controller::START, ev.state); break; case SDL_CONTROLLER_BUTTON_LEFTSTICK: diff --git a/src/control/joystick_config.cpp b/src/control/joystick_config.cpp index 6a0db6902..b7d8b78c3 100644 --- a/src/control/joystick_config.cpp +++ b/src/control/joystick_config.cpp @@ -35,7 +35,7 @@ JoystickConfig::JoystickConfig() : bind_joybutton(0, 1, Controller::ACTION); bind_joybutton(0, 4, Controller::PEEK_LEFT); bind_joybutton(0, 5, Controller::PEEK_RIGHT); - bind_joybutton(0, 6, Controller::PAUSE_MENU); + bind_joybutton(0, 6, Controller::START); // Default joystick axis configuration bind_joyaxis(0, -1, Controller::LEFT); diff --git a/src/control/keyboard_config.cpp b/src/control/keyboard_config.cpp index dd2bf120f..db6114a88 100644 --- a/src/control/keyboard_config.cpp +++ b/src/control/keyboard_config.cpp @@ -31,9 +31,9 @@ KeyboardConfig::KeyboardConfig() : keymap[SDLK_SPACE] = Controller::JUMP; keymap[SDLK_LCTRL] = Controller::ACTION; keymap[SDLK_LALT] = Controller::ACTION; - keymap[SDLK_ESCAPE] = Controller::PAUSE_MENU; - keymap[SDLK_p] = Controller::PAUSE_MENU; - keymap[SDLK_PAUSE] = Controller::PAUSE_MENU; + keymap[SDLK_ESCAPE] = Controller::ESCAPE; + keymap[SDLK_p] = Controller::START; + keymap[SDLK_PAUSE] = Controller::START; keymap[SDLK_RETURN] = Controller::MENU_SELECT; keymap[SDLK_KP_ENTER] = Controller::MENU_SELECT; keymap[SDLK_CARET] = Controller::CONSOLE; diff --git a/src/control/keyboard_manager.cpp b/src/control/keyboard_manager.cpp index d088dc0cc..7818dc835 100644 --- a/src/control/keyboard_manager.cpp +++ b/src/control/keyboard_manager.cpp @@ -190,8 +190,10 @@ KeyboardManager::process_menu_key_event(const SDL_KeyboardEvent& event) control = Controller::MENU_SELECT; break; case SDLK_ESCAPE: + control = Controller::ESCAPE; + break; case SDLK_PAUSE: - control = Controller::PAUSE_MENU; + control = Controller::START; break; default: return; diff --git a/src/gui/dialog.cpp b/src/gui/dialog.cpp index d48991152..e536c9cd3 100644 --- a/src/gui/dialog.cpp +++ b/src/gui/dialog.cpp @@ -164,7 +164,8 @@ Dialog::process_input(const Controller& controller) } if (m_cancel_button != -1 && - controller.pressed(Controller::MENU_BACK)) + (controller.pressed(Controller::ESCAPE) || + controller.pressed(Controller::MENU_BACK))) { on_button_click(m_cancel_button); } diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index e17764dc1..1a636ee0a 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -227,8 +227,9 @@ Menu::process_input() || controller->pressed(Controller::MENU_SELECT)) { menuaction = MENU_ACTION_HIT; } - if(controller->pressed(Controller::PAUSE_MENU) - || controller->pressed(Controller::MENU_BACK)) { + if(controller->pressed(Controller::ESCAPE) || + controller->pressed(Controller::START) || + controller->pressed(Controller::MENU_BACK)) { menuaction = MENU_ACTION_BACK; } diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp index ce95ed4df..9c06460c6 100644 --- a/src/supertux/game_session.cpp +++ b/src/supertux/game_session.cpp @@ -419,7 +419,8 @@ void GameSession::update(float elapsed_time) { // handle controller - if(InputManager::current()->get_controller()->pressed(Controller::PAUSE_MENU)) + if(InputManager::current()->get_controller()->pressed(Controller::ESCAPE) || + InputManager::current()->get_controller()->pressed(Controller::START)) { on_escape_press(); } diff --git a/src/supertux/levelintro.cpp b/src/supertux/levelintro.cpp index 82b9651d5..f4b77acbf 100644 --- a/src/supertux/levelintro.cpp +++ b/src/supertux/levelintro.cpp @@ -59,7 +59,8 @@ LevelIntro::update(float elapsed_time) if(controller->pressed(Controller::JUMP) || controller->pressed(Controller::ACTION) || controller->pressed(Controller::MENU_SELECT) - || controller->pressed(Controller::PAUSE_MENU)) { + || controller->pressed(Controller::START) + || controller->pressed(Controller::ESCAPE)) { ScreenManager::current()->pop_screen(std::unique_ptr(new FadeOut(0.1))); } diff --git a/src/supertux/menu/joystick_menu.cpp b/src/supertux/menu/joystick_menu.cpp index fa4545acb..c60bd7142 100644 --- a/src/supertux/menu/joystick_menu.cpp +++ b/src/supertux/menu/joystick_menu.cpp @@ -70,7 +70,7 @@ JoystickMenu::recreate_menu() add_controlfield(Controller::RIGHT, _("Right")); add_controlfield(Controller::JUMP, _("Jump")); add_controlfield(Controller::ACTION, _("Action")); - add_controlfield(Controller::PAUSE_MENU, _("Pause/Menu")); + add_controlfield(Controller::START, _("Pause/Menu")); add_controlfield(Controller::PEEK_LEFT, _("Peek Left")); add_controlfield(Controller::PEEK_RIGHT, _("Peek Right")); add_controlfield(Controller::PEEK_UP, _("Peek Up")); @@ -219,7 +219,7 @@ JoystickMenu::refresh() refresh_menu_item(Controller::JUMP); refresh_menu_item(Controller::ACTION); - refresh_menu_item(Controller::PAUSE_MENU); + refresh_menu_item(Controller::START); refresh_menu_item(Controller::PEEK_LEFT); refresh_menu_item(Controller::PEEK_RIGHT); refresh_menu_item(Controller::PEEK_UP); diff --git a/src/supertux/textscroller.cpp b/src/supertux/textscroller.cpp index d09e32e8c..491e1ddb3 100644 --- a/src/supertux/textscroller.cpp +++ b/src/supertux/textscroller.cpp @@ -106,7 +106,8 @@ TextScroller::update(float elapsed_time) || controller->pressed(Controller::MENU_SELECT) )&& !(controller->pressed(Controller::UP))) // prevent skipping if jump with up is enabled scroll += SCROLL; - if(controller->pressed(Controller::PAUSE_MENU)) { + if(controller->pressed(Controller::START) || + controller->pressed(Controller::ESCAPE)) { ScreenManager::current()->pop_screen(std::unique_ptr(new FadeOut(0.5))); } diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index fcf772e5f..e6b479a94 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -643,7 +643,8 @@ WorldMap::update(float delta) if(!controller->pressed(Controller::UP)) enter_level = true; } - if(controller->pressed(Controller::PAUSE_MENU)) + if(controller->pressed(Controller::START) || + controller->pressed(Controller::ESCAPE)) { on_escape_press(); }