1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-12 17:13:07 +00:00

Controller mode uses LB/RB in journal and spell list to scroll faster

This commit is contained in:
Andrew Lanzone 2025-07-12 15:37:48 -07:00
parent 084e4a3155
commit 6629a186b1
2 changed files with 16 additions and 3 deletions

View file

@ -911,13 +911,21 @@ namespace
}
else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) // LB: Previous Page
{
if (!mOptionsMode)
// Scroll through the list of quests or topics
if (mOptionsMode && (mQuestMode || mTopicsMode))
setControllerFocusedQuest(std::max(int(mSelectedQuest) - 5, 0));
// Page through the journal
else if (!mOptionsMode)
notifyPrevPage(getWidget<MyGUI::Widget>(PrevPageBTN));
return true;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) // RB: Next Page
{
if (!mOptionsMode)
// Scroll through the list of quests or topics
if (mOptionsMode && (mQuestMode || mTopicsMode))
setControllerFocusedQuest(std::min(mSelectedQuest + 5, mButtons.size() - 1));
// Page through the journal
else if (!mOptionsMode)
notifyNextPage(getWidget<MyGUI::Widget>(NextPageBTN));
return true;
}

View file

@ -389,14 +389,19 @@ namespace MWGui
else if (button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
{
// Jump to first item in next group
int newFocus = mControllerFocus;
for (int groupIndex : mGroupIndices)
{
if (groupIndex > mControllerFocus)
{
mControllerFocus = groupIndex;
newFocus = groupIndex;
break;
}
}
// If on last group, jump to bottom of whole list
if (newFocus == mControllerFocus)
newFocus = mButtons.size() - 1;
mControllerFocus = newFocus;
}
mControllerFocus = wrap(mControllerFocus, mButtons.size());