|
|
|
@ -6,12 +6,13 @@
|
|
|
|
|
namespace MWGui
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
FadeOp::FadeOp(ScreenFader * fader, float time, float targetAlpha)
|
|
|
|
|
FadeOp::FadeOp(ScreenFader * fader, float time, float targetAlpha, float delay)
|
|
|
|
|
: mFader(fader),
|
|
|
|
|
mRemainingTime(time),
|
|
|
|
|
mRemainingTime(time+delay),
|
|
|
|
|
mTargetTime(time),
|
|
|
|
|
mTargetAlpha(targetAlpha),
|
|
|
|
|
mStartAlpha(0.f),
|
|
|
|
|
mDelay(delay),
|
|
|
|
|
mRunning(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
@ -26,7 +27,7 @@ namespace MWGui
|
|
|
|
|
if (mRunning)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
mRemainingTime = mTargetTime;
|
|
|
|
|
mRemainingTime = mTargetTime + mDelay;
|
|
|
|
|
mStartAlpha = mFader->getCurrentAlpha();
|
|
|
|
|
mRunning = true;
|
|
|
|
|
}
|
|
|
|
@ -42,6 +43,12 @@ namespace MWGui
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mRemainingTime > mTargetTime)
|
|
|
|
|
{
|
|
|
|
|
mRemainingTime -= dt;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float currentAlpha = mFader->getCurrentAlpha();
|
|
|
|
|
if (mStartAlpha > mTargetAlpha)
|
|
|
|
|
{
|
|
|
|
@ -103,19 +110,19 @@ namespace MWGui
|
|
|
|
|
mMainWidget->setAlpha(1.f-((1.f-mCurrentAlpha) * mFactor));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenFader::fadeIn(float time)
|
|
|
|
|
void ScreenFader::fadeIn(float time, float delay)
|
|
|
|
|
{
|
|
|
|
|
queue(time, 1.f);
|
|
|
|
|
queue(time, 1.f, delay);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenFader::fadeOut(const float time)
|
|
|
|
|
void ScreenFader::fadeOut(const float time, float delay)
|
|
|
|
|
{
|
|
|
|
|
queue(time, 0.f);
|
|
|
|
|
queue(time, 0.f, delay);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenFader::fadeTo(const int percent, const float time)
|
|
|
|
|
void ScreenFader::fadeTo(const int percent, const float time, float delay)
|
|
|
|
|
{
|
|
|
|
|
queue(time, percent/100.f);
|
|
|
|
|
queue(time, percent/100.f, delay);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenFader::clear()
|
|
|
|
@ -135,7 +142,7 @@ namespace MWGui
|
|
|
|
|
mRepeat = repeat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenFader::queue(float time, float targetAlpha)
|
|
|
|
|
void ScreenFader::queue(float time, float targetAlpha, float delay)
|
|
|
|
|
{
|
|
|
|
|
if (time < 0.f)
|
|
|
|
|
return;
|
|
|
|
@ -147,7 +154,7 @@ namespace MWGui
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mQueue.push_back(FadeOp::Ptr(new FadeOp(this, time, targetAlpha)));
|
|
|
|
|
mQueue.push_back(FadeOp::Ptr(new FadeOp(this, time, targetAlpha, delay)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ScreenFader::isEmpty()
|
|
|
|
|