added gamecontrollerdb.txt

This commit is contained in:
2021-08-30 22:24:16 +02:00
parent 22ca349171
commit cda4d3a566
4 changed files with 12 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ Director::Director(std::string path)
}
// Crea los objetos
mInput = new Input();
mInput = new Input(mFileList[52]);
//mInput2 = new Input(mOptions->input[1]);
//mInput[0] = new Input(INPUT_USE_KEYBOARD);
//mInput[1] = new Input(INPUT_USE_GAMECONTROLLER);
@@ -269,6 +269,9 @@ void Director::setFileList()
mFileList[49] = mExecutablePath + "/" + "../media/lang/es_ES.txt";
mFileList[50] = mExecutablePath + "/" + "../media/lang/en_UK.txt";
mFileList[51] = mExecutablePath + "/" + "../media/lang/ba_BA.txt";
// DATA
mFileList[52] = mExecutablePath + "/" + "../media/data/gamecontrollerdb.txt";
}
// Comprueba los ficheros del vector de ficheros que coinciden con una ruta dada

View File

@@ -3,8 +3,11 @@
#include <iostream>
// Constructor
Input::Input()
Input::Input(std::string file)
{
// Fichero gamecontrollerdb.txt
mDBpath = file;
// Inicializa las variables
for (int i = 0; i < 17; i++)
{
@@ -167,6 +170,7 @@ bool Input::discoverGameController()
mGameController = mConnectedControllers[0];
SDL_GameControllerEventState(SDL_ENABLE);
SDL_GameControllerAddMappingsFromFile(mDBpath.c_str());
}
return found;

View File

@@ -53,13 +53,14 @@ private:
std::vector<SDL_GameController*> mConnectedControllers;
std::vector<std::string> mControllerNames;
int mNumGamepads;
std::string mDBpath; // Ruta al archivo gamecontrollerdb.txt
// Comprueba si hay un mando conectado
bool discoverGameController();
public:
// Constructor
Input();
Input(std::string file);
// Destructor
~Input();

View File

@@ -532,7 +532,7 @@ Uint16 Menu::findHeight()
for (int i = 0; i < mTotalItems; i++)
height += mItem[i].rect.h + mItem[i].hPaddingDown;
return height;
return height - mItem[mTotalItems - 1].hPaddingDown;
}
// Recoloca los elementos del menu en el eje Y