Magic_Game/core/Transition/BoxTransition.cpp

52 lines
913 B
C++
Raw Normal View History

2018-05-22 13:49:10 +08:00
#include "..\e2dtransition.h"
#include "..\e2dnode.h"
2018-07-28 20:06:27 +08:00
e2d::BoxTransition::BoxTransition(float duration)
2018-05-22 13:49:10 +08:00
: Transition(duration)
{
}
2018-08-02 00:27:45 +08:00
bool e2d::BoxTransition::init(Scene * prev, Scene * next)
2018-05-22 13:49:10 +08:00
{
2018-08-02 00:27:45 +08:00
if (Transition::init(prev, next))
{
_inLayerParam.opacity = 0;
return true;
}
return false;
2018-05-22 13:49:10 +08:00
}
2018-08-02 00:27:45 +08:00
void e2d::BoxTransition::update()
2018-05-22 13:49:10 +08:00
{
2018-08-02 00:27:45 +08:00
Transition::update();
2018-05-22 13:49:10 +08:00
if (_delta <= 0.5)
{
_outLayerParam.contentBounds = D2D1::RectF(
2018-07-28 20:06:27 +08:00
_windowSize.width * _delta,
_windowSize.height * _delta,
_windowSize.width * (1 - _delta),
_windowSize.height * (1 - _delta)
2018-05-22 13:49:10 +08:00
);
}
else
{
_outLayerParam.opacity = 0;
_inLayerParam.opacity = 1;
_inLayerParam.contentBounds = D2D1::RectF(
2018-07-28 20:06:27 +08:00
_windowSize.width * (1 - _delta),
_windowSize.height * (1 - _delta),
_windowSize.width * _delta,
_windowSize.height * _delta
2018-05-22 13:49:10 +08:00
);
if (_delta >= 1)
{
2018-08-02 00:27:45 +08:00
this->stop();
2018-05-22 13:49:10 +08:00
}
}
}
2018-08-02 00:27:45 +08:00
void e2d::BoxTransition::reset()
2018-05-22 13:49:10 +08:00
{
}