mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Adjust screen-sized widgets automatically using Stretch align
This commit is contained in:
parent
715d357f24
commit
6cb9382bf0
7 changed files with 9 additions and 31 deletions
|
@ -59,7 +59,7 @@ namespace MWGui
|
|||
};
|
||||
|
||||
|
||||
HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||
HUD::HUD(int fpsLevel, DragAndDrop* dragAndDrop)
|
||||
: Layout("openmw_hud.layout")
|
||||
, mHealth(NULL)
|
||||
, mMagicka(NULL)
|
||||
|
@ -97,7 +97,7 @@ namespace MWGui
|
|||
, mWeaponSpellTimer(0.f)
|
||||
, mDrowningFlashTheta(0.f)
|
||||
{
|
||||
setCoord(0,0, width, height);
|
||||
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
|
||||
|
||||
// Energy bars
|
||||
getWidget(mHealthFrame, "HealthFrame");
|
||||
|
@ -405,11 +405,6 @@ namespace MWGui
|
|||
mDrowningFlashTheta += dt * Ogre::Math::TWO_PI;
|
||||
}
|
||||
|
||||
void HUD::onResChange(int width, int height)
|
||||
{
|
||||
setCoord(0, 0, width, height);
|
||||
}
|
||||
|
||||
void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
||||
{
|
||||
const ESM::Spell* spell =
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace MWGui
|
|||
class HUD : public OEngine::GUI::Layout, public LocalMapBase
|
||||
{
|
||||
public:
|
||||
HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop);
|
||||
HUD(int fpsLevel, DragAndDrop* dragAndDrop);
|
||||
virtual ~HUD();
|
||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
||||
void setFPS(float fps);
|
||||
|
@ -47,7 +47,6 @@ namespace MWGui
|
|||
void setCrosshairVisible(bool visible);
|
||||
|
||||
void onFrame(float dt);
|
||||
void onResChange(int width, int height);
|
||||
|
||||
void setCellName(const std::string& cellName);
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace MWGui
|
|||
, mProgress(0)
|
||||
, mVSyncWasEnabled(false)
|
||||
{
|
||||
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
|
||||
|
||||
getWidget(mLoadingText, "LoadingText");
|
||||
getWidget(mProgressBar, "ProgressBar");
|
||||
|
||||
|
@ -56,13 +58,6 @@ namespace MWGui
|
|||
mBackgroundImage->setVisible(visible);
|
||||
}
|
||||
|
||||
void LoadingScreen::onResChange(int w, int h)
|
||||
{
|
||||
setCoord(0,0,w,h);
|
||||
|
||||
mBackgroundImage->setCoord(MyGUI::IntCoord(0,0,w,h));
|
||||
}
|
||||
|
||||
void LoadingScreen::loadingOn()
|
||||
{
|
||||
// Early-out if already on
|
||||
|
|
|
@ -35,8 +35,6 @@ namespace MWGui
|
|||
void setLoadingProgress (const std::string& stage, int depth, int current, int total);
|
||||
void loadingDone();
|
||||
|
||||
void onResChange(int w, int h);
|
||||
|
||||
void updateWindow(Ogre::RenderWindow* rw) { mWindow = rw; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -180,12 +180,7 @@ namespace MWGui
|
|||
|
||||
MyGUI::LanguageManager::getInstance().eventRequestTag = MyGUI::newDelegate(this, &WindowManager::onRetrieveTag);
|
||||
|
||||
// Get size info from the Gui object
|
||||
int w = MyGUI::RenderManager::getInstance().getViewSize().width;
|
||||
int h = MyGUI::RenderManager::getInstance().getViewSize().height;
|
||||
|
||||
mLoadingScreen = new LoadingScreen(mRendering->getScene (), mRendering->getWindow ());
|
||||
mLoadingScreen->onResChange (w,h);
|
||||
|
||||
//set up the hardware cursor manager
|
||||
mCursorManager = new SFO::SDLCursorManager();
|
||||
|
@ -195,7 +190,6 @@ namespace MWGui
|
|||
MyGUI::InputManager::getInstance().eventChangeKeyFocus += MyGUI::newDelegate(this, &WindowManager::onKeyFocusChanged);
|
||||
|
||||
onCursorChange(MyGUI::PointerManager::getInstance().getDefaultPointer());
|
||||
//SDL_ShowCursor(false);
|
||||
|
||||
mCursorManager->setEnabled(true);
|
||||
|
||||
|
@ -242,7 +236,7 @@ namespace MWGui
|
|||
trackWindow(mDialogueWindow, "dialogue");
|
||||
mContainerWindow = new ContainerWindow(mDragAndDrop);
|
||||
trackWindow(mContainerWindow, "container");
|
||||
mHud = new HUD(w,h, mShowFPSLevel, mDragAndDrop);
|
||||
mHud = new HUD(mShowFPSLevel, mDragAndDrop);
|
||||
mToolTips = new ToolTips();
|
||||
mScrollWindow = new ScrollWindow();
|
||||
mBookWindow = new BookWindow();
|
||||
|
@ -266,7 +260,7 @@ namespace MWGui
|
|||
trackWindow(mCompanionWindow, "companion");
|
||||
mScreenFader = new ScreenFader();
|
||||
|
||||
mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Default,"Overlay");
|
||||
mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Stretch,"Overlay");
|
||||
|
||||
mHud->setVisible(mHudEnabled);
|
||||
|
||||
|
@ -1020,7 +1014,6 @@ namespace MWGui
|
|||
{
|
||||
sizeVideo(x, y);
|
||||
mGuiManager->windowResized();
|
||||
mLoadingScreen->onResChange (x,y);
|
||||
if (!mHud)
|
||||
return; // UI not initialized yet
|
||||
|
||||
|
@ -1034,7 +1027,6 @@ namespace MWGui
|
|||
it->first->setSize(size);
|
||||
}
|
||||
|
||||
mHud->onResChange(x, y);
|
||||
mConsole->onResChange(x, y);
|
||||
mMenu->onResChange(x, y);
|
||||
mSettingsWindow->center();
|
||||
|
@ -1043,7 +1035,6 @@ namespace MWGui
|
|||
mBookWindow->center();
|
||||
mQuickKeysMenu->center();
|
||||
mSpellBuyingWindow->center();
|
||||
mInputBlocker->setSize(MyGUI::IntSize(x,y));
|
||||
}
|
||||
|
||||
void WindowManager::pushGuiMode(GuiMode mode)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="Widget" layer="HUD" position="0 0 300 200" name="_Main">
|
||||
<Widget type="Widget" layer="HUD" position="0 0 300 200" name="_Main" align="Stretch">
|
||||
<!-- Energy bars -->
|
||||
<Widget type="ProgressBar" skin="MW_EnergyBar_Yellow" position="13 131 65 12" align="Left Bottom" name="EnemyHealth">
|
||||
<Property key="Visible" value="false"/>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<MyGUI type="Layout">
|
||||
<!-- The entire screen -->
|
||||
<Widget type="Widget" layer="LoadingScreen" position="0 0 300 300" name="_Main">
|
||||
<Widget type="Widget" layer="LoadingScreen" position="0 0 300 300" name="_Main" align="Stretch">
|
||||
|
||||
<Widget type="Widget" skin="HUD_Box" position="0 245 300 48" align="Bottom HCenter">
|
||||
|
||||
|
|
Loading…
Reference in a new issue