From 4424f2c2d3e3cf1450dd992d0512e5f485f5bf5c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 23 May 2023 20:59:54 +0200 Subject: [PATCH] input: Mejorado el texto informativo al inicializar el objeto --- units/input.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/units/input.cpp b/units/input.cpp index c2158ac..3caae22 100644 --- a/units/input.cpp +++ b/units/input.cpp @@ -224,14 +224,25 @@ bool Input::discoverGameController() if (verbose) { - cout << "\nChecking for game controllers...\n"; - cout << nJoysticks << " joysticks found, " << numGamepads << " are gamepads\n"; + if (nJoysticks > 0) + { + 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) { found = true; + cout << "\n>> GAMEPAD LIST:" << endl; + for (int i = 0; i < numGamepads; i++) { // Abre el mando y lo aƱade a la lista @@ -245,7 +256,8 @@ bool Input::discoverGameController() // name = name + separator + to_string(i); if (verbose) { - cout << " - " << name << endl; + // cout << " - " << name << endl; + cout << "#" << i + 1 << ": " << name << endl; } controllerNames.push_back(name); } @@ -258,6 +270,8 @@ bool Input::discoverGameController() } } + cout << endl; + SDL_GameControllerEventState(SDL_ENABLE); }