From c9f8a220dc39357af4d5117158ae8910f278a81a Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 20 Jul 2017 20:59:36 +0200 Subject: [PATCH] Update the tooltip when the focusObject is set --- apps/openmw/mwgui/tooltips.cpp | 8 ++++++++ apps/openmw/mwgui/tooltips.hpp | 3 +++ apps/openmw/mwworld/worldimp.cpp | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index fad78d9a6..1e770a60b 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -40,6 +40,7 @@ namespace MWGui , mEnabled(true) , mFullHelp(false) , mShowOwned(0) + , mFrameDuration(0.f) { getWidget(mDynamicToolTipBox, "DynamicToolTipBox"); @@ -67,6 +68,11 @@ namespace MWGui } void ToolTips::onFrame(float frameDuration) + { + mFrameDuration = frameDuration; + } + + void ToolTips::update(float frameDuration) { while (mDynamicToolTipBox->getChildCount()) @@ -320,6 +326,8 @@ namespace MWGui void ToolTips::setFocusObject(const MWWorld::ConstPtr& focus) { mFocusObject = focus; + + update(mFrameDuration); } MyGUI::IntSize ToolTips::getToolTipViaPtr (int count, bool image) diff --git a/apps/openmw/mwgui/tooltips.hpp b/apps/openmw/mwgui/tooltips.hpp index 2db5fce34..bb2affc63 100644 --- a/apps/openmw/mwgui/tooltips.hpp +++ b/apps/openmw/mwgui/tooltips.hpp @@ -50,6 +50,7 @@ namespace MWGui ToolTips(); void onFrame(float frameDuration); + void update(float frameDuration); void setEnabled(bool enabled); @@ -126,6 +127,8 @@ namespace MWGui bool mFullHelp; int mShowOwned; + + float mFrameDuration; }; } #endif diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index c6d37b34c..08b0e7182 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1756,8 +1756,6 @@ namespace MWWorld // inform the GUI about focused object MWWorld::Ptr object = getFacedObject (); - MWBase::Environment::get().getWindowManager()->setFocusObject(object); - // retrieve object dimensions so we know where to place the floating label if (!object.isEmpty ()) { @@ -1766,6 +1764,8 @@ namespace MWWorld MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords( screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w()); } + + MWBase::Environment::get().getWindowManager()->setFocusObject(object); } MWWorld::Ptr World::getFacedObject(float maxDistance, bool ignorePlayer)