mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-28 21:26:42 +00:00
Remove some hardcoded menu sizes for inventory mode
This commit is contained in:
parent
f8d9149e4f
commit
29f1c7c68f
12 changed files with 50 additions and 10 deletions
|
|
@ -387,6 +387,8 @@ namespace MWBase
|
|||
|
||||
/// Return the window that should receive controller events
|
||||
virtual MWGui::WindowBase* getActiveControllerWindow() = 0;
|
||||
/// Return the available height for menus accounting for visible controller overlays
|
||||
virtual int getControllerMenuHeight() = 0;
|
||||
/// Cycle to the next window to receive controller events
|
||||
virtual void cycleActiveControllerWindow(bool next) = 0;
|
||||
virtual void setActiveControllerWindow(MWGui::GuiMode mode, int activeIndex) = 0;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "controllerbuttonsoverlay.hpp"
|
||||
|
||||
#include <MyGUI_Window.h>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
|
@ -37,6 +39,12 @@ namespace MWGui
|
|||
getWidget(mHBox, "ButtonBox");
|
||||
}
|
||||
|
||||
int ControllerButtonsOverlay::getHeight()
|
||||
{
|
||||
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
||||
return window->getHeight();
|
||||
}
|
||||
|
||||
void ControllerButtonsOverlay::setButtons(ControllerButtonStr* buttons)
|
||||
{
|
||||
int buttonCount = 0;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ namespace MWGui
|
|||
public:
|
||||
ControllerButtonsOverlay();
|
||||
|
||||
int getHeight();
|
||||
void setButtons(ControllerButtonStr* buttons);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "inventorytabsoverlay.hpp"
|
||||
|
||||
#include <MyGUI_ImageBox.h>
|
||||
#include <MyGUI_Window.h>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
|
@ -39,6 +40,12 @@ namespace MWGui
|
|||
MWBase::Environment::get().getInputManager()->getControllerAxisIcon(SDL_CONTROLLER_AXIS_TRIGGERRIGHT));
|
||||
}
|
||||
|
||||
int InventoryTabsOverlay::getHeight()
|
||||
{
|
||||
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
||||
return window->getHeight();
|
||||
}
|
||||
|
||||
void InventoryTabsOverlay::onTabClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
if (!MWBase::Environment::get().getWindowManager()->getJournalAllowed())
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace MWGui
|
|||
public:
|
||||
InventoryTabsOverlay();
|
||||
|
||||
int getHeight();
|
||||
void setTab(int index);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "itemview.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "sortfilteritemmodel.hpp"
|
||||
#include "statswindow.hpp"
|
||||
#include "tooltips.hpp"
|
||||
#include "tradeitemmodel.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
|
|
@ -1109,13 +1110,14 @@ namespace MWGui
|
|||
if (!Settings::gui().mControllerMenus)
|
||||
return;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
|
||||
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
||||
if (winMgr->getMode() == MWGui::GM_Inventory)
|
||||
{
|
||||
// Fill the screen, or limit to a certain size on large screens. Size chosen to
|
||||
// match the size of the stats window.
|
||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
int width = std::min(viewSize.width, 1600);
|
||||
int height = std::min(viewSize.height - 48 - 48, 750);
|
||||
int height = std::min(winMgr->getControllerMenuHeight(), StatsWindow::getIdealHeight());
|
||||
int x = (viewSize.width - width) / 2;
|
||||
int y = (viewSize.height - height) / 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -1440,13 +1440,14 @@ namespace MWGui
|
|||
|
||||
void MapWindow::setActiveControllerWindow(bool active)
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
|
||||
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
||||
if (winMgr->getMode() == MWGui::GM_Inventory)
|
||||
{
|
||||
// Fill the screen, or limit to a certain size on large screens. Size chosen to
|
||||
// show the entire local map without scrolling.
|
||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
int width = std::min(viewSize.width, 1552);
|
||||
int height = std::min(viewSize.height - 48 - 48, 1572);
|
||||
int height = std::min(winMgr->getControllerMenuHeight(), 1572);
|
||||
int x = (viewSize.width - width) / 2;
|
||||
int y = (viewSize.height - height) / 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "confirmationdialog.hpp"
|
||||
#include "spellicons.hpp"
|
||||
#include "spellview.hpp"
|
||||
#include "statswindow.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
|
@ -313,13 +314,14 @@ namespace MWGui
|
|||
|
||||
void SpellWindow::setActiveControllerWindow(bool active)
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
|
||||
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
||||
if (winMgr->getMode() == MWGui::GM_Inventory)
|
||||
{
|
||||
// Fill the screen, or limit to a certain size on large screens. Size chosen to
|
||||
// match the size of the stats window.
|
||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
int width = std::min(viewSize.width, 600);
|
||||
int height = std::min(viewSize.height - 48 - 48, 750);
|
||||
int width = std::min(viewSize.width, StatsWindow::getIdealWidth());
|
||||
int height = std::min(winMgr->getControllerMenuHeight(), StatsWindow::getIdealHeight());
|
||||
int x = (viewSize.width - width) / 2;
|
||||
int y = (viewSize.height - height) / 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -745,13 +745,14 @@ namespace MWGui
|
|||
|
||||
void StatsWindow::setActiveControllerWindow(bool active)
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
|
||||
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
||||
if (winMgr->getMode() == MWGui::GM_Inventory)
|
||||
{
|
||||
// Fill the screen, or limit to a certain size on large screens. Size chosen to
|
||||
// show all stats.
|
||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
int width = std::min(viewSize.width, 600);
|
||||
int height = std::min(viewSize.height - 48 - 48, 750);
|
||||
int width = std::min(viewSize.width, getIdealWidth());
|
||||
int height = std::min(winMgr->getControllerMenuHeight(), getIdealHeight());
|
||||
int x = (viewSize.width - width) / 2;
|
||||
int y = (viewSize.height - height) / 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ namespace MWGui
|
|||
public:
|
||||
typedef std::map<ESM::RefId, int> FactionList;
|
||||
|
||||
/// It would be nice to measure these, but for now they're hardcoded.
|
||||
static int getIdealHeight() { return 750; }
|
||||
static int getIdealWidth() { return 600; }
|
||||
|
||||
StatsWindow(DragAndDrop* drag);
|
||||
|
||||
/// automatically updates all the data in the stats window, but only if it has changed.
|
||||
|
|
|
|||
|
|
@ -2621,6 +2621,16 @@ namespace MWGui
|
|||
return res;
|
||||
}
|
||||
|
||||
int WindowManager::getControllerMenuHeight()
|
||||
{
|
||||
int height = MyGUI::RenderManager::getInstance().getViewSize().height;
|
||||
if (mControllerButtonsOverlay != nullptr && mControllerButtonsOverlay->isVisible())
|
||||
height -= mControllerButtonsOverlay->getHeight();
|
||||
if (mInventoryTabsOverlay != nullptr && mInventoryTabsOverlay->isVisible())
|
||||
height -= mInventoryTabsOverlay->getHeight();
|
||||
return height;
|
||||
}
|
||||
|
||||
void WindowManager::setControllerTooltip(bool enabled)
|
||||
{
|
||||
if (!Settings::gui().mControllerMenus)
|
||||
|
|
|
|||
|
|
@ -394,6 +394,7 @@ namespace MWGui
|
|||
void asyncPrepareSaveMap() override;
|
||||
|
||||
WindowBase* getActiveControllerWindow() override;
|
||||
int getControllerMenuHeight() override;
|
||||
void cycleActiveControllerWindow(bool next) override;
|
||||
void setActiveControllerWindow(GuiMode mode, int activeIndex) override;
|
||||
bool getControllerTooltip() const override { return mControllerTooltip; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue