input: Mejorado el texto informativo al inicializar el objeto

This commit is contained in:
2023-05-23 20:59:54 +02:00
parent cb8d8e19e1
commit 4424f2c2d3

View File

@@ -224,14 +224,25 @@ bool Input::discoverGameController()
if (verbose) if (verbose)
{ {
cout << "\nChecking for game controllers...\n"; if (nJoysticks > 0)
cout << nJoysticks << " joysticks found, " << numGamepads << " are gamepads\n"; {
string stNumJoysticks = nJoysticks == 1 ? "joystick" : "joysticks";
string stNumGamePads = numGamepads == 1 ? "is a gamepad" : "are gamepads";
cout << "\n** Checking game controllers" << endl;
cout << nJoysticks << " " << stNumJoysticks << " found (" << numGamepads << " " << stNumGamePads << ")\n";
}
else
{
cout << "\n>> No game controllers found\n";
}
} }
if (numGamepads > 0) if (numGamepads > 0)
{ {
found = true; found = true;
cout << "\n>> GAMEPAD LIST:" << endl;
for (int i = 0; i < numGamepads; i++) for (int i = 0; i < numGamepads; i++)
{ {
// Abre el mando y lo añade a la lista // Abre el mando y lo añade a la lista
@@ -245,7 +256,8 @@ bool Input::discoverGameController()
// name = name + separator + to_string(i); // name = name + separator + to_string(i);
if (verbose) if (verbose)
{ {
cout << " - " << name << endl; // cout << " - " << name << endl;
cout << "#" << i + 1 << ": " << name << endl;
} }
controllerNames.push_back(name); controllerNames.push_back(name);
} }
@@ -258,6 +270,8 @@ bool Input::discoverGameController()
} }
} }
cout << endl;
SDL_GameControllerEventState(SDL_ENABLE); SDL_GameControllerEventState(SDL_ENABLE);
} }