mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-27 00:56:39 +00:00
Make controller selection wrap in inventory or containers
This commit is contained in:
parent
df237b5f9b
commit
ea71a0bb4f
1 changed files with 21 additions and 11 deletions
|
|
@ -224,19 +224,29 @@ namespace MWGui
|
||||||
mControllerTooltip = !mControllerTooltip;
|
mControllerTooltip = !mControllerTooltip;
|
||||||
updateControllerFocus(-1, mControllerFocus);
|
updateControllerFocus(-1, mControllerFocus);
|
||||||
}
|
}
|
||||||
else if (button == SDL_CONTROLLER_BUTTON_DPAD_UP && mControllerFocus % mRows != 0)
|
else if (button == SDL_CONTROLLER_BUTTON_DPAD_UP)
|
||||||
mControllerFocus--;
|
{
|
||||||
else if (button == SDL_CONTROLLER_BUTTON_DPAD_DOWN && mControllerFocus % mRows != mRows - 1)
|
if (mControllerFocus % mRows == 0)
|
||||||
mControllerFocus++;
|
mControllerFocus = std::min(mControllerFocus + mRows - 1, mItemCount - 1);
|
||||||
|
else
|
||||||
|
mControllerFocus--;
|
||||||
|
}
|
||||||
|
else if (button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
|
||||||
|
{
|
||||||
|
if (mControllerFocus % mRows == mRows - 1 || mControllerFocus == mItemCount - 1)
|
||||||
|
mControllerFocus -= mControllerFocus % mRows;
|
||||||
|
else
|
||||||
|
mControllerFocus++;
|
||||||
|
}
|
||||||
else if (button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mControllerFocus >= mRows)
|
else if (button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mControllerFocus >= mRows)
|
||||||
mControllerFocus -= mRows;
|
mControllerFocus -= mRows;
|
||||||
else if (button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && mControllerFocus + mRows < mItemCount)
|
else if (button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
|
||||||
mControllerFocus += mRows;
|
{
|
||||||
|
if (mControllerFocus + mRows < mItemCount)
|
||||||
if (mControllerFocus < 0)
|
mControllerFocus += mRows;
|
||||||
mControllerFocus = 0;
|
else if (mControllerFocus / mRows != (mItemCount - 1) / mRows)
|
||||||
else if (mControllerFocus >= mItemCount - 1)
|
mControllerFocus = mItemCount - 1;
|
||||||
mControllerFocus = mItemCount - 1;
|
}
|
||||||
|
|
||||||
if (prevFocus != mControllerFocus)
|
if (prevFocus != mControllerFocus)
|
||||||
updateControllerFocus(prevFocus, mControllerFocus);
|
updateControllerFocus(prevFocus, mControllerFocus);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue