Skip to content

Commit

Permalink
Added MENU_BACK button (i.e. B on Xbox360 controller)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grumbel committed Aug 6, 2014
1 parent 18f921d commit a87aaf1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/control/controller.cpp
Expand Up @@ -25,6 +25,7 @@ const char* Controller::controlNames[] = {
"action",
"pause-menu",
"menu-select",
"menu-back",
"console",
"peek-left",
"peek-right",
Expand Down
1 change: 1 addition & 0 deletions src/control/controller.hpp
Expand Up @@ -33,6 +33,7 @@ class Controller

PAUSE_MENU,
MENU_SELECT,
MENU_BACK,

CONSOLE,

Expand Down
1 change: 1 addition & 0 deletions src/control/game_controller_manager.cpp
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/gui/menu.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit a87aaf1

Please sign in to comment.