Ya se guardan las asignaciones de los botones en el fichero de configuración
This commit is contained in:
@@ -404,18 +404,38 @@ void Input::printBindings(int device, int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Muestra el nombre del mando
|
// Muestra el nombre del mando
|
||||||
std::cout << "\n" << controllerNames[index] << std::endl;
|
std::cout << "\n"
|
||||||
|
<< controllerNames[index] << std::endl;
|
||||||
|
|
||||||
// Muestra los botones asignados
|
// Muestra los botones asignados
|
||||||
for (auto bi : buttonInputs)
|
for (auto bi : buttonInputs)
|
||||||
{
|
{
|
||||||
std::cout << to_String(bi) << " : " << gameControllerBindings[index][bi].button << std::endl;
|
std::cout << to_string(bi) << " : " << gameControllerBindings[index][bi].button << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Obtiene el SDL_GameControllerButton asignado a un input
|
||||||
|
SDL_GameControllerButton Input::getControllerBinding(int index, inputs_e input)
|
||||||
|
{
|
||||||
|
return gameControllerBindings[index][input].button;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtiene el indice a partir del nombre del mando
|
||||||
|
int Input::getIndexByName(std::string name)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < numGamepads; ++i)
|
||||||
|
{
|
||||||
|
if (controllerNames[i] == name)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Convierte un inputs_e a std::string
|
// Convierte un inputs_e a std::string
|
||||||
std::string Input::to_String(inputs_e input)
|
std::string Input::to_string(inputs_e input)
|
||||||
{
|
{
|
||||||
if (input == input_fire_left)
|
if (input == input_fire_left)
|
||||||
{
|
{
|
||||||
@@ -438,4 +458,30 @@ std::string Input::to_String(inputs_e input)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convierte un std::string a inputs_e
|
||||||
|
inputs_e Input::to_inputs_e(std::string name)
|
||||||
|
{
|
||||||
|
if (name == "input_fire_left")
|
||||||
|
{
|
||||||
|
return input_fire_left;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "input_fire_center")
|
||||||
|
{
|
||||||
|
return input_fire_center;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "input_fire_right")
|
||||||
|
{
|
||||||
|
return input_fire_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "input_start")
|
||||||
|
{
|
||||||
|
return input_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
return input_null;
|
||||||
}
|
}
|
||||||
@@ -89,9 +89,6 @@ private:
|
|||||||
i_disable_e disabledUntil; // Tiempo que esta deshabilitado
|
i_disable_e disabledUntil; // Tiempo que esta deshabilitado
|
||||||
bool enabled; // Indica si está habilitado
|
bool enabled; // Indica si está habilitado
|
||||||
|
|
||||||
// Convierte un inputs_e a std::string
|
|
||||||
std::string to_String(inputs_e input);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Input(std::string file);
|
Input(std::string file);
|
||||||
@@ -140,6 +137,18 @@ public:
|
|||||||
|
|
||||||
// Muestra por consola los controles asignados
|
// Muestra por consola los controles asignados
|
||||||
void printBindings(int device = INPUT_USE_KEYBOARD, int index = 0);
|
void printBindings(int device = INPUT_USE_KEYBOARD, int index = 0);
|
||||||
|
|
||||||
|
// Obtiene el SDL_GameControllerButton asignado a un input
|
||||||
|
SDL_GameControllerButton getControllerBinding(int index, inputs_e input);
|
||||||
|
|
||||||
|
// Convierte un inputs_e a std::string
|
||||||
|
std::string to_string(inputs_e input);
|
||||||
|
|
||||||
|
// Convierte un std::string a inputs_e
|
||||||
|
inputs_e to_inputs_e(std::string name);
|
||||||
|
|
||||||
|
// Obtiene el indice a partir del nombre del mando
|
||||||
|
int getIndexByName(std::string name);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "jail_audio.h"
|
#include "jail_audio.h"
|
||||||
|
#include "input.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -86,14 +87,6 @@ struct demoKeys_t
|
|||||||
Uint8 fireRight;
|
Uint8 fireRight;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura para albergar métodos de control
|
|
||||||
struct input_t
|
|
||||||
{
|
|
||||||
int id; // Identificador en el vector de mandos
|
|
||||||
std::string name; // Nombre del dispositivo
|
|
||||||
Uint8 deviceType; // Tipo de dispositivo (teclado o mando)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Estructura con las opciones para el borde
|
// Estructura con las opciones para el borde
|
||||||
struct op_border_t
|
struct op_border_t
|
||||||
{
|
{
|
||||||
@@ -149,19 +142,28 @@ struct op_audio_t
|
|||||||
// Estructura para las opciones del juego
|
// Estructura para las opciones del juego
|
||||||
struct op_game_t
|
struct op_game_t
|
||||||
{
|
{
|
||||||
Uint8 difficulty; // Dificultad del juego
|
Uint8 difficulty; // Dificultad del juego
|
||||||
Uint8 playerSelected; // Jugador seleccionado para el modo 1P
|
Uint8 language; // Idioma usado en el juego
|
||||||
std::vector<input_t> input; // Modo de control (teclado o mando)
|
};
|
||||||
Uint8 language; // Idioma usado en el juego
|
|
||||||
|
// Estructura para los controles del juego
|
||||||
|
struct op_controller_t
|
||||||
|
{
|
||||||
|
int index; // Indice en el vector de mandos
|
||||||
|
Uint8 deviceType; // Indica si se utilizará teclado o mando o ambos
|
||||||
|
std::string name; // Nombre del dispositivo
|
||||||
|
std::vector<inputs_e> inputs; // Listado de inputs
|
||||||
|
std::vector<SDL_GameControllerButton> buttons; // Listado de botones asignados a cada input
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura con todas las opciones de configuración del programa
|
// Estructura con todas las opciones de configuración del programa
|
||||||
struct options_t
|
struct options_t
|
||||||
{
|
{
|
||||||
bool console; // Indica si ha de mostrar información por la consola de texto
|
bool console; // Indica si ha de mostrar información por la consola de texto
|
||||||
op_game_t game; // Opciones para el propio juego
|
op_game_t game; // Opciones para el propio juego
|
||||||
op_video_t video; // Opciones relativas a la clase screen
|
op_video_t video; // Opciones relativas a la clase screen
|
||||||
op_audio_t audio; // Opciones para el audio
|
op_audio_t audio; // Opciones para el audio
|
||||||
|
std::vector<op_controller_t> controller; // Opciones con las asignaciones del mando para cada jugador
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura para almacenar todos los parámetros del juego
|
// Estructura para almacenar todos los parámetros del juego
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ void DefineButtons::render()
|
|||||||
text->writeCentered(x, y - 20, "PLAYER " + std::to_string(indexController + 1));
|
text->writeCentered(x, y - 20, "PLAYER " + std::to_string(indexController + 1));
|
||||||
text->writeCentered(x, y - 10, controllerNames[indexController]);
|
text->writeCentered(x, y - 10, controllerNames[indexController]);
|
||||||
text->writeCentered(x, y, buttons[indexButton].label);
|
text->writeCentered(x, y, buttons[indexButton].label);
|
||||||
if (indexButton > 0)
|
|
||||||
text->writeCentered(x, y + 10, std::to_string(buttons[indexButton - 1].button));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +121,6 @@ void DefineButtons::enable(int index)
|
|||||||
enabled = true;
|
enabled = true;
|
||||||
indexController = index;
|
indexController = index;
|
||||||
indexButton = 0;
|
indexButton = 0;
|
||||||
|
|
||||||
input->printBindings(INPUT_USE_GAMECONTROLLER, indexController);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si está habilitado
|
// Comprueba si está habilitado
|
||||||
@@ -143,11 +139,24 @@ void DefineButtons::incIndexButton()
|
|||||||
{
|
{
|
||||||
// Asigna los botones definidos al input
|
// Asigna los botones definidos al input
|
||||||
bindButtons();
|
bindButtons();
|
||||||
input->printBindings(INPUT_USE_GAMECONTROLLER, indexController);
|
|
||||||
|
// Guarda los cambios en las opciones
|
||||||
|
saveBindingsToOptions();
|
||||||
|
|
||||||
// Reinicia variables
|
// Reinicia variables
|
||||||
indexButton = 0;
|
indexButton = 0;
|
||||||
indexController = 0;
|
indexController = 0;
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Guarda los cambios en las opciones
|
||||||
|
void DefineButtons::saveBindingsToOptions()
|
||||||
|
{
|
||||||
|
// Modifica las opciones para colocar los valores asignados
|
||||||
|
options->controller[indexController].name = input->getControllerName(indexController);
|
||||||
|
for (int j = 0; j < (int)options->controller[indexController].inputs.size(); ++j)
|
||||||
|
{
|
||||||
|
options->controller[indexController].buttons[j] = input->getControllerBinding(indexController, options->controller[indexController].inputs[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,9 @@ private:
|
|||||||
// Asigna los botones definidos al input
|
// Asigna los botones definidos al input
|
||||||
void bindButtons();
|
void bindButtons();
|
||||||
|
|
||||||
|
// Guarda los cambios en las opciones
|
||||||
|
void saveBindingsToOptions();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
DefineButtons(SDL_Renderer *renderer, Input *input, Text *text, param_t *param, options_t *options);
|
DefineButtons(SDL_Renderer *renderer, Input *input, Text *text, param_t *param, options_t *options);
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ void Director::initInput()
|
|||||||
#endif
|
#endif
|
||||||
// Busca si hay mandos conectados
|
// Busca si hay mandos conectados
|
||||||
input->discoverGameControllers();
|
input->discoverGameControllers();
|
||||||
const int numGamePads = input->getNumControllers();
|
|
||||||
|
|
||||||
// Teclado - Movimiento del jugador
|
// Teclado - Movimiento del jugador
|
||||||
input->bindKey(input_up, SDL_SCANCODE_UP);
|
input->bindKey(input_up, SDL_SCANCODE_UP);
|
||||||
@@ -120,8 +119,9 @@ void Director::initInput()
|
|||||||
input->bindKey(input_window_fullscreen, SDL_SCANCODE_F3);
|
input->bindKey(input_window_fullscreen, SDL_SCANCODE_F3);
|
||||||
input->bindKey(input_video_shaders, SDL_SCANCODE_F4);
|
input->bindKey(input_video_shaders, SDL_SCANCODE_F4);
|
||||||
|
|
||||||
|
const int numGamePads = input->getNumControllers();
|
||||||
for (int i = 0; i < numGamePads; ++i)
|
for (int i = 0; i < numGamePads; ++i)
|
||||||
{
|
{
|
||||||
// Mando - Movimiento del jugador
|
// Mando - Movimiento del jugador
|
||||||
input->bindGameControllerButton(i, input_up, SDL_CONTROLLER_BUTTON_DPAD_UP);
|
input->bindGameControllerButton(i, input_up, SDL_CONTROLLER_BUTTON_DPAD_UP);
|
||||||
input->bindGameControllerButton(i, input_down, SDL_CONTROLLER_BUTTON_DPAD_DOWN);
|
input->bindGameControllerButton(i, input_down, SDL_CONTROLLER_BUTTON_DPAD_DOWN);
|
||||||
@@ -139,19 +139,24 @@ void Director::initInput()
|
|||||||
input->bindGameControllerButton(i, input_exit, SDL_CONTROLLER_BUTTON_BACK);
|
input->bindGameControllerButton(i, input_exit, SDL_CONTROLLER_BUTTON_BACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pone valores por defecto a las opciones de control
|
// Comprueba si ha de modificar las asignaciones por las que hay en las opciones en caso de coincidir el nombre del mando
|
||||||
options->game.input.clear();
|
for (int i = 0; i < numGamePads; ++i)
|
||||||
|
for (int index = 0; index < (int)options->controller.size(); ++index)
|
||||||
|
if (input->getControllerName(i) == options->controller[index].name)
|
||||||
|
for (int j = 0; j < (int)options->controller[index].inputs.size(); ++j)
|
||||||
|
{
|
||||||
|
input->bindGameControllerButton(i, options->controller[index].inputs[j], options->controller[index].buttons[j]);
|
||||||
|
}
|
||||||
|
|
||||||
input_t i;
|
// Modifica las opciones para colocar los valores asignados
|
||||||
i.id = 0;
|
for (int index = 0; index < numGamePads; ++index)
|
||||||
i.name = "MANDO 1";
|
{
|
||||||
i.deviceType = INPUT_USE_ANY;
|
options->controller[index].name = input->getControllerName(index);
|
||||||
options->game.input.push_back(i);
|
for (int j = 0; j < (int)options->controller[index].inputs.size(); ++j)
|
||||||
|
{
|
||||||
i.id = 1;
|
options->controller[index].buttons[j] = input->getControllerBinding(index, options->controller[index].inputs[j]);
|
||||||
i.name = "MANDO 2";
|
}
|
||||||
i.deviceType = INPUT_USE_GAMECONTROLLER;
|
}
|
||||||
options->game.input.push_back(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inicializa JailAudio
|
// Inicializa JailAudio
|
||||||
@@ -411,19 +416,10 @@ void Director::initOptions()
|
|||||||
// Crea el puntero a la estructura de opciones
|
// Crea el puntero a la estructura de opciones
|
||||||
options = new options_t;
|
options = new options_t;
|
||||||
|
|
||||||
// Pone unos valores por defecto para las opciones de control
|
// Pone unos valores por defecto para las opciones
|
||||||
options->game.input.clear();
|
|
||||||
|
|
||||||
input_t inp;
|
// Opciones varias
|
||||||
inp.id = 0;
|
options->console = false;
|
||||||
inp.name = "GAME CONTROLLER";
|
|
||||||
inp.deviceType = INPUT_USE_GAMECONTROLLER;
|
|
||||||
options->game.input.push_back(inp);
|
|
||||||
|
|
||||||
inp.id = 1;
|
|
||||||
inp.name = "GAME CONTROLLER";
|
|
||||||
inp.deviceType = INPUT_USE_GAMECONTROLLER;
|
|
||||||
options->game.input.push_back(inp);
|
|
||||||
|
|
||||||
// Opciones de video
|
// Opciones de video
|
||||||
options->video.mode = 0;
|
options->video.mode = 0;
|
||||||
@@ -443,11 +439,38 @@ void Director::initOptions()
|
|||||||
options->audio.sound.enabled = true;
|
options->audio.sound.enabled = true;
|
||||||
options->audio.sound.volume = 64;
|
options->audio.sound.volume = 64;
|
||||||
|
|
||||||
// Opciones varios
|
// Opciones de juego
|
||||||
options->game.playerSelected = 0;
|
|
||||||
options->game.difficulty = DIFFICULTY_NORMAL;
|
options->game.difficulty = DIFFICULTY_NORMAL;
|
||||||
options->game.language = ba_BA;
|
options->game.language = ba_BA;
|
||||||
options->console = false;
|
|
||||||
|
// Opciones de control
|
||||||
|
options->controller.clear();
|
||||||
|
op_controller_t c;
|
||||||
|
|
||||||
|
const int numPlayers = 2;
|
||||||
|
for (int index = 0; index < numPlayers; ++index)
|
||||||
|
{
|
||||||
|
c.index = index;
|
||||||
|
c.deviceType = INPUT_USE_GAMECONTROLLER;
|
||||||
|
c.name = "NO NAME";
|
||||||
|
|
||||||
|
c.inputs.clear();
|
||||||
|
c.inputs.push_back(input_fire_left);
|
||||||
|
c.inputs.push_back(input_fire_center);
|
||||||
|
c.inputs.push_back(input_fire_right);
|
||||||
|
c.inputs.push_back(input_start);
|
||||||
|
c.inputs.push_back(input_exit);
|
||||||
|
|
||||||
|
c.buttons.clear();
|
||||||
|
c.buttons.push_back(SDL_CONTROLLER_BUTTON_X);
|
||||||
|
c.buttons.push_back(SDL_CONTROLLER_BUTTON_Y);
|
||||||
|
c.buttons.push_back(SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
|
||||||
|
c.buttons.push_back(SDL_CONTROLLER_BUTTON_START);
|
||||||
|
c.buttons.push_back(SDL_CONTROLLER_BUTTON_BACK);
|
||||||
|
|
||||||
|
options->controller.push_back(c);
|
||||||
|
}
|
||||||
|
options->controller[0].deviceType = INPUT_USE_ANY; // El primer jugador puede usar tanto el teclado como el primer mando
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los parametros del programa
|
// Comprueba los parametros del programa
|
||||||
@@ -653,12 +676,33 @@ bool Director::saveConfigFile()
|
|||||||
|
|
||||||
// Opciones del juego
|
// Opciones del juego
|
||||||
file << "\n\n## GAME\n";
|
file << "\n\n## GAME\n";
|
||||||
|
file << "## game.language [0: spanish, 1: valencian, 2: english]\n";
|
||||||
|
file << "## game.difficulty [0: easy, 1: normal, 2: hard]\n";
|
||||||
file << "\n";
|
file << "\n";
|
||||||
|
|
||||||
file << "game.language=" + std::to_string(options->game.language) + "\n";
|
file << "game.language=" + std::to_string(options->game.language) + "\n";
|
||||||
file << "game.difficulty=" + std::to_string(options->game.difficulty) + "\n";
|
file << "game.difficulty=" + std::to_string(options->game.difficulty) + "\n";
|
||||||
file << "game.input0=" + std::to_string(options->game.input[0].deviceType) + "\n";
|
|
||||||
file << "game.input1=" + std::to_string(options->game.input[1].deviceType) + "\n";
|
// Opciones de mandos
|
||||||
|
file << "\n\n## CONTROLLERS\n";
|
||||||
|
file << "\n";
|
||||||
|
|
||||||
|
const int numPlayers = 2;
|
||||||
|
for (int index = 0; index < numPlayers; ++index)
|
||||||
|
{
|
||||||
|
const std::string joyIndex = std::to_string(index + 1);
|
||||||
|
file << "controller" + joyIndex + ".name=" + options->controller[index].name + "\n";
|
||||||
|
file << "controller" + joyIndex + ".inputs.fire_left=" + std::to_string((int)options->controller[index].buttons[0]) + "\n";
|
||||||
|
file << "controller" + joyIndex + ".inputs.fire_center=" + std::to_string((int)options->controller[index].buttons[1]) + "\n";
|
||||||
|
file << "controller" + joyIndex + ".inputs.fire_right=" + std::to_string((int)options->controller[index].buttons[2]) + "\n";
|
||||||
|
file << "controller" + joyIndex + ".inputs.fire_start=" + std::to_string((int)options->controller[index].buttons[3]) + "\n";
|
||||||
|
file << "controller" + joyIndex + ".inputs.fire_exit=" + std::to_string((int)options->controller[index].buttons[4]) + "\n";
|
||||||
|
|
||||||
|
if (index < numPlayers - 1)
|
||||||
|
{
|
||||||
|
file << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
file.close();
|
file.close();
|
||||||
@@ -924,14 +968,65 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
|||||||
options->game.difficulty = std::stoi(value);
|
options->game.difficulty = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "game.input0")
|
// Opciones de mandos
|
||||||
|
else if (var == "controller1.name")
|
||||||
{
|
{
|
||||||
options->game.input[0].deviceType = std::stoi(value);
|
options->controller[0].name = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "game.input1")
|
else if (var == "controller1.inputs.fire_left")
|
||||||
{
|
{
|
||||||
options->game.input[1].deviceType = std::stoi(value);
|
options->controller[0].buttons[0] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller1.inputs.fire_center")
|
||||||
|
{
|
||||||
|
options->controller[0].buttons[1] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller1.inputs.fire_right")
|
||||||
|
{
|
||||||
|
options->controller[0].buttons[2] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller1.inputs.fire_start")
|
||||||
|
{
|
||||||
|
options->controller[0].buttons[3] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller1.inputs.fire_exit")
|
||||||
|
{
|
||||||
|
options->controller[0].buttons[4] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller2.name")
|
||||||
|
{
|
||||||
|
options->controller[1].name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller2.inputs.fire_left")
|
||||||
|
{
|
||||||
|
options->controller[1].buttons[0] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller2.inputs.fire_center")
|
||||||
|
{
|
||||||
|
options->controller[1].buttons[1] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller2.inputs.fire_right")
|
||||||
|
{
|
||||||
|
options->controller[1].buttons[2] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller2.inputs.fire_start")
|
||||||
|
{
|
||||||
|
options->controller[1].buttons[3] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "controller2.inputs.fire_exit")
|
||||||
|
{
|
||||||
|
options->controller[1].buttons[4] = (SDL_GameControllerButton)std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lineas vacias o que empiezan por comentario
|
// Lineas vacias o que empiezan por comentario
|
||||||
|
|||||||
@@ -2817,7 +2817,7 @@ void Game::checkInput()
|
|||||||
if (player->isAlive() && player->isEnabled())
|
if (player->isAlive() && player->isEnabled())
|
||||||
{
|
{
|
||||||
// Input a la izquierda
|
// Input a la izquierda
|
||||||
if (input->checkInput(input_left, ALLOW_REPEAT, options->game.input[i].deviceType, options->game.input[i].id))
|
if (input->checkInput(input_left, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||||
{
|
{
|
||||||
player->setInput(input_left);
|
player->setInput(input_left);
|
||||||
#ifdef RECORDING
|
#ifdef RECORDING
|
||||||
@@ -2827,7 +2827,7 @@ void Game::checkInput()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Input a la derecha
|
// Input a la derecha
|
||||||
if (input->checkInput(input_right, ALLOW_REPEAT, options->game.input[i].deviceType, options->game.input[i].id))
|
if (input->checkInput(input_right, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||||
{
|
{
|
||||||
player->setInput(input_right);
|
player->setInput(input_right);
|
||||||
#ifdef RECORDING
|
#ifdef RECORDING
|
||||||
@@ -2844,7 +2844,7 @@ void Game::checkInput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Comprueba el input de disparar al centro
|
// Comprueba el input de disparar al centro
|
||||||
if (input->checkInput(input_fire_center, ALLOW_REPEAT, options->game.input[i].deviceType, options->game.input[i].id))
|
if (input->checkInput(input_fire_center, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||||
{
|
{
|
||||||
if (player->canFire())
|
if (player->canFire())
|
||||||
{
|
{
|
||||||
@@ -2861,7 +2861,7 @@ void Game::checkInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba el input de disparar a la izquierda
|
// Comprueba el input de disparar a la izquierda
|
||||||
else if (input->checkInput(input_fire_left, ALLOW_REPEAT, options->game.input[i].deviceType, options->game.input[i].id))
|
else if (input->checkInput(input_fire_left, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||||
{
|
{
|
||||||
if (player->canFire())
|
if (player->canFire())
|
||||||
{
|
{
|
||||||
@@ -2878,7 +2878,7 @@ void Game::checkInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba el input de disparar a la derecha
|
// Comprueba el input de disparar a la derecha
|
||||||
else if (input->checkInput(input_fire_right, ALLOW_REPEAT, options->game.input[i].deviceType, options->game.input[i].id))
|
else if (input->checkInput(input_fire_right, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||||
{
|
{
|
||||||
if (player->canFire())
|
if (player->canFire())
|
||||||
{
|
{
|
||||||
@@ -2906,7 +2906,7 @@ void Game::checkInput()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (input->checkInput(input_start, ALLOW_REPEAT, options->game.input[i].deviceType, options->game.input[i].id))
|
if (input->checkInput(input_start, ALLOW_REPEAT, options->controller[i].deviceType, options->controller[i].index))
|
||||||
{
|
{
|
||||||
player->enable(true);
|
player->enable(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user