mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 23:23:52 +00:00
fixed the hud icon positioning issues
This commit is contained in:
parent
48ba293e88
commit
8b7baa808e
2 changed files with 12 additions and 6 deletions
|
@ -48,11 +48,12 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
setCoord(0,0, width, height);
|
setCoord(0,0, width, height);
|
||||||
|
|
||||||
// Energy bars
|
// Energy bars
|
||||||
|
getWidget(mHealthFrame, "HealthFrame");
|
||||||
getWidget(health, "Health");
|
getWidget(health, "Health");
|
||||||
getWidget(magicka, "Magicka");
|
getWidget(magicka, "Magicka");
|
||||||
getWidget(stamina, "Stamina");
|
getWidget(stamina, "Stamina");
|
||||||
|
|
||||||
hmsBaseLeft = health->getLeft();
|
hmsBaseLeft = mHealthFrame->getLeft();
|
||||||
|
|
||||||
MyGUI::Widget *healthFrame, *magickaFrame, *fatigueFrame;
|
MyGUI::Widget *healthFrame, *magickaFrame, *fatigueFrame;
|
||||||
getWidget(healthFrame, "HealthFrame");
|
getWidget(healthFrame, "HealthFrame");
|
||||||
|
@ -62,6 +63,8 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
magickaFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
|
magickaFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
|
||||||
fatigueFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
|
fatigueFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
|
||||||
|
|
||||||
|
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
|
|
||||||
// Item and spell images and status bars
|
// Item and spell images and status bars
|
||||||
getWidget(weapBox, "WeapBox");
|
getWidget(weapBox, "WeapBox");
|
||||||
getWidget(weapImage, "WeapImage");
|
getWidget(weapImage, "WeapImage");
|
||||||
|
@ -77,11 +80,11 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
|
|
||||||
getWidget(effectBox, "EffectBox");
|
getWidget(effectBox, "EffectBox");
|
||||||
getWidget(effect1, "Effect1");
|
getWidget(effect1, "Effect1");
|
||||||
effectBoxBaseRight = effectBox->getRight();
|
effectBoxBaseRight = viewSize.width - effectBox->getRight();
|
||||||
effectBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
effectBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||||
|
|
||||||
getWidget(minimapBox, "MiniMapBox");
|
getWidget(minimapBox, "MiniMapBox");
|
||||||
minimapBoxBaseRight = minimapBox->getRight();
|
minimapBoxBaseRight = viewSize.width - minimapBox->getRight();
|
||||||
minimapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
minimapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
||||||
getWidget(minimap, "MiniMap");
|
getWidget(minimap, "MiniMap");
|
||||||
getWidget(compass, "Compass");
|
getWidget(compass, "Compass");
|
||||||
|
@ -220,7 +223,7 @@ void HUD::setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellV
|
||||||
spellDx = weapDx = weapBoxBaseLeft - hmsBaseLeft;
|
spellDx = weapDx = weapBoxBaseLeft - hmsBaseLeft;
|
||||||
|
|
||||||
if (!weapVisible)
|
if (!weapVisible)
|
||||||
spellDx -= spellBoxBaseLeft - weapBoxBaseLeft;
|
spellDx += spellBoxBaseLeft - weapBoxBaseLeft;
|
||||||
|
|
||||||
health->setVisible(hmsVisible);
|
health->setVisible(hmsVisible);
|
||||||
stamina->setVisible(hmsVisible);
|
stamina->setVisible(hmsVisible);
|
||||||
|
@ -233,14 +236,16 @@ void HUD::setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellV
|
||||||
|
|
||||||
void HUD::setBottomRightVisibility(bool effectBoxVisible, bool minimapBoxVisible)
|
void HUD::setBottomRightVisibility(bool effectBoxVisible, bool minimapBoxVisible)
|
||||||
{
|
{
|
||||||
|
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
|
|
||||||
// effect box can have variable width -> variable left coordinate
|
// effect box can have variable width -> variable left coordinate
|
||||||
int effectsDx = 0;
|
int effectsDx = 0;
|
||||||
if (!minimapBoxVisible)
|
if (!minimapBoxVisible)
|
||||||
effectsDx = minimapBoxBaseRight - effectBoxBaseRight;
|
effectsDx = (viewSize.width - minimapBoxBaseRight) - (viewSize.width - effectBoxBaseRight);
|
||||||
|
|
||||||
mMapVisible = minimapBoxVisible;
|
mMapVisible = minimapBoxVisible;
|
||||||
minimapBox->setVisible(minimapBoxVisible);
|
minimapBox->setVisible(minimapBoxVisible);
|
||||||
effectBox->setPosition(effectBoxBaseRight - effectBox->getWidth() + effectsDx, effectBox->getTop());
|
effectBox->setPosition((viewSize.width - effectBoxBaseRight) - effectBox->getWidth() + effectsDx, effectBox->getTop());
|
||||||
effectBox->setVisible(effectBoxVisible);
|
effectBox->setVisible(effectBoxVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace MWGui
|
||||||
void setCellName(const std::string& cellName);
|
void setCellName(const std::string& cellName);
|
||||||
|
|
||||||
MyGUI::ProgressPtr health, magicka, stamina;
|
MyGUI::ProgressPtr health, magicka, stamina;
|
||||||
|
MyGUI::Widget* mHealthFrame;
|
||||||
MyGUI::Widget *weapBox, *spellBox;
|
MyGUI::Widget *weapBox, *spellBox;
|
||||||
MyGUI::ImageBox *weapImage, *spellImage;
|
MyGUI::ImageBox *weapImage, *spellImage;
|
||||||
MyGUI::ProgressPtr weapStatus, spellStatus;
|
MyGUI::ProgressPtr weapStatus, spellStatus;
|
||||||
|
|
Loading…
Reference in a new issue