mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-06 06:16:39 +00:00
Controller menus: don't wrap focus when only two buttons
This commit is contained in:
parent
4c5db612f0
commit
c9ce93a22f
1 changed files with 22 additions and 18 deletions
|
|
@ -456,8 +456,11 @@ namespace MWGui
|
|||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
|
||||
{
|
||||
if (mButtons.size() > 1)
|
||||
{
|
||||
if (mButtons.size() <= 1)
|
||||
return true;
|
||||
if (mButtons.size() == 2 && mControllerFocus == 0)
|
||||
return true;
|
||||
|
||||
mButtons[mControllerFocus]->setStateSelected(false);
|
||||
if (mControllerFocus == 0)
|
||||
mControllerFocus = mButtons.size() - 1;
|
||||
|
|
@ -465,11 +468,13 @@ namespace MWGui
|
|||
mControllerFocus--;
|
||||
mButtons[mControllerFocus]->setStateSelected(true);
|
||||
}
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
|
||||
{
|
||||
if (mButtons.size() > 1)
|
||||
{
|
||||
if (mButtons.size() <= 1)
|
||||
return true;
|
||||
if (mButtons.size() == 2 && mControllerFocus == mButtons.size() - 1)
|
||||
return true;
|
||||
|
||||
mButtons[mControllerFocus]->setStateSelected(false);
|
||||
if (mControllerFocus == mButtons.size() - 1)
|
||||
mControllerFocus = 0;
|
||||
|
|
@ -477,7 +482,6 @@ namespace MWGui
|
|||
mControllerFocus++;
|
||||
mButtons[mControllerFocus]->setStateSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue