input fix: clearBindings no borraba completamente el vector de asignaciones

This commit is contained in:
2023-05-23 20:12:07 +02:00
parent aca80e43a5
commit cb8d8e19e1

View File

@@ -11,11 +11,13 @@ Input::Input(string file, bool verbose)
keyBindings_t kb; keyBindings_t kb;
kb.scancode = 0; kb.scancode = 0;
kb.active = false; kb.active = false;
keyBindings.clear();
keyBindings.resize(INPUT_TOTAL, kb); keyBindings.resize(INPUT_TOTAL, kb);
GameControllerBindings_t gcb; GameControllerBindings_t gcb;
gcb.button = SDL_CONTROLLER_BUTTON_INVALID; gcb.button = SDL_CONTROLLER_BUTTON_INVALID;
gcb.active = false; gcb.active = false;
gameControllerBindings.clear();
gameControllerBindings.resize(INPUT_TOTAL, gcb); gameControllerBindings.resize(INPUT_TOTAL, gcb);
this->verbose = verbose; this->verbose = verbose;
@@ -359,10 +361,12 @@ void Input::clearBindings()
keyBindings_t kb; keyBindings_t kb;
kb.scancode = 0; kb.scancode = 0;
kb.active = false; kb.active = false;
keyBindings.clear();
keyBindings.resize(INPUT_TOTAL, kb); keyBindings.resize(INPUT_TOTAL, kb);
GameControllerBindings_t gcb; GameControllerBindings_t gcb;
gcb.button = SDL_CONTROLLER_BUTTON_INVALID; gcb.button = SDL_CONTROLLER_BUTTON_INVALID;
gcb.active = false; gcb.active = false;
gameControllerBindings.clear();
gameControllerBindings.resize(INPUT_TOTAL, gcb); gameControllerBindings.resize(INPUT_TOTAL, gcb);
} }