Update sneaking indicator position with other widgets

This commit is contained in:
Emanuel Guevel 2013-08-03 02:43:56 +02:00
parent add3bb9904
commit 9757694060
2 changed files with 21 additions and 4 deletions

View file

@ -84,6 +84,9 @@ namespace MWGui
mSpellBoxBaseLeft = mSpellBox->getLeft();
mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
getWidget(mSneakBox, "SneakBox");
mSneakBoxBaseLeft = mSneakBox->getLeft();
getWidget(mEffectBox, "EffectBox");
mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();
@ -503,6 +506,12 @@ namespace MWGui
updatePositions();
}
void HUD::setSneakVisible(bool visible)
{
mSneakBox->setVisible(visible);
updatePositions();
}
void HUD::setEffectVisible(bool visible)
{
mEffectBox->setVisible (visible);
@ -517,12 +526,18 @@ namespace MWGui
void HUD::updatePositions()
{
int weapDx = 0, spellDx = 0;
int weapDx = 0, spellDx = 0, sneakDx = 0;
if (!mHealth->getVisible())
spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
sneakDx = spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
if (!mWeapBox->getVisible())
{
spellDx += mSpellBoxBaseLeft - mWeapBoxBaseLeft;
sneakDx = spellDx;
}
if (!mSpellBox->getVisible())
sneakDx += mSneakBoxBaseLeft - mSpellBoxBaseLeft;
mWeaponVisible = mWeapBox->getVisible();
mSpellVisible = mSpellBox->getVisible();
@ -531,6 +546,7 @@ namespace MWGui
mWeapBox->setPosition(mWeapBoxBaseLeft - weapDx, mWeapBox->getTop());
mSpellBox->setPosition(mSpellBoxBaseLeft - spellDx, mSpellBox->getTop());
mSneakBox->setPosition(mSneakBoxBaseLeft - sneakDx, mSneakBox->getTop());
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();

View file

@ -21,6 +21,7 @@ namespace MWGui
void setHmsVisible(bool visible);
void setWeapVisible(bool visible);
void setSpellVisible(bool visible);
void setSneakVisible(bool visible);
void setEffectVisible(bool visible);
void setMinimapVisible(bool visible);
@ -51,7 +52,7 @@ namespace MWGui
private:
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth;
MyGUI::Widget* mHealthFrame;
MyGUI::Widget *mWeapBox, *mSpellBox;
MyGUI::Widget *mWeapBox, *mSpellBox, *mSneakBox;
MyGUI::ImageBox *mWeapImage, *mSpellImage;
MyGUI::ProgressBar *mWeapStatus, *mSpellStatus;
MyGUI::Widget *mEffectBox, *mMinimapBox;
@ -70,7 +71,7 @@ namespace MWGui
MyGUI::TextBox* mBatchCounter;
// bottom left elements
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft;
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft, mSneakBoxBaseLeft;
// bottom right elements
int mMinimapBoxBaseRight, mEffectBoxBaseRight;