From: Ingo Ruhnke Date: Wed, 6 Aug 2014 04:37:29 +0000 (+0200) Subject: Added MENU_BACK button (i.e. B on Xbox360 controller) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a87aaf19af7fd79fd7cfe18e4ceb1821f347da15;p=supertux.git Added MENU_BACK button (i.e. B on Xbox360 controller) --- diff --git a/src/control/controller.cpp b/src/control/controller.cpp index 93d6536e4..6a3882e56 100644 --- a/src/control/controller.cpp +++ b/src/control/controller.cpp @@ -25,6 +25,7 @@ const char* Controller::controlNames[] = { "action", "pause-menu", "menu-select", + "menu-back", "console", "peek-left", "peek-right", diff --git a/src/control/controller.hpp b/src/control/controller.hpp index 5bec7581c..b73695d5c 100644 --- a/src/control/controller.hpp +++ b/src/control/controller.hpp @@ -33,6 +33,7 @@ public: PAUSE_MENU, MENU_SELECT, + MENU_BACK, CONSOLE, diff --git a/src/control/game_controller_manager.cpp b/src/control/game_controller_manager.cpp index 160e598e8..b76d41fe7 100644 --- a/src/control/game_controller_manager.cpp +++ b/src/control/game_controller_manager.cpp @@ -49,6 +49,7 @@ GameControllerManager::process_button_event(const SDL_ControllerButtonEvent& ev) break; case SDL_CONTROLLER_BUTTON_B: + controller->set_control(Controller::MENU_BACK, ev.state); break; case SDL_CONTROLLER_BUTTON_X: diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index e3fce4b5d..c2917e7c6 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -273,7 +273,8 @@ Menu::update() || controller->pressed(Controller::MENU_SELECT)) { menuaction = MENU_ACTION_HIT; } - if(controller->pressed(Controller::PAUSE_MENU)) { + if(controller->pressed(Controller::PAUSE_MENU) + || controller->pressed(Controller::MENU_BACK)) { menuaction = MENU_ACTION_BACK; }