migrant a SDL3

This commit is contained in:
2025-03-25 14:13:58 +01:00
parent 9cc41aaf53
commit f1b0303474
71 changed files with 303 additions and 360 deletions

View File

@@ -35,7 +35,7 @@ void DefineButtons::render()
}
// Comprueba el botón que se ha pulsado
void DefineButtons::doControllerButtonDown(const SDL_ControllerButtonEvent &event)
void DefineButtons::doControllerButtonDown(const SDL_GamepadButtonEvent &event)
{
// Solo pilla botones del mando que toca
if (input_->getJoyIndex(event.which) != static_cast<int>(index_controller_))
@@ -43,7 +43,7 @@ void DefineButtons::doControllerButtonDown(const SDL_ControllerButtonEvent &even
return;
}
const auto button = static_cast<SDL_GameControllerButton>(event.button);
const auto button = static_cast<SDL_GamepadButton>(event.button);
if (checkButtonNotInUse(button))
{
buttons_.at(index_button_).button = button;
@@ -63,9 +63,9 @@ void DefineButtons::bindButtons()
// Comprueba los eventos
void DefineButtons::checkEvents(const SDL_Event &event)
{
if (enabled_ && event.type == SDL_CONTROLLERBUTTONDOWN)
if (enabled_ && event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN)
{
doControllerButtonDown(event.cbutton);
doControllerButtonDown(event.gbutton);
}
}
@@ -119,7 +119,7 @@ void DefineButtons::saveBindingsToOptions()
}
// Comprueba que un botón no esté ya asignado
bool DefineButtons::checkButtonNotInUse(SDL_GameControllerButton button)
bool DefineButtons::checkButtonNotInUse(SDL_GamepadButton button)
{
for (const auto &b : buttons_)
{
@@ -135,9 +135,9 @@ bool DefineButtons::checkButtonNotInUse(SDL_GameControllerButton button)
void DefineButtons::clearButtons()
{
buttons_.clear();
buttons_.emplace_back(lang::getText(95), InputAction::FIRE_LEFT, SDL_CONTROLLER_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(96), InputAction::FIRE_CENTER, SDL_CONTROLLER_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(97), InputAction::FIRE_RIGHT, SDL_CONTROLLER_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(98), InputAction::START, SDL_CONTROLLER_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(99), InputAction::SERVICE, SDL_CONTROLLER_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(95), InputAction::FIRE_LEFT, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(96), InputAction::FIRE_CENTER, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(97), InputAction::FIRE_RIGHT, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(98), InputAction::START, SDL_GAMEPAD_BUTTON_INVALID);
buttons_.emplace_back(lang::getText(99), InputAction::SERVICE, SDL_GAMEPAD_BUTTON_INVALID);
}