diff --git a/units/input.cpp b/units/input.cpp index 3db3cd8..5597f6c 100644 --- a/units/input.cpp +++ b/units/input.cpp @@ -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); } \ No newline at end of file diff --git a/units/input.h b/units/input.h index 5bf073e..3bdce07 100644 --- a/units/input.h +++ b/units/input.h @@ -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