commit 146ce3eb
The back button on the gamepad now works
Changed files
| M | source/code/MenuSystem.cpp before |
| M | source/code/main.cpp before |
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp
index 4fe273e..67abb78 100644
--- a/source/code/MenuSystem.cpp
+++ b/source/code/MenuSystem.cpp
@@ -290,7 +290,7 @@ bool isEscapeEvent(const SDL_Event& event) {
}
}
if (event.type == SDL_CONTROLLERBUTTONDOWN) {
- if (event.cbutton.button == SDL_CONTROLLER_BUTTON_Y ) {
+ if (event.cbutton.button == SDL_CONTROLLER_BUTTON_Y || event.cbutton.button == SDL_CONTROLLER_BUTTON_BACK ) {
return true;
}
}
diff --git a/source/code/main.cpp b/source/code/main.cpp
index aa8deb5..25fe404 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -1333,6 +1333,13 @@ int runGame(Gametype gametype, int level) {
done = 1;
}
+ if (event.type == SDL_CONTROLLERBUTTONDOWN) {
+ if ( event.cbutton.button == SDL_CONTROLLER_BUTTON_BACK ) {
+ done=1;
+ DrawBackground(globalData.screen);
+ }
+ }
+
if ( event.type == SDL_KEYDOWN ) {
if ( event.key.keysym.sym == SDLK_ESCAPE || ( event.key.keysym.sym == SDLK_RETURN && theGame.isGameOver() ) ) {
done=1;