forked from jaildesigner-jailgames/jaildoctors_dilemma
Nuevo: deshabilita input por un periodo de tiempo
This commit is contained in:
@@ -21,6 +21,15 @@ Input::Input(std::string file)
|
||||
verbose = true;
|
||||
}
|
||||
|
||||
// Actualiza el estado del objeto
|
||||
void Input::update()
|
||||
{
|
||||
if (disabledUntil == d_keyPressed && !checkAnyInput())
|
||||
{
|
||||
enable();
|
||||
}
|
||||
}
|
||||
|
||||
// Asigna inputs a teclas
|
||||
void Input::bindKey(Uint8 input, SDL_Scancode code)
|
||||
{
|
||||
@@ -36,6 +45,11 @@ void Input::bindGameControllerButton(Uint8 input, SDL_GameControllerButton butto
|
||||
// Comprueba si un input esta activo
|
||||
bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool successKeyboard = false;
|
||||
bool successGameController = false;
|
||||
|
||||
@@ -280,4 +294,18 @@ int Input::getNumControllers()
|
||||
void Input::setVerbose(bool value)
|
||||
{
|
||||
verbose = value;
|
||||
}
|
||||
|
||||
// Deshabilita las entradas durante un periodo de tiempo
|
||||
void Input::disableUntil(i_disable_e value)
|
||||
{
|
||||
disabledUntil = value;
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
// Hablita las entradas
|
||||
void Input::enable()
|
||||
{
|
||||
enabled = true;
|
||||
disabledUntil = d_notDisabled;
|
||||
}
|
||||
Reference in New Issue
Block a user