clang-tidy modernize
This commit is contained in:
@@ -72,7 +72,7 @@ class Input {
|
||||
// --- Métodos de singleton ---
|
||||
static void init(const std::string &game_controller_db_path); // Inicializa el singleton
|
||||
static void destroy(); // Libera el singleton
|
||||
static Input *get(); // Obtiene la instancia
|
||||
static auto get() -> Input *; // Obtiene la instancia
|
||||
|
||||
// --- Métodos de configuración de controles ---
|
||||
void bindKey(InputAction input, SDL_Scancode code); // Asigna inputs a teclas
|
||||
@@ -81,23 +81,23 @@ class Input {
|
||||
|
||||
// --- Métodos de consulta de entrada ---
|
||||
void update(); // Comprueba fisicamente los botones y teclas que se han pulsado
|
||||
bool checkInput(InputAction input, bool repeat = true, InputDevice device = InputDevice::ANY, int controller_index = 0); // Comprueba si un input está activo
|
||||
bool checkAnyInput(InputDevice device = InputDevice::ANY, int controller_index = 0); // Comprueba si hay al menos un input activo
|
||||
int checkAnyButton(bool repeat = INPUT_DO_NOT_ALLOW_REPEAT); // Comprueba si hay algún botón pulsado
|
||||
auto checkInput(InputAction input, bool repeat = true, InputDevice device = InputDevice::ANY, int controller_index = 0) -> bool; // Comprueba si un input está activo
|
||||
auto checkAnyInput(InputDevice device = InputDevice::ANY, int controller_index = 0) -> bool; // Comprueba si hay al menos un input activo
|
||||
auto checkAnyButton(bool repeat = INPUT_DO_NOT_ALLOW_REPEAT) -> int; // Comprueba si hay algún botón pulsado
|
||||
|
||||
// --- Métodos de gestión de mandos ---
|
||||
bool discoverGameControllers(); // Busca si hay mandos conectados
|
||||
bool gameControllerFound(); // Comprueba si hay algún mando conectado
|
||||
int getNumControllers() const; // Obtiene el número de mandos conectados
|
||||
std::string getControllerName(int controller_index) const; // Obtiene el nombre de un mando de juego
|
||||
int getJoyIndex(SDL_JoystickID id) const; // Obtiene el índice del controlador a partir de un event.id
|
||||
auto discoverGameControllers() -> bool; // Busca si hay mandos conectados
|
||||
auto gameControllerFound() -> bool; // Comprueba si hay algún mando conectado
|
||||
[[nodiscard]] auto getNumControllers() const -> int; // Obtiene el número de mandos conectados
|
||||
[[nodiscard]] auto getControllerName(int controller_index) const -> std::string; // Obtiene el nombre de un mando de juego
|
||||
[[nodiscard]] auto getJoyIndex(SDL_JoystickID id) const -> int; // Obtiene el índice del controlador a partir de un event.id
|
||||
|
||||
// --- Métodos de consulta y utilidades ---
|
||||
void printBindings(InputDevice device = InputDevice::KEYBOARD, int controller_index = 0) const; // Muestra por consola los controles asignados
|
||||
SDL_GamepadButton getControllerBinding(int controller_index, InputAction input) const; // Obtiene el SDL_GamepadButton asignado a un input
|
||||
std::string inputToString(InputAction input) const; // Convierte un InputAction a std::string
|
||||
InputAction stringToInput(const std::string &name) const; // Convierte un std::string a InputAction
|
||||
int getIndexByName(const std::string &name) const; // Obtiene el índice a partir del nombre del mando
|
||||
[[nodiscard]] auto getControllerBinding(int controller_index, InputAction input) const -> SDL_GamepadButton; // Obtiene el SDL_GamepadButton asignado a un input
|
||||
[[nodiscard]] auto inputToString(InputAction input) const -> std::string; // Convierte un InputAction a std::string
|
||||
[[nodiscard]] auto stringToInput(const std::string &name) const -> InputAction; // Convierte un std::string a InputAction
|
||||
[[nodiscard]] auto getIndexByName(const std::string &name) const -> int; // Obtiene el índice a partir del nombre del mando
|
||||
|
||||
// --- Métodos de reseteo de estado de entrada ---
|
||||
void resetInputStates(); // Pone todos los KeyBindings.active y ControllerBindings.active a false
|
||||
@@ -139,10 +139,10 @@ class Input {
|
||||
|
||||
// --- Métodos internos ---
|
||||
void initSDLGamePad(); // Inicializa SDL para la gestión de mandos
|
||||
bool checkAxisInput(InputAction input, int controller_index, bool repeat); // Comprueba el eje del mando
|
||||
auto checkAxisInput(InputAction input, int controller_index, bool repeat) -> bool; // Comprueba el eje del mando
|
||||
|
||||
// --- Constructor y destructor ---
|
||||
explicit Input(const std::string &game_controller_db_path); // Constructor privado
|
||||
explicit Input(std::string game_controller_db_path); // Constructor privado
|
||||
~Input() = default; // Destructor privado
|
||||
|
||||
// --- Singleton ---
|
||||
|
||||
Reference in New Issue
Block a user