1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-17 06:46:35 +00:00

Replace semi-janky rstick controller bindings with dpad

This commit is contained in:
Andrew Lanzone 2025-06-20 23:37:53 -07:00
parent 2905ed5fb1
commit 190680a3a9
10 changed files with 24 additions and 30 deletions

View file

@ -14,6 +14,9 @@ namespace MWGui
getWidget(mImageB, "BtnBImage");
getWidget(mTextB, "BtnBText");
getWidget(mImageDpad, "BtnDpadImage");
getWidget(mTextDpad, "BtnDpadText");
getWidget(mImageL1, "BtnL1Image");
getWidget(mTextL1, "BtnL1Text");
@ -58,6 +61,7 @@ namespace MWGui
int buttonCount = 0;
buttonCount += updateButton(mTextA, mImageA, buttons->a);
buttonCount += updateButton(mTextB, mImageB, buttons->b);
buttonCount += updateButton(mTextDpad, mImageDpad, buttons->dpad);
buttonCount += updateButton(mTextL1, mImageL1, buttons->l1);
buttonCount += updateButton(mTextL2, mImageL2, buttons->l2);
buttonCount += updateButton(mTextL3, mImageL3, buttons->l3);

View file

@ -24,6 +24,9 @@ namespace MWGui
MyGUI::ImageBox* mImageB;
MyGUI::TextBox* mTextB;
MyGUI::ImageBox* mImageDpad;
MyGUI::TextBox* mTextDpad;
MyGUI::ImageBox* mImageL1;
MyGUI::TextBox* mTextL1;

View file

@ -839,7 +839,7 @@ namespace MWGui
mControllerButtons.b = "#{sBack}";
mControllerButtons.x = global ? "#{sLocal}" : "#{sWorld}";
mControllerButtons.y = "#{sCenter}";
mControllerButtons.rStick = Settings::map().mAllowZooming ? "" : "#{sMove}";
mControllerButtons.dpad = Settings::map().mAllowZooming ? "" : "#{sMove}";
}
}
@ -1418,19 +1418,6 @@ namespace MWGui
return true;
}
bool MapWindow::onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg)
{
if (!Settings::map().mAllowZooming)
{
int dx = arg.axis == SDL_CONTROLLER_AXIS_RIGHTX ? -30.0f * arg.value / 32767 : 0;
int dy = arg.axis == SDL_CONTROLLER_AXIS_RIGHTY ? -30.0f * arg.value / 32767 : 0;
shiftMap(dx, dy);
return true;
}
return false;
}
void MapWindow::shiftMap(int dx, int dy)
{
if (dx == 0 && dy == 0)

View file

@ -272,7 +272,6 @@ namespace MWGui
protected:
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) override;
void setActiveControllerWindow(bool active) override;
private:

View file

@ -41,7 +41,7 @@ namespace MWGui
mControllerScrollWidget = mTextView;
mControllerButtons.b = "#{sClose}";
mControllerButtons.rStick = "#{sScrolldown}";
mControllerButtons.dpad = "#{sScrolldown}";
center();
}
@ -148,17 +148,4 @@ namespace MWGui
return true;
}
bool ScrollWindow::onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg)
{
if (arg.axis == SDL_CONTROLLER_AXIS_RIGHTY)
{
MWBase::Environment::get().getInputManager()->setGamepadGuiCursorEnabled(false);
int scroll = -30.0f * arg.value / 32767;
mTextView->setViewOffset(mTextView->getViewOffset() + MyGUI::IntPoint(0, scroll));
return true;
}
return false;
}
}

View file

@ -33,7 +33,6 @@ namespace MWGui
void setTakeButtonShow(bool show);
void onKeyButtonPressed(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character);
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) override;
private:
Gui::ImageButton* mCloseButton;

View file

@ -21,6 +21,7 @@ namespace MWGui
{
std::string a;
std::string b;
std::string dpad;
std::string l1;
std::string l2;
std::string l3;

View file

@ -12,6 +12,7 @@ set(BUILTIN_DATA_FILES
textures/omw_menu_icon_active.dds
textures/omw_steam_button_a.dds
textures/omw_steam_button_b.dds
textures/omw_steam_button_dpad.dds
textures/omw_steam_button_l1.dds
textures/omw_steam_button_l2.dds
textures/omw_steam_button_l3.dds

View file

@ -36,6 +36,19 @@
<Property key="ReadOnly" value="true"/>
</Widget>
<Widget type="ImageBox" skin="ImageBox" align="Stretch" position="0 0 24 24" name="BtnDpadImage">
<Property key="ImageTexture" value="textures\omw_steam_button_dpad.dds"/>
<Property key="Colour" value="#ccb589"/>
<Property key="Alpha" value="0.7"/>
</Widget>
<Widget type="TextBox" skin="HeaderText" align="Center" position="0 0 0 48" name="BtnDpadText">
<Property key="Caption" value=""/>
<Property key="TextAlign" value="Left"/>
<Property key="TextShadow" value="true"/>
<Property key="TextShadowColour" value="0 0 0"/>
<Property key="ReadOnly" value="true"/>
</Widget>
<Widget type="ImageBox" skin="ImageBox" align="Stretch" position="0 0 24 24" name="BtnAImage">
<Property key="ImageTexture" value="textures\omw_steam_button_a.dds"/>
<Property key="Colour" value="#ccb589"/>

Binary file not shown.