InputAction → enum class Input::Action
This commit is contained in:
+34
-34
@@ -6,35 +6,6 @@
|
||||
#include <string> // for string, basic_string
|
||||
#include <vector> // for vector
|
||||
|
||||
enum InputAction : std::uint8_t {
|
||||
// Inputs obligatorios
|
||||
INVALID,
|
||||
UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
PAUSE,
|
||||
EXIT,
|
||||
ACCEPT,
|
||||
CANCEL,
|
||||
|
||||
// Inputs personalizados
|
||||
FIRE_LEFT,
|
||||
FIRE_CENTER,
|
||||
FIRE_RIGHT,
|
||||
WINDOW_FULLSCREEN,
|
||||
WINDOW_INC_ZOOM,
|
||||
WINDOW_DEC_ZOOM,
|
||||
|
||||
// GPU / shaders (hotkeys provisionales hasta que haya menú de opciones)
|
||||
NEXT_SHADER_PRESET,
|
||||
TOGGLE_SHADER,
|
||||
TOGGLE_SHADER_TYPE,
|
||||
|
||||
// Input obligatorio
|
||||
NUMBER_OF_INPUTS
|
||||
};
|
||||
|
||||
enum InputDisable : std::uint8_t {
|
||||
NOT_DISABLED,
|
||||
FOREVER,
|
||||
@@ -54,6 +25,35 @@ class Input {
|
||||
ANY
|
||||
};
|
||||
|
||||
enum class Action : std::uint8_t {
|
||||
// Inputs obligatorios
|
||||
INVALID,
|
||||
UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
PAUSE,
|
||||
EXIT,
|
||||
ACCEPT,
|
||||
CANCEL,
|
||||
|
||||
// Inputs personalizados
|
||||
FIRE_LEFT,
|
||||
FIRE_CENTER,
|
||||
FIRE_RIGHT,
|
||||
WINDOW_FULLSCREEN,
|
||||
WINDOW_INC_ZOOM,
|
||||
WINDOW_DEC_ZOOM,
|
||||
|
||||
// GPU / shaders (hotkeys provisionales hasta que haya menú de opciones)
|
||||
NEXT_SHADER_PRESET,
|
||||
TOGGLE_SHADER,
|
||||
TOGGLE_SHADER_TYPE,
|
||||
|
||||
// Centinela final (usar para sizing)
|
||||
NUMBER_OF_INPUTS
|
||||
};
|
||||
|
||||
// Singleton API
|
||||
static void init(const std::string &game_controller_db_path); // Crea la instancia
|
||||
static void destroy(); // Libera la instancia
|
||||
@@ -62,10 +62,10 @@ class Input {
|
||||
~Input(); // Destructor
|
||||
|
||||
void update(); // Actualiza el estado del objeto
|
||||
void bindKey(Uint8 input, SDL_Scancode code); // Asigna inputs a teclas
|
||||
void bindGameControllerButton(Uint8 input, SDL_GamepadButton button); // Asigna inputs a botones del mando
|
||||
void bindKey(Action input, SDL_Scancode code); // Asigna inputs a teclas
|
||||
void bindGameControllerButton(Action input, SDL_GamepadButton button); // Asigna inputs a botones del mando
|
||||
|
||||
auto checkInput(Uint8 input, Repeat repeat = Repeat::ON, Device device = Device::ANY, int index = 0) -> bool; // Comprueba si un input esta activo
|
||||
auto checkInput(Action 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
|
||||
@@ -119,8 +119,8 @@ class Input {
|
||||
static auto buildControllerName(SDL_Gamepad *pad, int pad_index) -> std::string;
|
||||
|
||||
// Helpers de checkInput
|
||||
auto checkKeyboardInput(Uint8 input, Repeat repeat) -> bool;
|
||||
auto checkGameControllerInput(Uint8 input, Repeat repeat, int index) -> bool;
|
||||
auto checkKeyboardInput(Action input, Repeat repeat) -> bool;
|
||||
auto checkGameControllerInput(Action input, Repeat repeat, int index) -> bool;
|
||||
|
||||
// Helpers de discoverGameController
|
||||
void resetGameControllerState();
|
||||
|
||||
Reference in New Issue
Block a user