mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-16 01:46:40 +00:00
Minimal controller bindings for settings window
This commit is contained in:
parent
fc86878922
commit
2970913d55
2 changed files with 36 additions and 0 deletions
|
@ -1128,4 +1128,38 @@ namespace MWGui
|
||||||
mResolutionList->setScrollPosition(0);
|
mResolutionList->setScrollPosition(0);
|
||||||
mControlsBox->setViewOffset(MyGUI::IntPoint(0, 0));
|
mControlsBox->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SettingsWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
|
||||||
|
{
|
||||||
|
if (arg.button == SDL_CONTROLLER_BUTTON_B)
|
||||||
|
{
|
||||||
|
onOkButtonClicked(mOkButton);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
|
||||||
|
{
|
||||||
|
uint32_t index = mSettingsTab->getIndexSelected();
|
||||||
|
if (index <= 0)
|
||||||
|
index = mSettingsTab->getItemCount() - 1;
|
||||||
|
else
|
||||||
|
index--;
|
||||||
|
mSettingsTab->setIndexSelected(index);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
|
||||||
|
{
|
||||||
|
uint32_t index = mSettingsTab->getIndexSelected();
|
||||||
|
if (index >= mSettingsTab->getItemCount() - 1)
|
||||||
|
index = 0;
|
||||||
|
else
|
||||||
|
index++;
|
||||||
|
mSettingsTab->setIndexSelected(index);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace MWGui
|
||||||
|
|
||||||
void onResChange(int, int) override;
|
void onResChange(int, int) override;
|
||||||
|
|
||||||
|
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MyGUI::TabControl* mSettingsTab;
|
MyGUI::TabControl* mSettingsTab;
|
||||||
MyGUI::Button* mOkButton;
|
MyGUI::Button* mOkButton;
|
||||||
|
|
Loading…
Reference in a new issue