mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-09 11:26:42 +00:00
Fix several minor issues with controller inventory menus
This commit is contained in:
parent
3eec24b2a6
commit
cf26020ed6
6 changed files with 39 additions and 6 deletions
|
|
@ -1384,20 +1384,42 @@ namespace MWGui
|
||||||
if (arg.button == SDL_CONTROLLER_BUTTON_B)
|
if (arg.button == SDL_CONTROLLER_BUTTON_B)
|
||||||
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
else if (arg.button == SDL_CONTROLLER_BUTTON_X)
|
else if (arg.button == SDL_CONTROLLER_BUTTON_X)
|
||||||
|
{
|
||||||
onWorldButtonClicked(mButton);
|
onWorldButtonClicked(mButton);
|
||||||
|
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
|
||||||
|
}
|
||||||
else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
|
else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
|
||||||
|
{
|
||||||
centerView();
|
centerView();
|
||||||
|
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
|
||||||
|
}
|
||||||
|
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
|
||||||
|
shiftMap(0, 100);
|
||||||
|
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
|
||||||
|
shiftMap(0, -100);
|
||||||
|
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
|
||||||
|
shiftMap(100, 0);
|
||||||
|
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
|
||||||
|
shiftMap(-100, 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MapWindow::onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg)
|
bool MapWindow::onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg)
|
||||||
{
|
{
|
||||||
int dx = arg.axis == SDL_CONTROLLER_AXIS_RIGHTX ? -10.0f * arg.value / 32767 : 0;
|
int dx = arg.axis == SDL_CONTROLLER_AXIS_RIGHTX ? -30.0f * arg.value / 32767 : 0;
|
||||||
int dy = arg.axis == SDL_CONTROLLER_AXIS_RIGHTY ? -10.0f * arg.value / 32767 : 0;
|
int dy = arg.axis == SDL_CONTROLLER_AXIS_RIGHTY ? -30.0f * arg.value / 32767 : 0;
|
||||||
|
shiftMap(dx, dy);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapWindow::shiftMap(int dx, int dy)
|
||||||
|
{
|
||||||
if (dx == 0 && dy == 0)
|
if (dx == 0 && dy == 0)
|
||||||
return true;
|
return;
|
||||||
else if (!Settings::map().mGlobal)
|
|
||||||
|
if (!Settings::map().mGlobal)
|
||||||
{
|
{
|
||||||
mNeedDoorMarkersUpdate = true;
|
mNeedDoorMarkersUpdate = true;
|
||||||
mLocalMap->setViewOffset(
|
mLocalMap->setViewOffset(
|
||||||
|
|
@ -1410,7 +1432,6 @@ namespace MWGui
|
||||||
MyGUI::IntPoint(
|
MyGUI::IntPoint(
|
||||||
mGlobalMap->getViewOffset().left + dx, mGlobalMap->getViewOffset().top + dy));
|
mGlobalMap->getViewOffset().left + dx, mGlobalMap->getViewOffset().top + dy));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::setActiveControllerWindow(bool active)
|
void MapWindow::setActiveControllerWindow(bool active)
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,7 @@ namespace MWGui
|
||||||
void setGlobalMapMarkerTooltip(MyGUI::Widget* widget, int x, int y);
|
void setGlobalMapMarkerTooltip(MyGUI::Widget* widget, int x, int y);
|
||||||
float getMarkerSize(size_t agregatedWeight) const;
|
float getMarkerSize(size_t agregatedWeight) const;
|
||||||
void resizeGlobalMap();
|
void resizeGlobalMap();
|
||||||
|
void shiftMap(int dx, int dy);
|
||||||
void worldPosToGlobalMapImageSpace(float x, float z, float& imageX, float& imageY) const;
|
void worldPosToGlobalMapImageSpace(float x, float z, float& imageX, float& imageY) const;
|
||||||
MyGUI::IntCoord createMarkerCoords(float x, float y, float agregatedWeight) const;
|
MyGUI::IntCoord createMarkerCoords(float x, float y, float agregatedWeight) const;
|
||||||
MyGUI::Widget* createMarker(const std::string& name, float x, float y, float agregatedWeight);
|
MyGUI::Widget* createMarker(const std::string& name, float x, float y, float agregatedWeight);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/inputmanager.hpp"
|
#include "../mwbase/inputmanager.hpp"
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
#include "tooltips.hpp"
|
#include "tooltips.hpp"
|
||||||
|
|
||||||
|
|
@ -337,7 +338,10 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
// Select the focused item, if any.
|
// Select the focused item, if any.
|
||||||
if (mControllerFocus >= 0 && mControllerFocus < mButtons.size())
|
if (mControllerFocus >= 0 && mControllerFocus < mButtons.size())
|
||||||
|
{
|
||||||
onSpellSelected(mButtons.at(mControllerFocus));
|
onSpellSelected(mButtons.at(mControllerFocus));
|
||||||
|
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
|
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,9 @@ namespace MWGui
|
||||||
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
||||||
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
|
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
mSpellView->update();
|
||||||
|
|
||||||
WindowBase::setActiveControllerWindow(active);
|
WindowBase::setActiveControllerWindow(active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ namespace MWGui
|
||||||
|
|
||||||
if (Settings::gui().mControllerMenus)
|
if (Settings::gui().mControllerMenus)
|
||||||
{
|
{
|
||||||
|
mControllerButtons.lStick = "#{sInfo}";
|
||||||
|
mControllerButtons.rStick = "#{sScrolldown}";
|
||||||
mControllerButtons.b = "#{sBack}";
|
mControllerButtons.b = "#{sBack}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -751,7 +753,8 @@ namespace MWGui
|
||||||
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
||||||
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
|
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
|
||||||
|
|
||||||
onWindowResize(window);
|
if (active)
|
||||||
|
onWindowResize(window);
|
||||||
|
|
||||||
WindowBase::setActiveControllerWindow(active);
|
WindowBase::setActiveControllerWindow(active);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -957,6 +957,7 @@ namespace MWGui
|
||||||
mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(i == activeIndex);
|
mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(i == activeIndex);
|
||||||
|
|
||||||
updateControllerButtonsOverlay();
|
updateControllerButtonsOverlay();
|
||||||
|
setCursorActive(false);
|
||||||
|
|
||||||
if (winCount > 1)
|
if (winCount > 1)
|
||||||
playSound(ESM::RefId::stringRefId("Menu Size"));
|
playSound(ESM::RefId::stringRefId("Menu Size"));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue