diff --git a/include/eepp/math/interpolation1d.hpp b/include/eepp/math/interpolation1d.hpp index 6383da740..e7978c9e4 100644 --- a/include/eepp/math/interpolation1d.hpp +++ b/include/eepp/math/interpolation1d.hpp @@ -47,7 +47,10 @@ class EE_API Interpolation1d { Interpolation1d& waitAndAdd( const Float& pos, const Time& waitTime, const Time& addTime ); /** Start the animation */ - Interpolation1d& start( OnPathEndCallback PathEndCallback = OnPathEndCallback(), OnStepCallback StepCallback = OnStepCallback() ); + Interpolation1d& start(); + + /** Start the animation */ + Interpolation1d& start( OnPathEndCallback PathEndCallback, OnStepCallback StepCallback = OnStepCallback() ); /** Stop the animation */ Interpolation1d& stop(); diff --git a/include/eepp/math/interpolation2d.hpp b/include/eepp/math/interpolation2d.hpp index f3fe7f9ac..ac9465a43 100755 --- a/include/eepp/math/interpolation2d.hpp +++ b/include/eepp/math/interpolation2d.hpp @@ -47,11 +47,14 @@ class EE_API Interpolation2d { /** Same as add( pos, waitTime ).add( pos, addTime ); */ Interpolation2d& waitAndAdd( const Vector2f& pos, const Time& waitTime, const Time& addTime ); + /** Start the animation ( will reset the current state, and start from the beginning ) */ + Interpolation2d& start(); + /** Start the animation ( will reset the current state, and start from the beginning ) * @param PathEndCallback An optional callback fired when the animation ends. * @param StepCallback An optional callback that is fired every time that a step is completed. */ - Interpolation2d& start( OnPathEndCallback PathEndCallback = OnPathEndCallback(), OnStepCallback StepCallback = OnStepCallback() ); + Interpolation2d& start( OnPathEndCallback PathEndCallback, OnStepCallback StepCallback = OnStepCallback() ); /** Stop the animation ( Enable = false ) */ Interpolation2d& stop(); diff --git a/src/eepp/math/interpolation1d.cpp b/src/eepp/math/interpolation1d.cpp index 31d8d6f5e..04987dee1 100644 --- a/src/eepp/math/interpolation1d.cpp +++ b/src/eepp/math/interpolation1d.cpp @@ -18,19 +18,16 @@ Interpolation1d::Interpolation1d() : mSpeed(1.3f), mActP(NULL), mNexP(NULL), - mOnPathEndCallback(NULL), - mOnStepCallback(NULL) + mOnPathEndCallback(), + mOnStepCallback() { } Interpolation1d::~Interpolation1d() { } -Interpolation1d& Interpolation1d::start( OnPathEndCallback PathEndCallback, OnStepCallback StepCallback) { +Interpolation1d& Interpolation1d::start() { mEnable = true; - mOnPathEndCallback = PathEndCallback; - mOnStepCallback = StepCallback; - if ( mPoints.size() ) { mActP = &mPoints[ 0 ]; @@ -45,6 +42,13 @@ Interpolation1d& Interpolation1d::start( OnPathEndCallback PathEndCallback, OnSt return *this; } +Interpolation1d& Interpolation1d::start( OnPathEndCallback PathEndCallback, OnStepCallback StepCallback) { + start(); + mOnPathEndCallback = PathEndCallback; + mOnStepCallback = StepCallback; + return *this; +} + Interpolation1d& Interpolation1d::stop() { mEnable = false; return *this; @@ -79,8 +83,8 @@ Interpolation1d & Interpolation1d::reset() { mUpdate = true; mEnded = false; mCurTime = Time::Zero; - mOnPathEndCallback = NULL; - mOnStepCallback = NULL; + mOnPathEndCallback = OnPathEndCallback(); + mOnStepCallback = OnStepCallback(); if ( mPoints.size() ) mCurPos = mPoints[0].p; diff --git a/src/eepp/math/interpolation2d.cpp b/src/eepp/math/interpolation2d.cpp index 53ee8e004..9cf3e9584 100755 --- a/src/eepp/math/interpolation2d.cpp +++ b/src/eepp/math/interpolation2d.cpp @@ -15,18 +15,16 @@ Interpolation2d::Interpolation2d() : mCurPoint(0), mCurTime(Time::Zero), mSpeed(1.3f), - mOnPathEndCallback(NULL), - mOnStepCallback(NULL) + mOnPathEndCallback(), + mOnStepCallback() { } Interpolation2d::~Interpolation2d() { } -Interpolation2d& Interpolation2d::start( OnPathEndCallback PathEndCallback, OnStepCallback StepCallback ) { +Interpolation2d& Interpolation2d::start() { mEnable = true; - mOnPathEndCallback = PathEndCallback; - mOnStepCallback = StepCallback; if ( mPoints.size() ) { mActP = &mPoints[ 0 ]; @@ -42,6 +40,13 @@ Interpolation2d& Interpolation2d::start( OnPathEndCallback PathEndCallback, OnSt return *this; } +Interpolation2d& Interpolation2d::start( OnPathEndCallback PathEndCallback, OnStepCallback StepCallback ) { + start(); + mOnPathEndCallback = PathEndCallback; + mOnStepCallback = StepCallback; + return *this; +} + Interpolation2d& Interpolation2d::stop() { mEnable = false; return *this; @@ -65,8 +70,8 @@ Interpolation2d& Interpolation2d::reset() { mCurTime = Time::Zero; mUpdate = true; mEnded = false; - mOnPathEndCallback = NULL; - mOnStepCallback = NULL; + mOnPathEndCallback = OnPathEndCallback(); + mOnStepCallback = OnStepCallback(); if ( mPoints.size() ) mCurPos = mPoints[0].p;