Use MyGUI frame events for ScreenFader

pull/303/head
scrawl 7 years ago
parent e4f0f7157a
commit a4737d8417

@ -2,6 +2,7 @@
#include <MyGUI_RenderManager.h>
#include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h>
namespace MWGui
{
@ -80,6 +81,8 @@ namespace MWGui
, mFactor(1.f)
, mRepeat(false)
{
MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &ScreenFader::onFrameStart);
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
MyGUI::ImageBox* imageBox = mMainWidget->castType<MyGUI::ImageBox>(false);
@ -94,7 +97,12 @@ namespace MWGui
}
}
void ScreenFader::update(float dt)
ScreenFader::~ScreenFader()
{
MyGUI::Gui::getInstance().eventFrameStart -= MyGUI::newDelegate(this, &ScreenFader::onFrameStart);
}
void ScreenFader::onFrameStart(float dt)
{
if (!mQueue.empty())
{

@ -36,8 +36,9 @@ namespace MWGui
{
public:
ScreenFader(const std::string & texturePath, const std::string& layout = "openmw_screen_fader.layout", const MyGUI::FloatCoord& texCoordOverride = MyGUI::FloatCoord(0,0,1,1));
~ScreenFader();
void update(float dt);
void onFrameStart(float dt);
void fadeIn(const float time, float delay=0);
void fadeOut(const float time, float delay=0);

@ -894,12 +894,6 @@ namespace MWGui
mHud->onFrame(frameDuration);
if (mWerewolfFader)
mWerewolfFader->update(frameDuration);
mBlindnessFader->update(frameDuration);
mHitFader->update(frameDuration);
mScreenFader->update(frameDuration);
mDebugWindow->onFrame(frameDuration);
if (mCharGen)

Loading…
Cancel
Save