REPEAT_TRUE/FALSE → enum class Input::Repeat

This commit is contained in:
2026-05-16 19:51:24 +02:00
parent 479d9d941a
commit d72630523a
9 changed files with 42 additions and 41 deletions
+9 -8
View File
@@ -6,10 +6,6 @@
#include <string> // for string, basic_string
#include <vector> // for vector
// Valores de repetición
constexpr bool REPEAT_TRUE = true;
constexpr bool REPEAT_FALSE = false;
// Métodos de entrada
constexpr int INPUT_USE_KEYBOARD = 0;
constexpr int INPUT_USE_GAMECONTROLLER = 1;
@@ -52,6 +48,11 @@ enum InputDisable : std::uint8_t {
class Input {
public:
enum class Repeat : std::uint8_t {
OFF,
ON
};
// Singleton API
static void init(const std::string &game_controller_db_path); // Crea la instancia
static void destroy(); // Libera la instancia
@@ -63,8 +64,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, bool repeat = true, 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, 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 discoverGameController() -> bool; // Busca si hay un mando conectado
@@ -117,8 +118,8 @@ class Input {
static auto buildControllerName(SDL_Gamepad *pad, int pad_index) -> std::string;
// Helpers de checkInput
auto checkKeyboardInput(Uint8 input, bool repeat) -> bool;
auto checkGameControllerInput(Uint8 input, bool repeat, int index) -> bool;
auto checkKeyboardInput(Uint8 input, Repeat repeat) -> bool;
auto checkGameControllerInput(Uint8 input, Repeat repeat, int index) -> bool;
// Helpers de discoverGameController
void resetGameControllerState();