INPUT_USE_* → enum class Input::Device

This commit is contained in:
2026-05-16 19:54:52 +02:00
parent d72630523a
commit 40e1140734
8 changed files with 42 additions and 39 deletions
+8 -7
View File
@@ -6,11 +6,6 @@
#include <string> // for string, basic_string
#include <vector> // for vector
// Métodos de entrada
constexpr int INPUT_USE_KEYBOARD = 0;
constexpr int INPUT_USE_GAMECONTROLLER = 1;
constexpr int INPUT_USE_ANY = 2;
enum InputAction : std::uint8_t {
// Inputs obligatorios
INVALID,
@@ -53,6 +48,12 @@ class Input {
ON
};
enum class Device : std::uint8_t {
KEYBOARD,
GAMECONTROLLER,
ANY
};
// Singleton API
static void init(const std::string &game_controller_db_path); // Crea la instancia
static void destroy(); // Libera la instancia
@@ -64,8 +65,8 @@ class Input {
void bindKey(Uint8 input, SDL_Scancode code); // Asigna inputs a teclas
void bindGameControllerButton(Uint8 input, SDL_GamepadButton button); // Asigna inputs a botones del mando
auto checkInput(Uint8 input, Repeat repeat = Repeat::ON, int device = INPUT_USE_ANY, int index = 0) -> bool; // Comprueba si un input esta activo
auto checkAnyInput(int device = INPUT_USE_ANY, int index = 0) -> bool; // Comprueba si hay almenos un input activo
auto checkInput(Uint8 input, Repeat repeat = Repeat::ON, Device device = Device::ANY, int index = 0) -> bool; // Comprueba si un input esta activo
auto checkAnyInput(Device device = Device::ANY, int index = 0) -> bool; // Comprueba si hay almenos un input activo
auto discoverGameController() -> bool; // Busca si hay un mando conectado