menu selector now resizes smooth

This commit is contained in:
2021-08-30 12:39:11 +02:00
parent 384cfa7156
commit eb7f534b3b
5 changed files with 145 additions and 67 deletions

View File

@@ -80,44 +80,45 @@ bool Input::checkInput(Uint8 input, bool repeat, int device)
}
}
}
if ((device == INPUT_USE_GAMECONTROLLER) || (device == INPUT_USE_ANY))
{
if (repeat)
if (gameControllerFound())
if ((device == INPUT_USE_GAMECONTROLLER) || (device == INPUT_USE_ANY))
{
if (SDL_GameControllerGetButton(mGameController, mGameControllerBindings[input].button) != 0)
successGameController = true;
else
successGameController = false;
}
else
{
if (!mGameControllerBindings[input].active)
if (repeat)
{
if (SDL_GameControllerGetButton(mGameController, mGameControllerBindings[input].button) != 0)
{
mGameControllerBindings[input].active = true;
successGameController = true;
}
else
{
successGameController = false;
}
}
else
{
if (SDL_GameControllerGetButton(mGameController, mGameControllerBindings[input].button) == 0)
if (!mGameControllerBindings[input].active)
{
mGameControllerBindings[input].active = false;
successGameController = false;
if (SDL_GameControllerGetButton(mGameController, mGameControllerBindings[input].button) != 0)
{
mGameControllerBindings[input].active = true;
successGameController = true;
}
else
{
successGameController = false;
}
}
else
{
successGameController = false;
if (SDL_GameControllerGetButton(mGameController, mGameControllerBindings[input].button) == 0)
{
mGameControllerBindings[input].active = false;
successGameController = false;
}
else
{
successGameController = false;
}
}
}
}
}
return (successKeyboard || successGameController);
}
@@ -159,4 +160,13 @@ bool Input::discoverGameController()
}
return found;
}
// Comprueba si hay algun mando conectado
bool Input::gameControllerFound()
{
if (mNumGamepads > 0)
return true;
else
return false;
}