Abans de clavar-li ma a Input
This commit is contained in:
@@ -323,32 +323,28 @@ void Title::swapControllers()
|
||||
// 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];
|
||||
int playerControllerIndex[MAX_CONTROLLERS];
|
||||
for (int i = 0; i < MAX_CONTROLLERS; ++i)
|
||||
{
|
||||
text[i].clear();
|
||||
playerControllerIndex[i] = -1;
|
||||
}
|
||||
// Crea vectores de texto vacíos para un número máximo de mandos
|
||||
constexpr size_t NUM_CONTROLLERS = 2;
|
||||
std::vector<std::string> text(NUM_CONTROLLERS);
|
||||
std::vector<int> playerControllerIndex(NUM_CONTROLLERS, -1);
|
||||
|
||||
// Obtiene para cada jugador el índice del mando correspondiente
|
||||
for (int i = 0; i < MAX_CONTROLLERS; ++i)
|
||||
// Obtiene de cada jugador el índice del mando que tiene asignado
|
||||
for (size_t i = 0; i < NUM_CONTROLLERS; ++i)
|
||||
{
|
||||
playerControllerIndex[options.controller[i].player_id - 1] = i;
|
||||
// Ejemplo: el jugador 1 tiene el mando 2
|
||||
playerControllerIndex.at(options.controller.at(i).player_id - 1) = i;
|
||||
}
|
||||
|
||||
// Genera el texto correspondiente
|
||||
for (int i = 0; i < MAX_CONTROLLERS; ++i)
|
||||
for (size_t i = 0; i < NUM_CONTROLLERS; ++i)
|
||||
{
|
||||
const int index = playerControllerIndex[i];
|
||||
if (options.controller[index].plugged)
|
||||
const size_t index = playerControllerIndex.at(i);
|
||||
if (options.controller.at(index).plugged)
|
||||
{
|
||||
text[i] = lang::getText(100) + std::to_string(i + 1) + ": " + options.controller[index].name;
|
||||
text.at(i) = lang::getText(100) + std::to_string(i + 1) + ": " + options.controller.at(index).name;
|
||||
}
|
||||
}
|
||||
|
||||
Notifier::get()->showText(text[0], text[1]);
|
||||
Notifier::get()->showText(text.at(0), text.at(1));
|
||||
resetCounter();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user