mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 10:23:56 +00:00
change collor of crosshair
This commit is contained in:
parent
72728b9c01
commit
66edae9b93
7 changed files with 47 additions and 17 deletions
|
@ -219,6 +219,7 @@ namespace MWBase
|
|||
virtual void unsetSelectedWeapon() = 0;
|
||||
|
||||
virtual void showCrosshair(bool show) = 0;
|
||||
virtual void setCrosshairOwned(bool owned) = 0;
|
||||
virtual bool getSubtitlesEnabled() = 0;
|
||||
virtual bool toggleGui() = 0;
|
||||
|
||||
|
|
|
@ -519,6 +519,20 @@ namespace MWGui
|
|||
mCrosshair->setVisible (visible);
|
||||
}
|
||||
|
||||
void HUD::setCrosshairOwned(bool owned)
|
||||
{
|
||||
MyGUI::Colour red = MyGUI::Colour(1.0, 0, 0);
|
||||
MyGUI::Colour white = MyGUI::Colour(1.0, 1.0, 1.0);
|
||||
if(owned)
|
||||
{
|
||||
mCrosshair->setColour(red);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCrosshair->setColour(white);
|
||||
}
|
||||
}
|
||||
|
||||
void HUD::setHmsVisible(bool visible)
|
||||
{
|
||||
mHealth->setVisible(visible);
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace MWGui
|
|||
void unsetSelectedWeapon();
|
||||
|
||||
void setCrosshairVisible(bool visible);
|
||||
void setCrosshairOwned(bool owned);
|
||||
|
||||
void onFrame(float dt);
|
||||
|
||||
|
|
|
@ -299,7 +299,10 @@ namespace MWGui
|
|||
tooltipSize.height);
|
||||
|
||||
mDynamicToolTipBox->setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
checkOwned();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,7 +347,17 @@ namespace MWGui
|
|||
info.icon = "";
|
||||
tooltipSize = createToolTip(info);
|
||||
|
||||
// start owned check
|
||||
}
|
||||
|
||||
return tooltipSize;
|
||||
}
|
||||
|
||||
void ToolTips::checkOwned()
|
||||
{
|
||||
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
||||
|
||||
if(!mFocusObject.isEmpty())
|
||||
{
|
||||
MWWorld::CellRef& cellref = mFocusObject.getCellRef();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr victim;
|
||||
|
@ -352,21 +365,12 @@ namespace MWGui
|
|||
MWMechanics::MechanicsManager* mm = new MWMechanics::MechanicsManager;
|
||||
bool allowed = mm->isAllowedToUse(ptr, cellref, victim); // 0 - owned, 1 - not owned
|
||||
|
||||
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
||||
if(allowed)
|
||||
{
|
||||
// if 'item' is not owned
|
||||
wm->showCrosshair(true);
|
||||
wm->setCrosshairOwned(!allowed);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if 'item' is owned
|
||||
wm->showCrosshair(false);
|
||||
wm->setCrosshairOwned(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return tooltipSize;
|
||||
}
|
||||
|
||||
MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||
|
|
|
@ -96,6 +96,9 @@ namespace MWGui
|
|||
MyGUI::IntSize getToolTipViaPtr (bool image=true);
|
||||
///< @return requested tooltip size
|
||||
|
||||
void checkOwned();
|
||||
/// Checks if object is owned and sets correct crosshair mode
|
||||
|
||||
MyGUI::IntSize createToolTip(const ToolTipInfo& info);
|
||||
///< @return requested tooltip size
|
||||
|
||||
|
|
|
@ -1424,6 +1424,12 @@ namespace MWGui
|
|||
mHud->setCrosshairVisible (show && mCrosshairEnabled);
|
||||
}
|
||||
|
||||
void WindowManager::setCrosshairOwned (bool owned)
|
||||
{
|
||||
if (mHud)
|
||||
mHud->setCrosshairOwned (owned);
|
||||
}
|
||||
|
||||
void WindowManager::activateQuickKey (int index)
|
||||
{
|
||||
mQuickKeysMenu->activateQuickKey(index);
|
||||
|
|
|
@ -233,6 +233,7 @@ namespace MWGui
|
|||
virtual void unsetSelectedWeapon();
|
||||
|
||||
virtual void showCrosshair(bool show);
|
||||
virtual void setCrosshairOwned(bool owned);
|
||||
virtual bool getSubtitlesEnabled();
|
||||
|
||||
/// Turn visibility of *all* GUI elements on or off (HUD and all windows, except the console)
|
||||
|
|
Loading…
Reference in a new issue