Added Scene Actions: Enable, Disable, Visible.

Removed all the start[ActionName] functions in UINode in favor of using runAction.

--HG--
branch : dev-stateful-drawable
This commit is contained in:
Martín Lucas Golini
2018-12-20 13:10:29 -03:00
parent bc50fa5c01
commit 6ef328ef31
18 changed files with 243 additions and 179 deletions

View File

@@ -1,17 +1,7 @@
#ifndef EEPP_SCENE_HPP
#define EEPP_SCENE_HPP
#include <eepp/scene/actions/actioninterpolation1d.hpp>
#include <eepp/scene/actions/actioninterpolation2d.hpp>
#include <eepp/scene/actions/move.hpp>
#include <eepp/scene/actions/rotate.hpp>
#include <eepp/scene/actions/scale.hpp>
#include <eepp/scene/actions/fade.hpp>
#include <eepp/scene/actions/marginmove.hpp>
#include <eepp/scene/actions/sequence.hpp>
#include <eepp/scene/actions/spawn.hpp>
#include <eepp/scene/actions/delay.hpp>
#include <eepp/scene/actions/close.hpp>
#include <eepp/scene/actions/actions.hpp>
#include <eepp/scene/action.hpp>
#include <eepp/scene/actionmanager.hpp>
#include <eepp/scene/event.hpp>

View File

@@ -0,0 +1,19 @@
#ifndef EE_SCENE_ACTIONS_HPP
#define EE_SCENE_ACTIONS_HPP
#include <eepp/scene/actions/actioninterpolation1d.hpp>
#include <eepp/scene/actions/actioninterpolation2d.hpp>
#include <eepp/scene/actions/move.hpp>
#include <eepp/scene/actions/rotate.hpp>
#include <eepp/scene/actions/scale.hpp>
#include <eepp/scene/actions/fade.hpp>
#include <eepp/scene/actions/marginmove.hpp>
#include <eepp/scene/actions/sequence.hpp>
#include <eepp/scene/actions/spawn.hpp>
#include <eepp/scene/actions/delay.hpp>
#include <eepp/scene/actions/close.hpp>
#include <eepp/scene/actions/disable.hpp>
#include <eepp/scene/actions/visible.hpp>
#endif

View File

@@ -7,7 +7,7 @@ namespace EE { namespace Scene { namespace Actions {
class EE_API Close : public Delay {
public:
static Close * New( const Time& time );
static Close * New( const Time& time = Seconds(0) );
void update( const Time& time ) override;
@@ -16,7 +16,7 @@ class EE_API Close : public Delay {
Action * reverse() const override;
protected:
Close( const Time& time );
explicit Close( const Time& time );
void onStart() override;

View File

@@ -0,0 +1,20 @@
#ifndef EE_SCENE_ACTION_DISABLE_HPP
#define EE_SCENE_ACTION_DISABLE_HPP
#include <eepp/scene/actions/enable.hpp>
namespace EE { namespace Scene { namespace Actions {
class EE_API Disable : public Enable {
public:
static Disable * New( const Time& time = Seconds(0) );
Action * clone() const override;
protected:
explicit Disable( const Time& time );
};
}}}
#endif

View File

@@ -0,0 +1,31 @@
#ifndef EE_SCENE_ACTION_ENABLE_HPP
#define EE_SCENE_ACTION_ENABLE_HPP
#include <eepp/scene/actions/delay.hpp>
namespace EE { namespace Scene { namespace Actions {
class EE_API Enable : public Delay {
public:
static Enable * New( const Time& time = Seconds(0) );
static Enable * New( bool enable, const Time& time = Seconds(0) );
void update( const Time& time ) override;
Action * clone() const override;
Action * reverse() const override;
protected:
bool mEnable;
explicit Enable( bool enable, const Time& time );
void onStart() override;
};
}}}
#endif

View File

@@ -0,0 +1,29 @@
#ifndef EE_SCENE_ACTION_VISIBLE_HPP
#define EE_SCENE_ACTION_VISIBLE_HPP
#include <eepp/scene/actions/delay.hpp>
namespace EE { namespace Scene { namespace Actions {
class EE_API Visible : public Delay {
public:
static Visible * New( bool visible, const Time& time = Seconds(0) );
void update( const Time& time ) override;
Action * clone() const override;
Action * reverse() const override;
protected:
bool mVisible;
explicit Visible( bool visible, const Time& time );
void onStart() override;
};
}}}
#endif

View File

@@ -166,37 +166,7 @@ class EE_API UINode : public Node {
const Uint32& getDragButton() const;
bool isAnimating();
Interpolation1d * startAlphaAnim( const Float& From, const Float& To, const Time& TotalTime, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
Interpolation2d * startScaleAnim( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
Interpolation2d * startScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
Interpolation2d * startTranslation( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
Interpolation1d * startRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
Interpolation1d * startAlphaAnim( const Float& To, const Time& TotalTime, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
Interpolation2d * startScaleAnim( const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
Interpolation2d * startScaleAnim( const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
Interpolation2d * startTranslation( const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
Interpolation1d * startRotation( const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
Interpolation1d * createFadeIn( const Time& Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
Interpolation1d * createFadeOut( const Time& Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
Interpolation1d * closeFadeOut( const Time& Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
Interpolation1d * disableFadeOut( const Time & Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
bool isFadingOut();
bool isActionManagerActive();
virtual void setFocus();
protected: