Al redefinir botons, ja no pots repetir botó. Util per als qui tenim la ma tremolosa i apretem dos voltes sense voler

This commit is contained in:
2024-11-01 14:32:27 +01:00
parent f786cb7776
commit cd68c5ffea
4 changed files with 54 additions and 30 deletions

View File

@@ -216,6 +216,12 @@ void Title::checkEvents()
break;
}
case SDLK_4:
{
showControllers();
break;
}
default:
break;
}
@@ -302,23 +308,21 @@ void Title::reLoadTextures()
}
// Reinicia el contador interno
void Title::resetCounter()
{
counter_ = 0;
}
void Title::resetCounter() { counter_ = 0; }
// Intercambia la asignación de mandos a los jugadores
void Title::swapControllers()
{
const auto num_controllers = Input::get()->getNumControllers();
if (num_controllers == 0)
{
if (Input::get()->getNumControllers() == 0)
return;
}
define_buttons_->swapControllers();
showControllers();
}
// Muestra información sobre los controles y los jugadores
void Title::showControllers()
{
// Crea cadenas de texto vacias para un numero máximo de mandos
constexpr int MAX_CONTROLLERS = 2;
std::string text[MAX_CONTROLLERS];
@@ -341,11 +345,10 @@ void Title::swapControllers()
const int index = playerControllerIndex[i];
if (options.controller[index].plugged)
{
text[i] = lang::getText(101) + std::to_string(i + 1) + ": " + options.controller[index].name;
text[i] = lang::getText(100) + std::to_string(i + 1) + ": " + options.controller[index].name;
}
}
Notifier::get()->showText(text[0], text[1]);
resetCounter();
}