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