working on game controller input

This commit is contained in:
2021-08-24 19:56:25 +02:00
parent 7c0201f913
commit 39a59336e4
2 changed files with 8 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
#include "input.h"
#include <stdio.h>
#include <iostream>
// Constructor
Input::Input(int source)
@@ -185,16 +186,16 @@ bool Input::checkInput(Uint8 input, bool repeat)
// Comprueba si hay un mando conectado
bool Input::discoverGameController()
{
if (SDL_NumJoysticks() < 1)
/*if (SDL_NumJoysticks() < 1)
{
printf("Warning: No joysticks connected!\n");
mGameControllerFound = false;
std::cout << "Warning: No joysticks connected!\n";
}
else
else*/
{
// Carga el mando
mGameController = SDL_GameControllerOpen(0);
mGameControllerFound = true;
if (mGameController == NULL)
{
@@ -204,6 +205,9 @@ bool Input::discoverGameController()
else
{
printf("%i joysticks were found.\n", SDL_NumJoysticks());
std::cout << "joysticks were found!\n";
mGameControllerFound = true;
//printf("%i buttons\n", SDL_JoystickNumButtons(mGameController));
// Obtiene el dispositivo de control háptico