Cambios en swapControllers

This commit is contained in:
2024-09-15 18:14:51 +02:00
parent 85a082d738
commit 75f9d3f5cb

View File

@@ -365,17 +365,27 @@ void Title::swapControllers()
}
defineButtons->swapControllers();
const std::string text0 = "Jugador " + std::to_string(options->controller[0].playerId) + " -> " + options->controller[0].name;
const std::string text1 = "Jugador " + std::to_string(options->controller[1].playerId) + " -> " + options->controller[1].name;
if (numControllers == 1)
// Crea cadenas de texto vacias para un numero máximo de mandos
const int MAX_CONTROLLERS = 2;
std::string text[MAX_CONTROLLERS];
for (int i = 0; i < MAX_CONTROLLERS; ++i)
text[i] = "";
// Obtiene para cada jugador el índice del mando correspondiente
int playerControllerIndex[numControllers];
for (int i = 0; i < numControllers; ++i)
{
screen->showNotification(text0);
playerControllerIndex[options->controller[i].playerId - 1] = i;
}
else
// Genera el texto correspondiente
for (int i = 0; i < numControllers; ++i)
{
screen->showNotification(text0, text1);
text[i] = "Jugador " + std::to_string(i + 1) + ": " + options->controller[playerControllerIndex[i]].name;
}
screen->showNotification(text[0], text[1]);
resetCounter();
}