This commit is contained in:
2025-10-27 18:35:53 +01:00
parent b1dca32a5b
commit 3179a08dac
63 changed files with 686 additions and 693 deletions

View File

@@ -84,7 +84,7 @@ class Input {
std::string game_controller_db_path_; // Ruta al archivo gamecontrollerdb.txt
// Comprueba el eje del mando
bool checkAxisInput(InputAction input, int controller_index, bool repeat);
auto checkAxisInput(InputAction input, int controller_index, bool repeat) -> bool;
// Constructor
explicit Input(const std::string& game_controller_db_path);
@@ -100,7 +100,7 @@ class Input {
static void destroy();
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
static Input* get();
static auto get() -> Input*;
// Asigna inputs a teclas
void bindKey(InputAction input, SDL_Scancode code);
@@ -110,29 +110,29 @@ class Input {
void bindGameControllerButton(int controller_index, InputAction input_target, InputAction input_source);
// Comprueba si un input esta activo
bool checkInput(InputAction input, bool repeat = true, InputDeviceToUse device = InputDeviceToUse::ANY, int controller_index = 0);
auto checkInput(InputAction input, bool repeat = true, InputDeviceToUse device = InputDeviceToUse::ANY, int controller_index = 0) -> bool;
// Comprueba si hay almenos un input activo
bool checkAnyInput(InputDeviceToUse device = InputDeviceToUse::ANY, int controller_index = 0);
auto checkAnyInput(InputDeviceToUse device = InputDeviceToUse::ANY, int controller_index = 0) -> bool;
// Busca si hay mandos conectados
bool discoverGameControllers();
auto discoverGameControllers() -> bool;
// Comprueba si hay algun mando conectado
bool gameControllerFound() const;
[[nodiscard]] auto gameControllerFound() const -> bool;
// Obten el número de mandos conectados
int getNumControllers() const;
[[nodiscard]] auto getNumControllers() const -> int;
// Obten el nombre de un mando de juego
std::string getControllerName(int controller_index) const;
[[nodiscard]] auto getControllerName(int controller_index) const -> std::string;
// Obtiene el indice del controlador a partir de un event.id
int getJoyIndex(SDL_JoystickID id) const;
[[nodiscard]] auto getJoyIndex(SDL_JoystickID id) const -> int;
// Obtiene el SDL_GamepadButton asignado a un input
SDL_GamepadButton getControllerBinding(int controller_index, InputAction input) const;
[[nodiscard]] auto getControllerBinding(int controller_index, InputAction input) const -> SDL_GamepadButton;
// Obtiene el indice a partir del nombre del mando
int getIndexByName(const std::string& name) const;
[[nodiscard]] auto getIndexByName(const std::string& name) const -> int;
};