Añadida opción para intercambiar los jugadores de los dos primeros mandos

This commit is contained in:
2024-09-11 13:59:40 +02:00
parent ecf34558f4
commit 3d41da0fdf
5 changed files with 55 additions and 38 deletions

View File

@@ -69,7 +69,7 @@ void DefineButtons::render()
{
if (enabled)
{
text->writeCentered(x, y - 10, "JUGADOR " + std::to_string(indexController + 1));
text->writeCentered(x, y - 10, "JUGADOR " + std::to_string(options->controller[indexController].playerId));
text->writeCentered(x, y, controllerNames[indexController]);
text->writeCentered(x, y + 10, buttons[indexButton].label);
}
@@ -117,7 +117,9 @@ void DefineButtons::checkInput()
}
if (event.type == SDL_CONTROLLERBUTTONDOWN)
{
doControllerButtonDown(&event.cbutton);
}
}
}
}
@@ -171,4 +173,12 @@ void DefineButtons::saveBindingsToOptions()
{
options->controller[indexController].buttons[j] = input->getControllerBinding(indexController, options->controller[indexController].inputs[j]);
}
}
// Intercambia los jugadores asignados a los dos primeros mandos
void DefineButtons::swapControllers()
{
const int temp = options->controller[0].playerId;
options->controller[0].playerId = options->controller[1].playerId;
options->controller[1].playerId = temp;
}