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

Basic controller support for the journal

This commit is contained in:
Andrew Lanzone 2025-05-10 22:50:16 -07:00
parent 58c4e0ddf7
commit bb88becc2b

View file

@ -639,6 +639,67 @@ namespace
}
}
}
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override
{
if (arg.button == SDL_CONTROLLER_BUTTON_A)
{
// Fall through to mouse click
return false;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_B)
{
if (mOptionsMode)
notifyCancel(getWidget<MyGUI::Widget>(CancelBTN));
else if (mStates.size() > 1)
notifyJournal(getWidget<MyGUI::Widget>(JournalBTN));
else
notifyClose(getWidget<MyGUI::Widget>(CloseBTN));
return true;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_X)
{
if (mQuestMode)
{
if (!mOptionsMode)
notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN));
notifyTopics(getWidget<MyGUI::Widget>(TopicsBTN));
}
return true;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
{
if (!mQuestMode)
{
if (!mOptionsMode)
notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN));
notifyQuests(getWidget<MyGUI::Widget>(QuestsBTN));
}
return true;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
{
return true;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
{
return true;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER ||
arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
{
notifyPrevPage(getWidget<MyGUI::Widget>(PrevPageBTN));
return true;
}
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER ||
arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
{
notifyNextPage(getWidget<MyGUI::Widget>(NextPageBTN));
return true;
}
return false;
}
};
}