change collor of crosshair

sceneinput
Jiří Kuneš 10 years ago
parent 72728b9c01
commit 66edae9b93

@ -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;

@ -518,7 +518,21 @@ 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,29 +347,30 @@ 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;
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);
}
else
{
// if 'item' is owned
wm->showCrosshair(false);
}
}
return tooltipSize;
wm->setCrosshairOwned(!allowed);
}
else
{
wm->setCrosshairOwned(false);
}
}
MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)

@ -95,6 +95,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

@ -1423,6 +1423,12 @@ namespace MWGui
if (mHud)
mHud->setCrosshairVisible (show && mCrosshairEnabled);
}
void WindowManager::setCrosshairOwned (bool owned)
{
if (mHud)
mHud->setCrosshairOwned (owned);
}
void WindowManager::activateQuickKey (int 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…
Cancel
Save