added gamecontrollersDB.txt
This commit is contained in:
@@ -143,7 +143,8 @@ bool Director::initSDL()
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
// Inicializa SDL
|
// Inicializa SDL
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
//if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
||||||
|
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||||
{
|
{
|
||||||
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
||||||
success = false;
|
success = false;
|
||||||
@@ -271,7 +272,7 @@ void Director::setFileList()
|
|||||||
mFileList[51] = mExecutablePath + "/" + "../media/lang/ba_BA.txt";
|
mFileList[51] = mExecutablePath + "/" + "../media/lang/ba_BA.txt";
|
||||||
|
|
||||||
// DATA
|
// DATA
|
||||||
mFileList[52] = mExecutablePath + "/" + "../media/data/gamecontrollerdb.txt";
|
mFileList[52] = mExecutablePath + "/" + "../data/gamecontrollerdb.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los ficheros del vector de ficheros que coinciden con una ruta dada
|
// Comprueba los ficheros del vector de ficheros que coinciden con una ruta dada
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ bool Input::discoverGameController()
|
|||||||
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) != 1)
|
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) != 1)
|
||||||
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
|
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||||
|
|
||||||
|
if (SDL_GameControllerAddMappingsFromFile(mDBpath.c_str())<0)
|
||||||
|
printf("Error, could not load %s file: %s\n", mDBpath.c_str(), SDL_GetError());
|
||||||
|
|
||||||
int nJoysticks = SDL_NumJoysticks();
|
int nJoysticks = SDL_NumJoysticks();
|
||||||
mNumGamepads = 0;
|
mNumGamepads = 0;
|
||||||
|
|
||||||
@@ -170,7 +173,6 @@ bool Input::discoverGameController()
|
|||||||
|
|
||||||
mGameController = mConnectedControllers[0];
|
mGameController = mConnectedControllers[0];
|
||||||
SDL_GameControllerEventState(SDL_ENABLE);
|
SDL_GameControllerEventState(SDL_ENABLE);
|
||||||
SDL_GameControllerAddMappingsFromFile(mDBpath.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
@@ -191,5 +193,5 @@ std::string Input::getControllerName(int index)
|
|||||||
if (mNumGamepads > 0)
|
if (mNumGamepads > 0)
|
||||||
return mControllerNames[index];
|
return mControllerNames[index];
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user