Input: mogudes structs, enums i consts a la part publica

This commit is contained in:
2025-07-30 08:53:57 +02:00
parent 677feb3afe
commit 989f081a25
14 changed files with 302 additions and 275 deletions

View File

@@ -51,12 +51,12 @@ void DefineButtons::doControllerButtonDown(const SDL_GamepadButtonEvent &event)
// Asigna los botones definidos al input_
void DefineButtons::bindButtons() {
for (const auto &button : buttons_) {
input_->bindGameControllerButton(index_controller_, button.input, button.button);
input_->bindGameControllerButton(index_controller_, button.action, button.button);
}
// Remapea los inputs a inputs
input_->bindGameControllerButton(index_controller_, InputAction::SM_SELECT, InputAction::FIRE_LEFT);
input_->bindGameControllerButton(index_controller_, InputAction::SM_BACK, InputAction::FIRE_CENTER);
input_->bindGameControllerButton(index_controller_, Input::Action::SM_SELECT, Input::Action::FIRE_LEFT);
input_->bindGameControllerButton(index_controller_, Input::Action::SM_BACK, Input::Action::FIRE_CENTER);
}
// Comprueba los eventos
@@ -117,11 +117,11 @@ auto DefineButtons::checkButtonNotInUse(SDL_GamepadButton button) -> bool {
// Limpia la asignación de botones
void DefineButtons::clearButtons() {
buttons_.clear();
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] FIRE_LEFT"), InputAction::FIRE_LEFT, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] FIRE_UP"), InputAction::FIRE_CENTER, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] FIRE_RIGHT"), InputAction::FIRE_RIGHT, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] START"), InputAction::START, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] SERVICE_MENU"), InputAction::SERVICE, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] FIRE_LEFT"), Input::Action::FIRE_LEFT, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] FIRE_UP"), Input::Action::FIRE_CENTER, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] FIRE_RIGHT"), Input::Action::FIRE_RIGHT, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] START"), Input::Action::START, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(Lang::getText("[DEFINE_BUTTONS] SERVICE_MENU"), Input::Action::SERVICE, SDL_GAMEPAD_BUTTON_INVALID);
}
// Comprueba si ha finalizado