Issue #294: show/hide HUD elements based on allowed windows

This commit is contained in:
scrawl 2012-05-26 05:46:46 +02:00
parent 738e107b52
commit 3cba884f59
3 changed files with 9 additions and 5 deletions

View file

@ -222,6 +222,11 @@ void WindowManager::updateVisible()
else
mToolTips->enterGuiMode();
setMinimapVisibility((allowed & GW_Map) && !map->pinned());
setWeaponVisibility((allowed & GW_Inventory) && !mInventoryWindow->pinned());
setSpellVisibility((allowed & GW_Magic)); /// \todo add pin state when spells window is implemented
setHMSVisibility((allowed & GW_Stats) && !mStatsWindow->pinned());
// If in game mode, don't show anything.
if (gameMode)
return;
@ -560,12 +565,13 @@ bool WindowManager::getFullHelp() const
void WindowManager::setWeaponVisibility(bool visible)
{
hud->weapBox->setVisible(visible);
hud->setBottomLeftVisibility(hud->health->getVisible(), visible, hud->spellBox->getVisible());
}
void WindowManager::setSpellVisibility(bool visible)
{
hud->spellBox->setVisible(visible);
hud->setBottomLeftVisibility(hud->health->getVisible(), hud->weapBox->getVisible(), visible);
hud->setBottomRightVisibility(visible, hud->minimapBox->getVisible());
}
void WindowManager::setMouseVisible(bool visible)

View file

@ -263,9 +263,6 @@ namespace MWGui
the start of the game, when windows are enabled one by one
through script commands. You can manipulate this through using
allow() and disableAll().
The setting should also affect visibility of certain HUD
elements, but this is not done yet.
*/
GuiWindow allowed;

View file

@ -12,6 +12,7 @@ namespace MWGui
public:
WindowPinnableBase(const std::string& parLayout, WindowManager& parWindowManager);
void setVisible(bool b);
bool pinned() { return mPinned; }
private:
void onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName);