Nuevo: deshabilita input por un periodo de tiempo

This commit is contained in:
2022-11-02 18:04:32 +01:00
parent 5302e16064
commit bb992b7d90
7 changed files with 59 additions and 4 deletions

View File

@@ -32,7 +32,13 @@
#define INPUT_USE_GAMECONTROLLER 1
#define INPUT_USE_ANY 2
// Clase Input
enum i_disable_e
{
d_notDisabled,
d_forever,
d_keyPressed
};
class Input
{
private:
@@ -58,11 +64,16 @@ private:
int numGamepads; // Numero de mandos conectados
std::string dbPath; // Ruta al archivo gamecontrollerdb.txt
bool verbose; // Indica si ha de mostrar mensajes
i_disable_e disabledUntil; // Tiempo que esta deshabilitado
bool enabled; // Indica si está habilitado
public:
// Constructor
Input(std::string file);
// Actualiza el estado del objeto
void update();
// Asigna inputs a teclas
void bindKey(Uint8 input, SDL_Scancode code);
@@ -73,7 +84,7 @@ public:
bool checkInput(Uint8 input, bool repeat, int device = INPUT_USE_ANY, int index = 0);
// Comprueba si hay almenos un input activo
bool checkAnyInput(int device, int index);
bool checkAnyInput(int device = INPUT_USE_ANY, int index = 0);
// Busca si hay un mando conectado
bool discoverGameController();
@@ -89,6 +100,12 @@ public:
// Establece si ha de mostrar mensajes
void setVerbose(bool value);
// Deshabilita las entradas durante un periodo de tiempo
void disableUntil(i_disable_e value);
// Hablita las entradas
void enable();
};
#endif