input: Añadido clearBindings()

This commit is contained in:
2023-05-23 20:09:31 +02:00
parent 71a81755d0
commit aca80e43a5
2 changed files with 21 additions and 3 deletions

View File

@@ -325,7 +325,7 @@ void Input::setDefaultBindings()
bindKey(INPUT_BUTTON_1, SDL_SCANCODE_Z);
bindKey(INPUT_BUTTON_2, SDL_SCANCODE_X);
bindKey(INPUT_ACCEPT, SDL_SCANCODE_RETURN);
bindKey(INPUT_CANCEL, SDL_SCANCODE_ESCAPE);
bindKey(INPUT_PAUSE, SDL_SCANCODE_H);
@@ -336,7 +336,7 @@ void Input::setDefaultBindings()
bindGameControllerButton(INPUT_DOWN, SDL_CONTROLLER_BUTTON_DPAD_DOWN);
bindGameControllerButton(INPUT_LEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT);
bindGameControllerButton(INPUT_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT);
bindGameControllerButton(INPUT_BUTTON_1, SDL_CONTROLLER_BUTTON_A);
bindGameControllerButton(INPUT_BUTTON_2, SDL_CONTROLLER_BUTTON_B);
bindGameControllerButton(INPUT_BUTTON_3, SDL_CONTROLLER_BUTTON_X);
@@ -345,9 +345,24 @@ void Input::setDefaultBindings()
bindGameControllerButton(INPUT_BUTTON_6, SDL_CONTROLLER_BUTTON_START);
bindGameControllerButton(INPUT_BUTTON_7, SDL_CONTROLLER_BUTTON_LEFTSHOULDER);
bindGameControllerButton(INPUT_BUTTON_8, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
bindGameControllerButton(INPUT_ACCEPT, SDL_CONTROLLER_BUTTON_A);
bindGameControllerButton(INPUT_CANCEL, SDL_CONTROLLER_BUTTON_B);
bindGameControllerButton(INPUT_PAUSE, SDL_CONTROLLER_BUTTON_START);
bindGameControllerButton(INPUT_EXIT, SDL_CONTROLLER_BUTTON_BACK);
}
// Elimina todas las asociaciones de teclado y mando al objeto
void Input::clearBindings()
{
// Inicializa las variables
keyBindings_t kb;
kb.scancode = 0;
kb.active = false;
keyBindings.resize(INPUT_TOTAL, kb);
GameControllerBindings_t gcb;
gcb.button = SDL_CONTROLLER_BUTTON_INVALID;
gcb.active = false;
gameControllerBindings.resize(INPUT_TOTAL, gcb);
}

View File

@@ -129,6 +129,9 @@ public:
// Establece unas teclas y botones del mando por defectp
void setDefaultBindings();
// Elimina todas las asociaciones de teclado y mando al objeto
void clearBindings();
};
#endif