mirror of https://github.com/axmolengine/axmol.git
Merge branch 'clone_reverse_fixes' of https://github.com/ricardoquesada/cocos2d-x into ricardoquesada-clone_reverse_fixes
This commit is contained in:
commit
c4386b9b15
|
@ -48,47 +48,11 @@ CCAction::~CCAction()
|
|||
CCLOGINFO("cocos2d: deallocing");
|
||||
}
|
||||
|
||||
CCAction* CCAction::create()
|
||||
{
|
||||
CCAction * pRet = new CCAction();
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
}
|
||||
|
||||
const char* CCAction::description()
|
||||
{
|
||||
return CCString::createWithFormat("<CCAction | Tag = %d>", _tag)->getCString();
|
||||
}
|
||||
|
||||
CCAction* CCAction::clone() const
|
||||
{
|
||||
// XXX shall not happen
|
||||
auto a = new CCAction(*this);
|
||||
a->_tag = _tag;
|
||||
a->_target = a->_originalTarget = NULL;
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCAction::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone *pNewZone = NULL;
|
||||
CCAction *pRet = NULL;
|
||||
if (pZone && pZone->_copyObject)
|
||||
{
|
||||
pRet = (CCAction*)(pZone->_copyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pRet = new CCAction();
|
||||
pNewZone = new CCZone(pRet);
|
||||
}
|
||||
//copy member data
|
||||
pRet->_tag = _tag;
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
||||
void CCAction::startWithTarget(CCNode *aTarget)
|
||||
{
|
||||
_originalTarget = _target = aTarget;
|
||||
|
@ -116,23 +80,6 @@ void CCAction::update(float time)
|
|||
CCLOG("[Action update]. override me");
|
||||
}
|
||||
|
||||
//
|
||||
// FiniteTimeAction
|
||||
//
|
||||
|
||||
CCFiniteTimeAction* CCFiniteTimeAction::clone() const
|
||||
{
|
||||
auto a = new CCFiniteTimeAction(*this);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCFiniteTimeAction *CCFiniteTimeAction::reverse()
|
||||
{
|
||||
CCLOG("cocos2d: FiniteTimeAction#reverse: Implement me");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Speed
|
||||
//
|
||||
|
@ -168,9 +115,10 @@ bool CCSpeed::initWithAction(CCActionInterval *pAction, float fSpeed)
|
|||
return true;
|
||||
}
|
||||
|
||||
CCSpeed *CCSpeed::clone(void) const
|
||||
CCSpeed *CCSpeed::clone() const
|
||||
{
|
||||
auto a = new CCSpeed(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCSpeed();
|
||||
a->initWithAction(_innerAction->clone(), _speed);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -219,9 +167,10 @@ bool CCSpeed::isDone()
|
|||
return _innerAction->isDone();
|
||||
}
|
||||
|
||||
CCActionInterval *CCSpeed::reverse()
|
||||
CCSpeed *CCSpeed::reverse() const
|
||||
{
|
||||
return (CCActionInterval*)(CCSpeed::create(_innerAction->reverse(), _speed));
|
||||
|
||||
return CCSpeed::create(_innerAction->reverse(), _speed);
|
||||
}
|
||||
|
||||
void CCSpeed::setInnerAction(CCActionInterval *pAction)
|
||||
|
@ -254,9 +203,10 @@ CCFollow* CCFollow::create(CCNode *pFollowedNode, const CCRect& rect/* = CCRectZ
|
|||
return NULL;
|
||||
}
|
||||
|
||||
CCFollow* CCFollow::clone(void) const
|
||||
CCFollow* CCFollow::clone() const
|
||||
{
|
||||
auto a = new CCFollow(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCFollow();
|
||||
a->initWithTarget(_followedNode, _worldRect);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
|
|
@ -46,7 +46,7 @@ enum {
|
|||
/**
|
||||
@brief Base class for CCAction objects.
|
||||
*/
|
||||
class CC_DLL CCAction : public CCObject
|
||||
class CC_DLL CCAction : public CCObject, public CCClonable
|
||||
{
|
||||
public:
|
||||
CCAction(void);
|
||||
|
@ -55,9 +55,8 @@ public:
|
|||
|
||||
const char* description();
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
/** returns a clone of action */
|
||||
virtual CCAction* clone() const;
|
||||
virtual CCAction* clone() const = 0;
|
||||
|
||||
//! return true if the action has finished
|
||||
virtual bool isDone(void);
|
||||
|
@ -100,8 +99,7 @@ public:
|
|||
inline void setTag(int nTag) { _tag = nTag; }
|
||||
|
||||
public:
|
||||
/** Create an action */
|
||||
static CCAction* create();
|
||||
|
||||
protected:
|
||||
CCNode *_originalTarget;
|
||||
/** The "target".
|
||||
|
@ -135,11 +133,11 @@ public:
|
|||
//! set duration in seconds of the action
|
||||
inline void setDuration(float duration) { _duration = duration; }
|
||||
|
||||
/** returns a reversed action */
|
||||
virtual CCFiniteTimeAction* reverse(void);
|
||||
/** returns a new reversed action */
|
||||
virtual CCFiniteTimeAction* reverse() const = 0;
|
||||
|
||||
/** returns a clone of action */
|
||||
virtual CCFiniteTimeAction* clone() const;
|
||||
virtual CCFiniteTimeAction* clone() const = 0;
|
||||
|
||||
protected:
|
||||
//! duration in seconds
|
||||
|
@ -170,13 +168,15 @@ public:
|
|||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
|
||||
/** returns a clone of action */
|
||||
/** returns a new clone of the action */
|
||||
virtual CCSpeed* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCSpeed* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode* pTarget);
|
||||
virtual void stop();
|
||||
virtual void step(float dt);
|
||||
virtual bool isDone(void);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
void setInnerAction(CCActionInterval *pAction);
|
||||
|
||||
|
|
|
@ -23,12 +23,14 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCActionCamera.h"
|
||||
#include "base_nodes/CCNode.h"
|
||||
#include "CCCamera.h"
|
||||
#include "CCStdC.h"
|
||||
#include "cocoa/CCZone.h"
|
||||
|
||||
|
||||
NS_CC_BEGIN
|
||||
//
|
||||
// CameraAction
|
||||
|
@ -45,14 +47,15 @@ void CCActionCamera::startWithTarget(CCNode *pTarget)
|
|||
|
||||
CCActionCamera* CCActionCamera::clone() const
|
||||
{
|
||||
auto a = new CCActionCamera(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCActionCamera();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCActionInterval * CCActionCamera::reverse()
|
||||
CCActionCamera * CCActionCamera::reverse() const
|
||||
{
|
||||
return CCReverseTime::create(this);
|
||||
return (CCActionCamera*)CCReverseTime::create(const_cast<CCActionCamera*>(this));
|
||||
}
|
||||
//
|
||||
// CCOrbitCamera
|
||||
|
@ -72,7 +75,8 @@ CCOrbitCamera * CCOrbitCamera::create(float t, float radius, float deltaRadius,
|
|||
|
||||
CCOrbitCamera* CCOrbitCamera::clone() const
|
||||
{
|
||||
auto a = new CCOrbitCamera(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCOrbitCamera();
|
||||
a->initWithDuration(_duration, _radius, _deltaRadius, _angleZ, _deltaAngleZ, _angleX, _deltaAngleX);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
|
|
@ -58,9 +58,10 @@ public:
|
|||
virtual ~CCActionCamera(){}
|
||||
// super methods
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual CCActionInterval * reverse();
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionCamera * reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
CCActionCamera *clone() const;
|
||||
virtual CCActionCamera *clone() const;
|
||||
protected:
|
||||
float _centerXOrig;
|
||||
float _centerYOrig;
|
||||
|
|
|
@ -281,7 +281,8 @@ void CCCardinalSplineTo::startWithTarget(cocos2d::CCNode *pTarget)
|
|||
|
||||
CCCardinalSplineTo* CCCardinalSplineTo::clone() const
|
||||
{
|
||||
auto a = new CCCardinalSplineTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCardinalSplineTo();
|
||||
a->initWithDuration(this->_duration, this->_points, this->_tension);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -356,7 +357,7 @@ void CCCardinalSplineTo::updatePosition(cocos2d::CCPoint &newPos)
|
|||
_previousPosition = newPos;
|
||||
}
|
||||
|
||||
CCActionInterval* CCCardinalSplineTo::reverse()
|
||||
CCCardinalSplineTo* CCCardinalSplineTo::reverse() const
|
||||
{
|
||||
CCPointArray *pReverse = _points->reverse();
|
||||
|
||||
|
@ -395,7 +396,7 @@ void CCCardinalSplineBy::updatePosition(cocos2d::CCPoint &newPos)
|
|||
_previousPosition = p;
|
||||
}
|
||||
|
||||
CCActionInterval* CCCardinalSplineBy::reverse()
|
||||
CCCardinalSplineBy* CCCardinalSplineBy::reverse() const
|
||||
{
|
||||
CCPointArray *copyConfig = (CCPointArray*)_points->copy();
|
||||
|
||||
|
@ -447,7 +448,8 @@ void CCCardinalSplineBy::startWithTarget(cocos2d::CCNode *pTarget)
|
|||
|
||||
CCCardinalSplineBy* CCCardinalSplineBy::clone() const
|
||||
{
|
||||
auto a = new CCCardinalSplineBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCardinalSplineBy();
|
||||
a->initWithDuration(this->_duration, (CCPointArray*)this->_points->copy()->autorelease(), this->_tension);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -486,12 +488,19 @@ bool CCCatmullRomTo::initWithDuration(float dt, cocos2d::CCPointArray *points)
|
|||
|
||||
CCCatmullRomTo* CCCatmullRomTo::clone() const
|
||||
{
|
||||
auto a = new CCCatmullRomTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCatmullRomTo();
|
||||
a->initWithDuration(this->_duration, (CCPointArray*)this->_points->copy()->autorelease());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCCatmullRomTo* CCCatmullRomTo::reverse() const
|
||||
{
|
||||
CCPointArray *pReverse = _points->reverse();
|
||||
return CCCatmullRomTo::create(_duration, pReverse);
|
||||
}
|
||||
|
||||
|
||||
/* CCCatmullRomBy
|
||||
*/
|
||||
|
@ -526,11 +535,56 @@ bool CCCatmullRomBy::initWithDuration(float dt, cocos2d::CCPointArray *points)
|
|||
|
||||
CCCatmullRomBy* CCCatmullRomBy::clone() const
|
||||
{
|
||||
auto a = new CCCatmullRomBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCatmullRomBy();
|
||||
a->initWithDuration(this->_duration, (CCPointArray*)this->_points->copy()->autorelease());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCCatmullRomBy* CCCatmullRomBy::reverse() const
|
||||
{
|
||||
CCPointArray *copyConfig = (CCPointArray*)_points->copy();
|
||||
|
||||
//
|
||||
// convert "absolutes" to "diffs"
|
||||
//
|
||||
CCPoint p = copyConfig->getControlPointAtIndex(0);
|
||||
for (unsigned int i = 1; i < copyConfig->count(); ++i)
|
||||
{
|
||||
CCPoint current = copyConfig->getControlPointAtIndex(i);
|
||||
CCPoint diff = ccpSub(current, p);
|
||||
copyConfig->replaceControlPoint(diff, i);
|
||||
|
||||
p = current;
|
||||
}
|
||||
|
||||
|
||||
// convert to "diffs" to "reverse absolute"
|
||||
|
||||
CCPointArray *pReverse = copyConfig->reverse();
|
||||
copyConfig->release();
|
||||
|
||||
// 1st element (which should be 0,0) should be here too
|
||||
|
||||
p = pReverse->getControlPointAtIndex(pReverse->count()-1);
|
||||
pReverse->removeControlPointAtIndex(pReverse->count()-1);
|
||||
|
||||
p = ccpNeg(p);
|
||||
pReverse->insertControlPoint(p, 0);
|
||||
|
||||
for (unsigned int i = 1; i < pReverse->count(); ++i)
|
||||
{
|
||||
CCPoint current = pReverse->getControlPointAtIndex(i);
|
||||
current = ccpNeg(current);
|
||||
CCPoint abs = ccpAdd(current, p);
|
||||
pReverse->replaceControlPoint(abs, i);
|
||||
|
||||
p = abs;
|
||||
}
|
||||
|
||||
return CCCatmullRomBy::create(_duration, pReverse);
|
||||
}
|
||||
|
||||
NS_CC_END;
|
||||
|
||||
|
|
|
@ -121,11 +121,14 @@ public:
|
|||
// super virtual functions
|
||||
/** returns a new clone of the action */
|
||||
virtual CCCardinalSplineTo *clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCCardinalSplineTo* reverse() const;
|
||||
|
||||
virtual CCCardinalSplineTo* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse();
|
||||
|
||||
|
||||
virtual void updatePosition(CCPoint &newPos);
|
||||
|
||||
inline CCPointArray* getPoints() { return _points; }
|
||||
|
@ -159,12 +162,15 @@ public:
|
|||
CCCardinalSplineBy();
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual CCActionInterval* reverse();
|
||||
|
||||
virtual void updatePosition(CCPoint &newPos);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCCardinalSplineBy *clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCCardinalSplineBy* reverse() const;
|
||||
|
||||
protected:
|
||||
CCPoint _startPosition;
|
||||
};
|
||||
|
@ -186,6 +192,9 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCCatmullRomTo *clone() const;
|
||||
|
||||
/** returns a reversed copy of the action */
|
||||
virtual CCCatmullRomTo *reverse() const;
|
||||
};
|
||||
|
||||
/** An action that moves the target with a CatmullRom curve by a certain distance.
|
||||
|
@ -205,6 +214,10 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCCatmullRomBy *clone() const;
|
||||
|
||||
/** returns a reversed copy of the action */
|
||||
virtual CCCatmullRomBy *reverse() const;
|
||||
|
||||
};
|
||||
|
||||
/** Returns the Cardinal Spline position for a given set of control points, tension and time */
|
||||
|
|
|
@ -43,24 +43,6 @@ NS_CC_BEGIN
|
|||
// EaseAction
|
||||
//
|
||||
|
||||
CCActionEase* CCActionEase::create(CCActionInterval *pAction)
|
||||
{
|
||||
CCActionEase *pRet = new CCActionEase();
|
||||
if (pRet)
|
||||
{
|
||||
if (pRet->initWithAction(pAction))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(pRet);
|
||||
}
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool CCActionEase::initWithAction(CCActionInterval *pAction)
|
||||
{
|
||||
CCAssert(pAction != NULL, "");
|
||||
|
@ -76,37 +58,6 @@ bool CCActionEase::initWithAction(CCActionInterval *pAction)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCActionEase* CCActionEase::clone() const
|
||||
{
|
||||
auto a = new CCActionEase(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCActionEase::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
CCActionEase* pCopy = NULL;
|
||||
if(pZone && pZone->_copyObject)
|
||||
{
|
||||
//in case of being called at sub class
|
||||
pCopy = (CCActionEase*)(pZone->_copyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCopy = new CCActionEase();
|
||||
pZone = pNewZone = new CCZone(pCopy);
|
||||
}
|
||||
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
|
||||
pCopy->initWithAction((CCActionInterval *)(_inner->copy()->autorelease()));
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
}
|
||||
|
||||
CCActionEase::~CCActionEase(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(_inner);
|
||||
|
@ -129,11 +80,6 @@ void CCActionEase::update(float time)
|
|||
_inner->update(time);
|
||||
}
|
||||
|
||||
CCActionInterval* CCActionEase::reverse(void)
|
||||
{
|
||||
return CCActionEase::create(_inner->reverse());
|
||||
}
|
||||
|
||||
CCActionInterval* CCActionEase::getInnerAction()
|
||||
{
|
||||
return _inner;
|
||||
|
@ -143,24 +89,6 @@ CCActionInterval* CCActionEase::getInnerAction()
|
|||
// EaseRateAction
|
||||
//
|
||||
|
||||
CCEaseRateAction* CCEaseRateAction::create(CCActionInterval *pAction, float fRate)
|
||||
{
|
||||
CCEaseRateAction *pRet = new CCEaseRateAction();
|
||||
if (pRet)
|
||||
{
|
||||
if (pRet->initWithAction(pAction, fRate))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(pRet);
|
||||
}
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool CCEaseRateAction::initWithAction(CCActionInterval *pAction, float fRate)
|
||||
{
|
||||
if (CCActionEase::initWithAction(pAction))
|
||||
|
@ -172,44 +100,10 @@ bool CCEaseRateAction::initWithAction(CCActionInterval *pAction, float fRate)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCEaseRateAction* CCEaseRateAction::clone() const
|
||||
{
|
||||
auto a = new CCEaseRateAction(*this);
|
||||
a->initWithAction((CCActionInterval*)_inner->clone(), _rate);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCEaseRateAction::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
CCEaseRateAction* pCopy = NULL;
|
||||
if(pZone && pZone->_copyObject)
|
||||
{
|
||||
//in case of being called at sub class
|
||||
pCopy = (CCEaseRateAction*)(pZone->_copyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCopy = new CCEaseRateAction();
|
||||
pNewZone = new CCZone(pCopy);
|
||||
}
|
||||
|
||||
pCopy->initWithAction((CCActionInterval*)(_inner->copy()->autorelease()), _rate);
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
}
|
||||
|
||||
CCEaseRateAction::~CCEaseRateAction(void)
|
||||
{
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseRateAction::reverse(void)
|
||||
{
|
||||
return CCEaseRateAction::create(_inner->reverse(), 1 / _rate);
|
||||
}
|
||||
|
||||
//
|
||||
// EeseIn
|
||||
//
|
||||
|
@ -234,8 +128,9 @@ CCEaseIn* CCEaseIn::create(CCActionInterval *pAction, float fRate)
|
|||
|
||||
CCEaseIn* CCEaseIn::clone() const
|
||||
{
|
||||
auto a = new CCEaseIn(*this);
|
||||
a->initWithAction((CCActionInterval*)_inner->clone(), _rate);
|
||||
// no copy constructor
|
||||
auto a = new CCEaseIn();
|
||||
a->initWithAction(_inner->clone(), _rate);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -266,7 +161,7 @@ void CCEaseIn::update(float time)
|
|||
_inner->update(powf(time, _rate));
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseIn::reverse(void)
|
||||
CCEaseIn* CCEaseIn::reverse() const
|
||||
{
|
||||
return CCEaseIn::create(_inner->reverse(), 1 / _rate);
|
||||
}
|
||||
|
@ -294,8 +189,9 @@ CCEaseOut* CCEaseOut::create(CCActionInterval *pAction, float fRate)
|
|||
|
||||
CCEaseOut* CCEaseOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseOut(*this);
|
||||
a->initWithAction((CCActionInterval*)_inner->clone(), _rate);
|
||||
// no copy constructor
|
||||
auto a = new CCEaseOut();
|
||||
a->initWithAction(_inner->clone(), _rate);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -326,7 +222,7 @@ void CCEaseOut::update(float time)
|
|||
_inner->update(powf(time, 1 / _rate));
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseOut::reverse()
|
||||
CCEaseOut* CCEaseOut::reverse() const
|
||||
{
|
||||
return CCEaseOut::create(_inner->reverse(), 1 / _rate);
|
||||
}
|
||||
|
@ -354,8 +250,9 @@ CCEaseInOut* CCEaseInOut::create(CCActionInterval *pAction, float fRate)
|
|||
|
||||
CCEaseInOut* CCEaseInOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseInOut(*this);
|
||||
a->initWithAction((CCActionInterval*)_inner->clone(), _rate);
|
||||
// no copy constructor
|
||||
auto a = new CCEaseInOut();
|
||||
a->initWithAction(_inner->clone(), _rate);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -395,7 +292,7 @@ void CCEaseInOut::update(float time)
|
|||
}
|
||||
|
||||
// InOut and OutIn are symmetrical
|
||||
CCActionInterval* CCEaseInOut::reverse(void)
|
||||
CCEaseInOut* CCEaseInOut::reverse() const
|
||||
{
|
||||
return CCEaseInOut::create(_inner->reverse(), _rate);
|
||||
}
|
||||
|
@ -423,8 +320,9 @@ CCEaseExponentialIn* CCEaseExponentialIn::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseExponentialIn* CCEaseExponentialIn::clone() const
|
||||
{
|
||||
auto a = new CCEaseExponentialIn(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseExponentialIn();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -455,7 +353,7 @@ void CCEaseExponentialIn::update(float time)
|
|||
_inner->update(time == 0 ? 0 : powf(2, 10 * (time/1 - 1)) - 1 * 0.001f);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseExponentialIn::reverse(void)
|
||||
CCActionEase * CCEaseExponentialIn::reverse() const
|
||||
{
|
||||
return CCEaseExponentialOut::create(_inner->reverse());
|
||||
}
|
||||
|
@ -483,8 +381,9 @@ CCEaseExponentialOut* CCEaseExponentialOut::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseExponentialOut* CCEaseExponentialOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseExponentialOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseExponentialOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -515,7 +414,7 @@ void CCEaseExponentialOut::update(float time)
|
|||
_inner->update(time == 1 ? 1 : (-powf(2, -10 * time / 1) + 1));
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseExponentialOut::reverse(void)
|
||||
CCActionEase* CCEaseExponentialOut::reverse() const
|
||||
{
|
||||
return CCEaseExponentialIn::create(_inner->reverse());
|
||||
}
|
||||
|
@ -544,8 +443,9 @@ CCEaseExponentialInOut* CCEaseExponentialInOut::create(CCActionInterval *pAction
|
|||
|
||||
CCEaseExponentialInOut* CCEaseExponentialInOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseExponentialInOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseExponentialInOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -586,7 +486,7 @@ void CCEaseExponentialInOut::update(float time)
|
|||
_inner->update(time);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseExponentialInOut::reverse()
|
||||
CCEaseExponentialInOut* CCEaseExponentialInOut::reverse() const
|
||||
{
|
||||
return CCEaseExponentialInOut::create(_inner->reverse());
|
||||
}
|
||||
|
@ -615,8 +515,9 @@ CCEaseSineIn* CCEaseSineIn::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseSineIn* CCEaseSineIn::clone() const
|
||||
{
|
||||
auto a = new CCEaseSineIn(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseSineIn();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -647,7 +548,7 @@ void CCEaseSineIn::update(float time)
|
|||
_inner->update(-1 * cosf(time * (float)M_PI_2) + 1);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseSineIn::reverse(void)
|
||||
CCActionEase* CCEaseSineIn::reverse() const
|
||||
{
|
||||
return CCEaseSineOut::create(_inner->reverse());
|
||||
}
|
||||
|
@ -676,8 +577,9 @@ CCEaseSineOut* CCEaseSineOut::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseSineOut* CCEaseSineOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseSineOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseSineOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -708,7 +610,7 @@ void CCEaseSineOut::update(float time)
|
|||
_inner->update(sinf(time * (float)M_PI_2));
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseSineOut::reverse(void)
|
||||
CCActionEase* CCEaseSineOut::reverse(void) const
|
||||
{
|
||||
return CCEaseSineIn::create(_inner->reverse());
|
||||
}
|
||||
|
@ -737,8 +639,9 @@ CCEaseSineInOut* CCEaseSineInOut::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseSineInOut* CCEaseSineInOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseSineInOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseSineInOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -769,7 +672,7 @@ void CCEaseSineInOut::update(float time)
|
|||
_inner->update(-0.5f * (cosf((float)M_PI * time) - 1));
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseSineInOut::reverse()
|
||||
CCEaseSineInOut* CCEaseSineInOut::reverse() const
|
||||
{
|
||||
return CCEaseSineInOut::create(_inner->reverse());
|
||||
}
|
||||
|
@ -778,29 +681,6 @@ CCActionInterval* CCEaseSineInOut::reverse()
|
|||
// EaseElastic
|
||||
//
|
||||
|
||||
CCEaseElastic* CCEaseElastic::create(CCActionInterval *pAction)
|
||||
{
|
||||
return CCEaseElastic::create(pAction, 0.3f);
|
||||
}
|
||||
|
||||
CCEaseElastic* CCEaseElastic::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
|
||||
{
|
||||
CCEaseElastic *pRet = new CCEaseElastic();
|
||||
if (pRet)
|
||||
{
|
||||
if (pRet->initWithAction(pAction, fPeriod))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(pRet);
|
||||
}
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool CCEaseElastic::initWithAction(CCActionInterval *pAction, float fPeriod/* = 0.3f*/)
|
||||
{
|
||||
if (CCActionEase::initWithAction(pAction))
|
||||
|
@ -812,42 +692,6 @@ bool CCEaseElastic::initWithAction(CCActionInterval *pAction, float fPeriod/* =
|
|||
return false;
|
||||
}
|
||||
|
||||
CCEaseElastic* CCEaseElastic::clone() const
|
||||
{
|
||||
auto a = new CCEaseElastic(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone(), _period);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCEaseElastic::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
CCEaseElastic* pCopy = NULL;
|
||||
if(pZone && pZone->_copyObject)
|
||||
{
|
||||
//in case of being called at sub class
|
||||
pCopy = (CCEaseElastic*)(pZone->_copyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCopy = new CCEaseElastic();
|
||||
pNewZone = new CCZone(pCopy);
|
||||
}
|
||||
|
||||
pCopy->initWithAction((CCActionInterval *)(_inner->copy()->autorelease()), _period);
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseElastic::reverse(void)
|
||||
{
|
||||
CCAssert(0, "Override me");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// EaseElasticIn
|
||||
//
|
||||
|
@ -877,8 +721,9 @@ CCEaseElasticIn* CCEaseElasticIn::create(CCActionInterval *pAction, float fPerio
|
|||
|
||||
CCEaseElasticIn* CCEaseElasticIn::clone() const
|
||||
{
|
||||
auto a = new CCEaseElasticIn(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone(), _period);
|
||||
// no copy constructor
|
||||
auto a = new CCEaseElasticIn();
|
||||
a->initWithAction(_inner->clone(), _period);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -921,7 +766,7 @@ void CCEaseElasticIn::update(float time)
|
|||
_inner->update(newT);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseElasticIn::reverse(void)
|
||||
CCEaseElastic* CCEaseElasticIn::reverse() const
|
||||
{
|
||||
return CCEaseElasticOut::create(_inner->reverse(), _period);
|
||||
}
|
||||
|
@ -955,8 +800,9 @@ CCEaseElasticOut* CCEaseElasticOut::create(CCActionInterval *pAction, float fPer
|
|||
|
||||
CCEaseElasticOut* CCEaseElasticOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseElasticOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone(), _period);
|
||||
// no copy constructor
|
||||
auto a = new CCEaseElasticOut();
|
||||
a->initWithAction(_inner->clone(), _period);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -998,7 +844,7 @@ void CCEaseElasticOut::update(float time)
|
|||
_inner->update(newT);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseElasticOut::reverse(void)
|
||||
CCEaseElastic* CCEaseElasticOut::reverse() const
|
||||
{
|
||||
return CCEaseElasticIn::create(_inner->reverse(), _period);
|
||||
}
|
||||
|
@ -1032,8 +878,9 @@ CCEaseElasticInOut* CCEaseElasticInOut::create(CCActionInterval *pAction, float
|
|||
|
||||
CCEaseElasticInOut* CCEaseElasticInOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseElasticInOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone(), _period);
|
||||
// no copy constructor
|
||||
auto a = new CCEaseElasticInOut();
|
||||
a->initWithAction(_inner->clone(), _period);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1091,7 +938,7 @@ void CCEaseElasticInOut::update(float time)
|
|||
_inner->update(newT);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseElasticInOut::reverse(void)
|
||||
CCEaseElasticInOut* CCEaseElasticInOut::reverse() const
|
||||
{
|
||||
return CCEaseElasticInOut::create(_inner->reverse(), _period);
|
||||
}
|
||||
|
@ -1100,53 +947,6 @@ CCActionInterval* CCEaseElasticInOut::reverse(void)
|
|||
// EaseBounce
|
||||
//
|
||||
|
||||
CCEaseBounce* CCEaseBounce::create(CCActionInterval* pAction)
|
||||
{
|
||||
CCEaseBounce *pRet = new CCEaseBounce();
|
||||
if (pRet)
|
||||
{
|
||||
if (pRet->initWithAction(pAction))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(pRet);
|
||||
}
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
CCEaseBounce* CCEaseBounce::clone() const
|
||||
{
|
||||
auto a = new CCEaseBounce(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCEaseBounce::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
CCEaseBounce* pCopy = NULL;
|
||||
if(pZone && pZone->_copyObject)
|
||||
{
|
||||
//in case of being called at sub class
|
||||
pCopy = (CCEaseBounce*)(pZone->_copyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCopy = new CCEaseBounce();
|
||||
pNewZone = new CCZone(pCopy);
|
||||
}
|
||||
|
||||
pCopy->initWithAction((CCActionInterval *)(_inner->copy()->autorelease()));
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
}
|
||||
|
||||
float CCEaseBounce::bounceTime(float time)
|
||||
{
|
||||
if (time < 1 / 2.75)
|
||||
|
@ -1168,11 +968,6 @@ float CCEaseBounce::bounceTime(float time)
|
|||
return 7.5625f * time * time + 0.984375f;
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseBounce::reverse()
|
||||
{
|
||||
return CCEaseBounce::create(_inner->reverse());
|
||||
}
|
||||
|
||||
//
|
||||
// EaseBounceIn
|
||||
//
|
||||
|
@ -1197,8 +992,9 @@ CCEaseBounceIn* CCEaseBounceIn::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseBounceIn* CCEaseBounceIn::clone() const
|
||||
{
|
||||
auto a = new CCEaseBounceIn(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseBounceIn();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1230,7 +1026,7 @@ void CCEaseBounceIn::update(float time)
|
|||
_inner->update(newT);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseBounceIn::reverse(void)
|
||||
CCEaseBounce* CCEaseBounceIn::reverse() const
|
||||
{
|
||||
return CCEaseBounceOut::create(_inner->reverse());
|
||||
}
|
||||
|
@ -1259,8 +1055,9 @@ CCEaseBounceOut* CCEaseBounceOut::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseBounceOut* CCEaseBounceOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseBounceOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseBounceOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1292,7 +1089,7 @@ void CCEaseBounceOut::update(float time)
|
|||
_inner->update(newT);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseBounceOut::reverse(void)
|
||||
CCEaseBounce* CCEaseBounceOut::reverse() const
|
||||
{
|
||||
return CCEaseBounceIn::create(_inner->reverse());
|
||||
}
|
||||
|
@ -1321,8 +1118,9 @@ CCEaseBounceInOut* CCEaseBounceInOut::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseBounceInOut* CCEaseBounceInOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseBounceInOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseBounceInOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1364,7 +1162,7 @@ void CCEaseBounceInOut::update(float time)
|
|||
_inner->update(newT);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseBounceInOut::reverse()
|
||||
CCEaseBounceInOut* CCEaseBounceInOut::reverse() const
|
||||
{
|
||||
return CCEaseBounceInOut::create(_inner->reverse());
|
||||
}
|
||||
|
@ -1393,8 +1191,9 @@ CCEaseBackIn* CCEaseBackIn::create(CCActionInterval *pAction)
|
|||
|
||||
CCEaseBackIn* CCEaseBackIn::clone() const
|
||||
{
|
||||
auto a = new CCEaseBackIn(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseBackIn();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1426,7 +1225,7 @@ void CCEaseBackIn::update(float time)
|
|||
_inner->update(time * time * ((overshoot + 1) * time - overshoot));
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseBackIn::reverse(void)
|
||||
CCActionEase* CCEaseBackIn::reverse() const
|
||||
{
|
||||
return CCEaseBackOut::create(_inner->reverse());
|
||||
}
|
||||
|
@ -1455,8 +1254,9 @@ CCEaseBackOut* CCEaseBackOut::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseBackOut* CCEaseBackOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseBackOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseBackOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1490,7 +1290,7 @@ void CCEaseBackOut::update(float time)
|
|||
_inner->update(time * time * ((overshoot + 1) * time + overshoot) + 1);
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseBackOut::reverse(void)
|
||||
CCActionEase* CCEaseBackOut::reverse() const
|
||||
{
|
||||
return CCEaseBackIn::create(_inner->reverse());
|
||||
}
|
||||
|
@ -1519,8 +1319,9 @@ CCEaseBackInOut* CCEaseBackInOut::create(CCActionInterval* pAction)
|
|||
|
||||
CCEaseBackInOut* CCEaseBackInOut::clone() const
|
||||
{
|
||||
auto a = new CCEaseBackInOut(*this);
|
||||
a->initWithAction((CCActionInterval *)_inner->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCEaseBackInOut();
|
||||
a->initWithAction(_inner->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -1562,7 +1363,7 @@ void CCEaseBackInOut::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCEaseBackInOut::reverse()
|
||||
CCEaseBackInOut* CCEaseBackInOut::reverse() const
|
||||
{
|
||||
return CCEaseBackInOut::create(_inner->reverse());
|
||||
}
|
||||
|
|
|
@ -50,19 +50,14 @@ public:
|
|||
/** initializes the action */
|
||||
bool initWithAction(CCActionInterval *pAction);
|
||||
|
||||
virtual CCActionEase* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionEase* clone() const = 0;
|
||||
virtual CCActionEase* reverse() const = 0;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
virtual CCActionInterval* getInnerAction();
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action */
|
||||
static CCActionEase* create(CCActionInterval *pAction);
|
||||
|
||||
protected:
|
||||
/** The inner action */
|
||||
CCActionInterval *_inner;
|
||||
|
@ -85,14 +80,8 @@ public:
|
|||
/** Initializes the action with the inner action and the rate parameter */
|
||||
bool initWithAction(CCActionInterval *pAction, float fRate);
|
||||
|
||||
virtual CCEaseRateAction* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
|
||||
/** Creates the action with the inner action and the rate parameter */
|
||||
static CCEaseRateAction* create(CCActionInterval* pAction, float fRate);
|
||||
virtual CCEaseRateAction* clone() const = 0;
|
||||
virtual CCEaseRateAction* reverse() const = 0;
|
||||
|
||||
protected:
|
||||
float _rate;
|
||||
|
@ -106,8 +95,12 @@ class CC_DLL CCEaseIn : public CCEaseRateAction
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseIn* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseIn* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
public:
|
||||
|
||||
|
@ -123,8 +116,10 @@ class CC_DLL CCEaseOut : public CCEaseRateAction
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse();
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseOut* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -141,9 +136,11 @@ class CC_DLL CCEaseInOut : public CCEaseRateAction
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCEaseInOut* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseInOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseInOut* reverse() const;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -159,8 +156,10 @@ class CC_DLL CCEaseExponentialIn : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseExponentialIn* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionEase* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -176,8 +175,10 @@ class CC_DLL CCEaseExponentialOut : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseExponentialOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionEase* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -193,9 +194,11 @@ class CC_DLL CCEaseExponentialInOut : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseExponentialInOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseExponentialInOut* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse();
|
||||
|
||||
public:
|
||||
|
||||
|
@ -211,8 +214,10 @@ class CC_DLL CCEaseSineIn : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseSineIn* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionEase* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -228,8 +233,10 @@ class CC_DLL CCEaseSineOut : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseSineOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionEase* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -246,9 +253,11 @@ class CC_DLL CCEaseSineInOut : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseSineInOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseSineInOut* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse();
|
||||
|
||||
public:
|
||||
|
||||
|
@ -272,15 +281,11 @@ public:
|
|||
/** Initializes the action with the inner action and the period in radians (default is 0.3) */
|
||||
bool initWithAction(CCActionInterval *pAction, float fPeriod = 0.3f);
|
||||
|
||||
virtual CCActionInterval* reverse(void);
|
||||
virtual CCEaseElastic* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseElastic* clone() const = 0;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseElastic* reverse() const = 0;
|
||||
|
||||
public:
|
||||
|
||||
/** Creates the action with the inner action and the period in radians (default is 0.3) */
|
||||
static CCEaseElastic* create(CCActionInterval *pAction, float fPeriod);
|
||||
static CCEaseElastic* create(CCActionInterval *pAction);
|
||||
protected:
|
||||
float _period;
|
||||
};
|
||||
|
@ -295,8 +300,10 @@ class CC_DLL CCEaseElasticIn : public CCEaseElastic
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseElasticIn* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseElastic* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -316,8 +323,10 @@ class CC_DLL CCEaseElasticOut : public CCEaseElastic
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseElasticOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseElastic* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -337,8 +346,10 @@ class CC_DLL CCEaseElasticInOut : public CCEaseElastic
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseElasticInOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseElasticInOut* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -357,14 +368,11 @@ class CC_DLL CCEaseBounce : public CCActionEase
|
|||
{
|
||||
public:
|
||||
float bounceTime(float time);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCEaseBounce* clone() const;
|
||||
virtual CCActionInterval* reverse();
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseBounce* clone() const = 0;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseBounce* reverse() const = 0;
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action */
|
||||
static CCEaseBounce* create(CCActionInterval* pAction);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -377,8 +385,10 @@ class CC_DLL CCEaseBounceIn : public CCEaseBounce
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseBounceIn* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseBounce* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -397,8 +407,10 @@ class CC_DLL CCEaseBounceOut : public CCEaseBounce
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseBounceOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseBounce* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -417,9 +429,11 @@ class CC_DLL CCEaseBounceInOut : public CCEaseBounce
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseBounceInOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseBounceInOut* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse();
|
||||
|
||||
public:
|
||||
|
||||
|
@ -437,8 +451,10 @@ class CC_DLL CCEaseBackIn : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseBackIn* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionEase* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -457,8 +473,10 @@ class CC_DLL CCEaseBackOut : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseBackOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionEase* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -477,9 +495,11 @@ class CC_DLL CCEaseBackInOut : public CCActionEase
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCEaseBackInOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCEaseBackInOut* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual CCActionInterval* reverse();
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -30,24 +30,6 @@ THE SOFTWARE.
|
|||
NS_CC_BEGIN
|
||||
// implementation of CCGridAction
|
||||
|
||||
CCGridAction* CCGridAction::create(float duration, const CCSize& gridSize)
|
||||
{
|
||||
CCGridAction *pAction = new CCGridAction();
|
||||
if (pAction)
|
||||
{
|
||||
if (pAction->initWithDuration(duration, gridSize))
|
||||
{
|
||||
pAction->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE(pAction);
|
||||
}
|
||||
}
|
||||
|
||||
return pAction;
|
||||
}
|
||||
|
||||
bool CCGridAction::initWithDuration(float duration, const CCSize& gridSize)
|
||||
{
|
||||
if (CCActionInterval::initWithDuration(duration))
|
||||
|
@ -93,6 +75,11 @@ void CCGridAction::startWithTarget(CCNode *pTarget)
|
|||
}
|
||||
}
|
||||
|
||||
CCGridAction* CCGridAction::reverse() const
|
||||
{
|
||||
return (CCGridAction*)CCReverseTime::create( this->clone() );
|
||||
}
|
||||
|
||||
CCGridBase* CCGridAction::getGrid(void)
|
||||
{
|
||||
// Abstract class needs implementation
|
||||
|
@ -101,42 +88,6 @@ CCGridBase* CCGridAction::getGrid(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
CCActionInterval* CCGridAction::reverse(void)
|
||||
{
|
||||
return CCReverseTime::create(this);
|
||||
}
|
||||
|
||||
CCGridAction * CCGridAction::clone() const
|
||||
{
|
||||
auto a = new CCGridAction(*this);
|
||||
a->initWithDuration(_duration, _gridSize);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCGridAction::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
CCGridAction* pCopy = NULL;
|
||||
if(pZone && pZone->_copyObject)
|
||||
{
|
||||
//in case of being called at sub class
|
||||
pCopy = (CCGridAction*)(pZone->_copyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCopy = new CCGridAction();
|
||||
pZone = pNewZone = new CCZone(pCopy);
|
||||
}
|
||||
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
|
||||
pCopy->initWithDuration(_duration, _gridSize);
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
}
|
||||
|
||||
// implementation of Grid3DAction
|
||||
|
||||
CCGridBase* CCGrid3DAction::getGrid(void)
|
||||
|
@ -187,20 +138,6 @@ void CCTiledGrid3DAction::setTile(const CCPoint& pos, const ccQuad3& coords)
|
|||
return g->setTile(pos, coords);
|
||||
}
|
||||
|
||||
CCTiledGrid3DAction* CCTiledGrid3DAction::create(float duration, const CCSize& gridSize)
|
||||
{
|
||||
CCTiledGrid3DAction* pRet = new CCTiledGrid3DAction();
|
||||
if (pRet && pRet->initWithDuration(duration, gridSize))
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE(pRet);
|
||||
}
|
||||
return pRet;
|
||||
}
|
||||
|
||||
// implementation CCAccelDeccelAmplitude
|
||||
|
||||
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::create(CCAction *pAction, float duration)
|
||||
|
@ -235,6 +172,15 @@ bool CCAccelDeccelAmplitude::initWithAction(CCAction *pAction, float duration)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCAccelDeccelAmplitude();
|
||||
a->initWithAction(_other->clone(), _rate);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCAccelDeccelAmplitude::~CCAccelDeccelAmplitude(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(_other);
|
||||
|
@ -259,7 +205,7 @@ void CCAccelDeccelAmplitude::update(float time)
|
|||
((CCAccelDeccelAmplitude*)(_other))->setAmplitudeRate(powf(f, _rate));
|
||||
}
|
||||
|
||||
CCActionInterval* CCAccelDeccelAmplitude::reverse(void)
|
||||
CCAccelDeccelAmplitude* CCAccelDeccelAmplitude::reverse() const
|
||||
{
|
||||
return CCAccelDeccelAmplitude::create(_other->reverse(), _duration);
|
||||
}
|
||||
|
@ -298,6 +244,15 @@ bool CCAccelAmplitude::initWithAction(CCAction *pAction, float duration)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCAccelAmplitude* CCAccelAmplitude::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCAccelAmplitude();
|
||||
a->initWithAction(_other->clone(), _duration);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCAccelAmplitude::~CCAccelAmplitude(void)
|
||||
{
|
||||
CC_SAFE_DELETE(_other);
|
||||
|
@ -315,7 +270,7 @@ void CCAccelAmplitude::update(float time)
|
|||
_other->update(time);
|
||||
}
|
||||
|
||||
CCActionInterval* CCAccelAmplitude::reverse(void)
|
||||
CCAccelAmplitude* CCAccelAmplitude::reverse() const
|
||||
{
|
||||
return CCAccelAmplitude::create(_other->reverse(), _duration);
|
||||
}
|
||||
|
@ -340,7 +295,6 @@ CCDeccelAmplitude* CCDeccelAmplitude::create(CCAction *pAction, float duration)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
|
||||
bool CCDeccelAmplitude::initWithAction(CCAction *pAction, float duration)
|
||||
{
|
||||
if (CCActionInterval::initWithDuration(duration))
|
||||
|
@ -372,7 +326,16 @@ void CCDeccelAmplitude::update(float time)
|
|||
_other->update(time);
|
||||
}
|
||||
|
||||
CCActionInterval* CCDeccelAmplitude::reverse(void)
|
||||
CCDeccelAmplitude* CCDeccelAmplitude::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCDeccelAmplitude();
|
||||
a->initWithAction(_other->clone(), _duration);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCDeccelAmplitude* CCDeccelAmplitude::reverse() const
|
||||
{
|
||||
return CCDeccelAmplitude::create(_other->reverse(), _duration);
|
||||
}
|
||||
|
@ -397,6 +360,18 @@ CCStopGrid* CCStopGrid::create(void)
|
|||
|
||||
return pAction;
|
||||
}
|
||||
|
||||
CCStopGrid* CCStopGrid::clone() const
|
||||
{
|
||||
return CCStopGrid::create();
|
||||
}
|
||||
|
||||
CCStopGrid* CCStopGrid::reverse() const
|
||||
{
|
||||
// no reverse, just clone it
|
||||
return this->clone();
|
||||
}
|
||||
|
||||
// implementation of CCReuseGrid
|
||||
|
||||
CCReuseGrid* CCReuseGrid::create(int times)
|
||||
|
@ -434,4 +409,15 @@ void CCReuseGrid::startWithTarget(CCNode *pTarget)
|
|||
}
|
||||
}
|
||||
|
||||
CCReuseGrid* CCReuseGrid::clone() const
|
||||
{
|
||||
return CCReuseGrid::create(_times);
|
||||
}
|
||||
|
||||
CCReuseGrid* CCReuseGrid::reverse() const
|
||||
{
|
||||
// no reverse, just clone it
|
||||
return this->clone();
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -41,10 +41,15 @@ class CCGridBase;
|
|||
class CC_DLL CCGridAction : public CCActionInterval
|
||||
{
|
||||
public:
|
||||
virtual CCGridAction * clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCGridAction * clone() const = 0;
|
||||
|
||||
/** returns a new reversed action.
|
||||
The reversed action is created with the CCReverseTime action.
|
||||
*/
|
||||
virtual CCGridAction* reverse() const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
/** initializes the action with size and duration */
|
||||
virtual bool initWithDuration(float duration, const CCSize& gridSize);
|
||||
|
@ -52,14 +57,6 @@ public:
|
|||
/** returns the grid */
|
||||
virtual CCGridBase* getGrid(void);
|
||||
|
||||
public:
|
||||
/** creates the action with size and duration */
|
||||
// We can't make this create function compatible with previous version, bindings-generator will be confused since they
|
||||
// have the same function name and the same number of arguments. So sorry about that.
|
||||
//CC_DEPRECATED_ATTRIBUTE static CCGridAction* create(const CCSize& gridSize, float duration);
|
||||
|
||||
/** creates the action with size and duration */
|
||||
static CCGridAction* create(float duration, const CCSize& gridSize);
|
||||
protected:
|
||||
CCSize _gridSize;
|
||||
};
|
||||
|
@ -71,6 +68,9 @@ protected:
|
|||
class CC_DLL CCGrid3DAction : public CCGridAction
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual CCGrid3DAction * clone() const = 0;
|
||||
|
||||
/** returns the grid */
|
||||
virtual CCGridBase* getGrid(void);
|
||||
/** returns the vertex than belongs to certain position in the grid */
|
||||
|
@ -79,16 +79,15 @@ public:
|
|||
ccVertex3F originalVertex(const CCPoint& position);
|
||||
/** sets a new vertex to a certain position of the grid */
|
||||
void setVertex(const CCPoint& position, const ccVertex3F& vertex);
|
||||
|
||||
public:
|
||||
/** creates the action with size and duration */
|
||||
static CCGrid3DAction* create(float duration, const CCSize& gridSize);
|
||||
};
|
||||
|
||||
/** @brief Base class for CCTiledGrid3D actions */
|
||||
class CC_DLL CCTiledGrid3DAction : public CCGridAction
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual CCTiledGrid3DAction * clone() const = 0;
|
||||
|
||||
/** returns the tile that belongs to a certain position of the grid */
|
||||
ccQuad3 tile(const CCPoint& position);
|
||||
/** returns the non-transformed tile that belongs to a certain position of the grid */
|
||||
|
@ -112,9 +111,13 @@ public:
|
|||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(CCAction *pAction, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCAccelDeccelAmplitude* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCAccelDeccelAmplitude* reverse() const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) { return _rate; }
|
||||
|
@ -138,6 +141,12 @@ public:
|
|||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(CCAction *pAction, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCAccelAmplitude* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCAccelAmplitude* reverse() const;
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) { return _rate; }
|
||||
/** set amplitude rate */
|
||||
|
@ -145,7 +154,6 @@ public:
|
|||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
|
@ -163,6 +171,12 @@ public:
|
|||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(CCAction *pAction, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCDeccelAmplitude* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCDeccelAmplitude* reverse() const;
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) { return _rate; }
|
||||
/** set amplitude rate */
|
||||
|
@ -170,7 +184,6 @@ public:
|
|||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
|
@ -191,6 +204,12 @@ class CC_DLL CCStopGrid : public CCActionInstant
|
|||
public:
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCStopGrid* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCStopGrid* reverse() const;
|
||||
|
||||
public:
|
||||
/** Allocates and initializes the action */
|
||||
static CCStopGrid* create(void);
|
||||
|
@ -205,6 +224,12 @@ public:
|
|||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCReuseGrid* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCReuseGrid* reverse() const;
|
||||
|
||||
public:
|
||||
/** creates an action with the number of times that the current grid will be reused */
|
||||
static CCReuseGrid* create(int times);
|
||||
|
|
|
@ -64,6 +64,15 @@ bool CCWaves3D::initWithDuration(float duration, const CCSize& gridSize, unsigne
|
|||
return false;
|
||||
}
|
||||
|
||||
CCWaves3D* CCWaves3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCWaves3D();
|
||||
a->initWithDuration(_duration, _gridSize, _waves, _amplitude);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCWaves3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -142,6 +151,15 @@ bool CCFlipX3D::initWithSize(const CCSize& gridSize, float duration)
|
|||
return CCGrid3DAction::initWithDuration(duration, gridSize);
|
||||
}
|
||||
|
||||
CCFlipX3D* CCFlipX3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCFlipX3D();
|
||||
a->initWithSize(_gridSize, _duration);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCFlipX3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -376,6 +394,15 @@ bool CCLens3D::initWithDuration(float duration, const CCSize& gridSize, const CC
|
|||
return false;
|
||||
}
|
||||
|
||||
CCLens3D* CCLens3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCLens3D();
|
||||
a->initWithDuration(_duration, _gridSize, _position, _radius);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCLens3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -493,6 +520,16 @@ void CCRipple3D::setPosition(const CCPoint& position)
|
|||
_position = position;
|
||||
}
|
||||
|
||||
|
||||
CCRipple3D* CCRipple3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCRipple3D();
|
||||
a->initWithDuration(_duration, _gridSize, _position, _radius, _waves, _amplitude);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCRipple3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -574,6 +611,15 @@ bool CCShaky3D::initWithDuration(float duration, const CCSize& gridSize, int ran
|
|||
return false;
|
||||
}
|
||||
|
||||
CCShaky3D* CCShaky3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCShaky3D();
|
||||
a->initWithDuration(_duration, _gridSize, _randrange, _shakeZ);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCShaky3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -654,6 +700,15 @@ bool CCLiquid::initWithDuration(float duration, const CCSize& gridSize, unsigned
|
|||
return false;
|
||||
}
|
||||
|
||||
CCLiquid* CCLiquid::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCLiquid();
|
||||
a->initWithDuration(_duration, _gridSize, _waves, _amplitude);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCLiquid::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -730,6 +785,15 @@ bool CCWaves::initWithDuration(float duration, const CCSize& gridSize, unsigned
|
|||
return false;
|
||||
}
|
||||
|
||||
CCWaves* CCWaves::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCWaves();
|
||||
a->initWithDuration(_duration, _gridSize, _waves, _amplitude, _horizontal, _vertical);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCWaves::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -819,6 +883,15 @@ void CCTwirl::setPosition(const CCPoint& position)
|
|||
_position = position;
|
||||
}
|
||||
|
||||
CCTwirl *CCTwirl::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCTwirl();
|
||||
a->initWithDuration(_duration, _gridSize, _position, _twirls, _amplitude);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCTwirl::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
|
|
@ -49,6 +49,9 @@ public:
|
|||
/** initializes an action with duration, grid size, waves and amplitude */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCWaves3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -68,6 +71,10 @@ public:
|
|||
/** initializes the action with duration */
|
||||
virtual bool initWithDuration(float duration);
|
||||
virtual bool initWithSize(const CCSize& gridSize, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFlipX3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -104,6 +111,10 @@ public:
|
|||
|
||||
/** initializes the action with center position, radius, a grid size and duration */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCLens3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -139,6 +150,10 @@ public:
|
|||
|
||||
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, const CCPoint& position, float radius, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCRipple3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -160,6 +175,10 @@ class CC_DLL CCShaky3D : public CCGrid3DAction
|
|||
public:
|
||||
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, int range, bool shakeZ);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCShaky3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -183,6 +202,10 @@ public:
|
|||
|
||||
/** initializes the action with amplitude, a grid and duration */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCLiquid* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -207,6 +230,10 @@ public:
|
|||
|
||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCWaves* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -239,6 +266,10 @@ public:
|
|||
|
||||
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCTwirl* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
|
|
@ -34,31 +34,6 @@ NS_CC_BEGIN
|
|||
//
|
||||
// InstantAction
|
||||
//
|
||||
|
||||
CCActionInstant * CCActionInstant::clone() const
|
||||
{
|
||||
auto a = new CCActionInstant(*this);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject * CCActionInstant::copyWithZone(CCZone *pZone) {
|
||||
|
||||
CCZone *pNewZone = NULL;
|
||||
CCActionInstant *pRet = NULL;
|
||||
|
||||
if (pZone && pZone->_copyObject) {
|
||||
pRet = (CCActionInstant*) (pZone->_copyObject);
|
||||
} else {
|
||||
pRet = new CCActionInstant();
|
||||
pZone = pNewZone = new CCZone(pRet);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction::copyWithZone(pZone);
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool CCActionInstant::isDone() {
|
||||
return true;
|
||||
}
|
||||
|
@ -73,10 +48,6 @@ void CCActionInstant::update(float time) {
|
|||
// nothing
|
||||
}
|
||||
|
||||
CCFiniteTimeAction * CCActionInstant::reverse() {
|
||||
return (CCFiniteTimeAction*) (copy()->autorelease());
|
||||
}
|
||||
|
||||
//
|
||||
// Show
|
||||
//
|
||||
|
@ -97,13 +68,15 @@ void CCShow::update(float time) {
|
|||
_target->setVisible(true);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction* CCShow::reverse() {
|
||||
return (CCFiniteTimeAction*) (CCHide::create());
|
||||
CCActionInstant* CCShow::reverse() const
|
||||
{
|
||||
return CCHide::create();
|
||||
}
|
||||
|
||||
CCShow * CCShow::clone() const
|
||||
{
|
||||
auto a = new CCShow(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCShow();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -143,13 +116,15 @@ void CCHide::update(float time) {
|
|||
_target->setVisible(false);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction *CCHide::reverse() {
|
||||
return (CCFiniteTimeAction*) (CCShow::create());
|
||||
CCActionInstant *CCHide::reverse() const
|
||||
{
|
||||
return CCShow::create();
|
||||
}
|
||||
|
||||
CCHide * CCHide::clone() const
|
||||
{
|
||||
auto a = new CCHide(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCHide();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -191,9 +166,15 @@ void CCToggleVisibility::update(float time)
|
|||
_target->setVisible(!_target->isVisible());
|
||||
}
|
||||
|
||||
CCToggleVisibility * CCToggleVisibility::reverse() const
|
||||
{
|
||||
return CCToggleVisibility::create();
|
||||
}
|
||||
|
||||
CCToggleVisibility * CCToggleVisibility::clone() const
|
||||
{
|
||||
auto a = new CCToggleVisibility(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCToggleVisibility();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -239,13 +220,15 @@ void CCRemoveSelf::update(float time) {
|
|||
_target->removeFromParentAndCleanup(_isNeedCleanUp);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction *CCRemoveSelf::reverse() {
|
||||
return (CCFiniteTimeAction*) (CCRemoveSelf::create(_isNeedCleanUp));
|
||||
CCRemoveSelf *CCRemoveSelf::reverse() const
|
||||
{
|
||||
return CCRemoveSelf::create(_isNeedCleanUp);
|
||||
}
|
||||
|
||||
CCRemoveSelf * CCRemoveSelf::clone() const
|
||||
{
|
||||
auto a = new CCRemoveSelf(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCRemoveSelf();
|
||||
a->init(_isNeedCleanUp);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -295,13 +278,15 @@ void CCFlipX::update(float time) {
|
|||
((CCSprite*) (_target))->setFlipX(_flipX);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction* CCFlipX::reverse() {
|
||||
CCFlipX* CCFlipX::reverse() const
|
||||
{
|
||||
return CCFlipX::create(!_flipX);
|
||||
}
|
||||
|
||||
CCFlipX * CCFlipX::clone() const
|
||||
{
|
||||
auto a = new CCFlipX(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCFlipX();
|
||||
a->initWithFlipX(_flipX);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -351,13 +336,15 @@ void CCFlipY::update(float time) {
|
|||
((CCSprite*) (_target))->setFlipY(_flipY);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction* CCFlipY::reverse() {
|
||||
CCFlipY* CCFlipY::reverse() const
|
||||
{
|
||||
return CCFlipY::create(!_flipY);
|
||||
}
|
||||
|
||||
CCFlipY * CCFlipY::clone() const
|
||||
{
|
||||
auto a = new CCFlipY(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCFlipY();
|
||||
a->initWithFlipY(_flipY);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -404,12 +391,19 @@ bool CCPlace::initWithPosition(const CCPoint& pos) {
|
|||
|
||||
CCPlace * CCPlace::clone() const
|
||||
{
|
||||
auto a = new CCPlace(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCPlace();
|
||||
a->initWithPosition(_position);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCPlace * CCPlace::reverse() const
|
||||
{
|
||||
// no reverse, just clone
|
||||
return this->clone();
|
||||
}
|
||||
|
||||
CCObject * CCPlace::copyWithZone(CCZone *pZone) {
|
||||
CCZone *pNewZone = NULL;
|
||||
CCPlace *pRet = NULL;
|
||||
|
@ -509,7 +503,8 @@ CCCallFunc::~CCCallFunc(void)
|
|||
|
||||
CCCallFunc * CCCallFunc::clone() const
|
||||
{
|
||||
auto a = new CCCallFunc(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCallFunc();
|
||||
if( _selectorTarget) {
|
||||
a->initWithTarget(_selectorTarget);
|
||||
a->_callFunc = _callFunc;
|
||||
|
@ -521,6 +516,13 @@ CCCallFunc * CCCallFunc::clone() const
|
|||
return a;
|
||||
}
|
||||
|
||||
CCCallFunc * CCCallFunc::reverse() const
|
||||
{
|
||||
// no reverse here, just return a clone
|
||||
return this->clone();
|
||||
}
|
||||
|
||||
|
||||
CCObject * CCCallFunc::copyWithZone(CCZone *pZone) {
|
||||
CCZone* pNewZone = NULL;
|
||||
CCCallFunc* pRet = NULL;
|
||||
|
@ -615,7 +617,8 @@ bool CCCallFuncN::initWithTarget(CCObject* pSelectorTarget,
|
|||
|
||||
CCCallFuncN * CCCallFuncN::clone() const
|
||||
{
|
||||
auto a = new CCCallFuncN(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCallFuncN();
|
||||
a->initWithTarget(_selectorTarget, _callFuncN);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -669,7 +672,8 @@ bool CCCallFuncND::initWithTarget(CCObject* pSelectorTarget,
|
|||
|
||||
CCCallFuncND * CCCallFuncND::clone() const
|
||||
{
|
||||
auto a = new CCCallFuncND(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCallFuncND();
|
||||
a->initWithTarget(_selectorTarget, _callFuncND, _data);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -744,7 +748,8 @@ bool CCCallFuncO::initWithTarget(CCObject* pSelectorTarget,
|
|||
|
||||
CCCallFuncO * CCCallFuncO::clone() const
|
||||
{
|
||||
auto a = new CCCallFuncO(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCCallFuncO();
|
||||
a->initWithTarget(_selectorTarget, _callFuncO, _object);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
|
|
@ -50,13 +50,15 @@ class CC_DLL CCActionInstant : public CCFiniteTimeAction //<NSCopying>
|
|||
public:
|
||||
virtual ~CCActionInstant(){}
|
||||
// CCAction methods
|
||||
virtual CCActionInstant* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCActionInstant* clone() const = 0;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionInstant * reverse(void) const = 0;
|
||||
|
||||
virtual bool isDone(void);
|
||||
virtual void step(float dt);
|
||||
virtual void update(float time);
|
||||
//CCFiniteTimeAction method
|
||||
virtual CCFiniteTimeAction * reverse(void);
|
||||
};
|
||||
|
||||
/** @brief Show the node
|
||||
|
@ -68,8 +70,12 @@ public:
|
|||
virtual ~CCShow(){}
|
||||
//super methods
|
||||
virtual void update(float time);
|
||||
virtual CCFiniteTimeAction * reverse(void);
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionInstant * reverse(void) const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCShow* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
public:
|
||||
|
||||
|
@ -89,7 +95,9 @@ public:
|
|||
virtual ~CCHide(){}
|
||||
//super methods
|
||||
virtual void update(float time);
|
||||
virtual CCFiniteTimeAction * reverse(void);
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionInstant* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCHide* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
public:
|
||||
|
@ -107,6 +115,9 @@ public:
|
|||
virtual ~CCToggleVisibility(){}
|
||||
//super method
|
||||
virtual void update(float time);
|
||||
/** returns a new reversed action */
|
||||
virtual CCToggleVisibility* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCToggleVisibility* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
public:
|
||||
|
@ -125,8 +136,10 @@ public:
|
|||
virtual ~CCRemoveSelf(){}
|
||||
//super methods
|
||||
virtual void update(float time);
|
||||
virtual CCFiniteTimeAction * reverse(void);
|
||||
/** returns a new clone of the instance */
|
||||
virtual CCRemoveSelf* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCRemoveSelf* reverse() const;
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
public:
|
||||
/** create the action */
|
||||
|
@ -156,7 +169,9 @@ public:
|
|||
bool initWithFlipX(bool x);
|
||||
//super methods
|
||||
virtual void update(float time);
|
||||
virtual CCFiniteTimeAction * reverse(void);
|
||||
/** returns a new reversed action */
|
||||
virtual CCFlipX* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFlipX* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
|
||||
|
@ -183,7 +198,9 @@ public:
|
|||
bool initWithFlipY(bool y);
|
||||
//super methods
|
||||
virtual void update(float time);
|
||||
virtual CCFiniteTimeAction * reverse(void);
|
||||
/** returns a new reversed action */
|
||||
virtual CCFlipY* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFlipY* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
|
||||
|
@ -205,6 +222,9 @@ public:
|
|||
bool initWithPosition(const CCPoint& pos);
|
||||
//super methods
|
||||
virtual void update(float time);
|
||||
/** returns a new reversed action */
|
||||
virtual CCPlace* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCPlace* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
protected:
|
||||
|
@ -255,6 +275,9 @@ public:
|
|||
virtual void execute();
|
||||
//super methods
|
||||
virtual void update(float time);
|
||||
/** returns a new reversed action */
|
||||
virtual CCCallFunc* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCCallFunc* clone() const;
|
||||
CCObject * copyWithZone(CCZone *pZone);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
static ExtraAction* create();
|
||||
virtual ExtraAction* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual ExtraAction* reverse(void);
|
||||
virtual ExtraAction* reverse(void) const;
|
||||
virtual void update(float time);
|
||||
virtual void step(float dt);
|
||||
};
|
||||
|
@ -58,7 +58,8 @@ ExtraAction* ExtraAction::create()
|
|||
}
|
||||
ExtraAction* ExtraAction::clone(void) const
|
||||
{
|
||||
auto a = new ExtraAction(*this);
|
||||
// no copy constructor
|
||||
auto a = new ExtraAction();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -70,7 +71,7 @@ CCObject* ExtraAction::copyWithZone(CCZone* pZone)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ExtraAction* ExtraAction::reverse(void)
|
||||
ExtraAction* ExtraAction::reverse(void) const
|
||||
{
|
||||
return ExtraAction::create();
|
||||
}
|
||||
|
@ -88,14 +89,6 @@ void ExtraAction::step(float dt)
|
|||
//
|
||||
// IntervalAction
|
||||
//
|
||||
CCActionInterval* CCActionInterval::create(float d)
|
||||
{
|
||||
CCActionInterval *pAction = new CCActionInterval();
|
||||
pAction->initWithDuration(d);
|
||||
pAction->autorelease();
|
||||
|
||||
return pAction;
|
||||
}
|
||||
|
||||
bool CCActionInterval::initWithDuration(float d)
|
||||
{
|
||||
|
@ -115,39 +108,6 @@ bool CCActionInterval::initWithDuration(float d)
|
|||
return true;
|
||||
}
|
||||
|
||||
CCActionInterval* CCActionInterval::clone() const
|
||||
{
|
||||
auto a = new CCActionInterval(*this);
|
||||
a->initWithDuration(_duration);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCActionInterval::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
CCActionInterval* pCopy = NULL;
|
||||
if(pZone && pZone->_copyObject)
|
||||
{
|
||||
//in case of being called at sub class
|
||||
pCopy = (CCActionInterval*)(pZone->_copyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
pCopy = new CCActionInterval();
|
||||
pZone = pNewZone = new CCZone(pCopy);
|
||||
}
|
||||
|
||||
|
||||
CCFiniteTimeAction::copyWithZone(pZone);
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
|
||||
pCopy->initWithDuration(_duration);
|
||||
|
||||
return pCopy;
|
||||
}
|
||||
|
||||
bool CCActionInterval::isDone(void)
|
||||
{
|
||||
return _elapsed >= _duration;
|
||||
|
@ -195,12 +155,6 @@ void CCActionInterval::startWithTarget(CCNode *pTarget)
|
|||
_firstTick = true;
|
||||
}
|
||||
|
||||
CCActionInterval* CCActionInterval::reverse(void)
|
||||
{
|
||||
CCAssert(false, "CCIntervalAction: reverse not implemented.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Sequence
|
||||
//
|
||||
|
@ -300,7 +254,8 @@ bool CCSequence::initWithTwoActions(CCFiniteTimeAction *pActionOne, CCFiniteTime
|
|||
|
||||
CCSequence* CCSequence::clone(void) const
|
||||
{
|
||||
auto a = new CCSequence(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCSequence();
|
||||
a->initWithTwoActions((CCFiniteTimeAction*)(_actions[0]->clone()),
|
||||
(CCFiniteTimeAction*)(_actions[1]->clone())
|
||||
);
|
||||
|
@ -325,8 +280,7 @@ CCObject* CCSequence::copyWithZone(CCZone *pZone)
|
|||
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
|
||||
pCopy->initWithTwoActions((CCFiniteTimeAction*)(_actions[0]->copy()->autorelease()),
|
||||
(CCFiniteTimeAction*)(_actions[1]->copy()->autorelease()));
|
||||
pCopy->initWithTwoActions(_actions[0]->clone(), _actions[1]->clone());
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
|
@ -418,7 +372,7 @@ void CCSequence::update(float t)
|
|||
_last = found;
|
||||
}
|
||||
|
||||
CCActionInterval* CCSequence::reverse(void)
|
||||
CCSequence* CCSequence::reverse() const
|
||||
{
|
||||
return CCSequence::createWithTwoActions(_actions[1]->reverse(), _actions[0]->reverse());
|
||||
}
|
||||
|
@ -462,7 +416,8 @@ bool CCRepeat::initWithAction(CCFiniteTimeAction *pAction, unsigned int times)
|
|||
|
||||
CCRepeat* CCRepeat::clone(void) const
|
||||
{
|
||||
auto a = new CCRepeat(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCRepeat();
|
||||
a->initWithAction((CCFiniteTimeAction*)_innerAction->clone(), _times );
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -487,7 +442,7 @@ CCObject* CCRepeat::copyWithZone(CCZone *pZone)
|
|||
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
|
||||
pCopy->initWithAction((CCFiniteTimeAction*)(_innerAction->copy()->autorelease()), _times);
|
||||
pCopy->initWithAction(_innerAction->clone(), _times);
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
|
@ -561,7 +516,7 @@ bool CCRepeat::isDone(void)
|
|||
return _total == _times;
|
||||
}
|
||||
|
||||
CCActionInterval* CCRepeat::reverse(void)
|
||||
CCRepeat* CCRepeat::reverse() const
|
||||
{
|
||||
return CCRepeat::create(_innerAction->reverse(), _times);
|
||||
}
|
||||
|
@ -596,7 +551,8 @@ bool CCRepeatForever::initWithAction(CCActionInterval *pAction)
|
|||
|
||||
CCRepeatForever *CCRepeatForever::clone(void) const
|
||||
{
|
||||
auto a = new CCRepeatForever(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCRepeatForever();
|
||||
a->initWithAction((CCActionInterval*)_innerAction->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -617,7 +573,7 @@ CCObject* CCRepeatForever::copyWithZone(CCZone *pZone)
|
|||
}
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
// win32 : use the _other's copy object.
|
||||
pRet->initWithAction((CCActionInterval*)(_innerAction->copy()->autorelease()));
|
||||
pRet->initWithAction(_innerAction->clone());
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
@ -646,9 +602,9 @@ bool CCRepeatForever::isDone()
|
|||
return false;
|
||||
}
|
||||
|
||||
CCActionInterval *CCRepeatForever::reverse()
|
||||
CCRepeatForever *CCRepeatForever::reverse() const
|
||||
{
|
||||
return (CCActionInterval*)(CCRepeatForever::create(_innerAction->reverse()));
|
||||
return CCRepeatForever::create(_innerAction->reverse());
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -766,9 +722,9 @@ bool CCSpawn:: initWithTwoActions(CCFiniteTimeAction *pAction1, CCFiniteTimeActi
|
|||
|
||||
CCSpawn* CCSpawn::clone(void) const
|
||||
{
|
||||
auto a = new CCSpawn(*this);
|
||||
a->initWithTwoActions((CCFiniteTimeAction*)_one->clone(),
|
||||
(CCFiniteTimeAction*)_two->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCSpawn();
|
||||
a->initWithTwoActions(_one->clone(), _two->clone());
|
||||
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -792,8 +748,7 @@ CCObject* CCSpawn::copyWithZone(CCZone *pZone)
|
|||
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
|
||||
pCopy->initWithTwoActions((CCFiniteTimeAction*)(_one->copy()->autorelease()),
|
||||
(CCFiniteTimeAction*)(_two->copy()->autorelease()));
|
||||
pCopy->initWithTwoActions(_one->clone(), _two->clone());
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
|
@ -831,7 +786,7 @@ void CCSpawn::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCSpawn::reverse(void)
|
||||
CCSpawn* CCSpawn::reverse() const
|
||||
{
|
||||
return CCSpawn::createWithTwoActions(_one->reverse(), _two->reverse());
|
||||
}
|
||||
|
@ -884,7 +839,8 @@ bool CCRotateTo::initWithDuration(float fDuration, float fDeltaAngleX, float fDe
|
|||
|
||||
CCRotateTo* CCRotateTo::clone(void) const
|
||||
{
|
||||
auto a = new CCRotateTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCRotateTo();
|
||||
a->initWithDuration(_duration, _dstAngleX, _dstAngleY);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -972,6 +928,12 @@ void CCRotateTo::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCRotateTo *CCRotateTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "RotateTo doesn't support the 'reverse' method");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//
|
||||
// RotateBy
|
||||
//
|
||||
|
@ -1019,7 +981,8 @@ bool CCRotateBy::initWithDuration(float fDuration, float fDeltaAngleX, float fDe
|
|||
|
||||
CCRotateBy* CCRotateBy::clone(void) const
|
||||
{
|
||||
auto a = new CCRotateBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCRotateBy();
|
||||
a->initWithDuration(_duration, _angleX, _angleY);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1065,7 +1028,7 @@ void CCRotateBy::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCRotateBy::reverse(void)
|
||||
CCRotateBy* CCRotateBy::reverse() const
|
||||
{
|
||||
return CCRotateBy::create(_duration, -_angleX, -_angleY);
|
||||
}
|
||||
|
@ -1096,7 +1059,8 @@ bool CCMoveBy::initWithDuration(float duration, const CCPoint& deltaPosition)
|
|||
|
||||
CCMoveBy* CCMoveBy::clone(void) const
|
||||
{
|
||||
auto a = new CCMoveBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCMoveBy();
|
||||
a->initWithDuration(_duration, _positionDelta);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1131,7 +1095,7 @@ void CCMoveBy::startWithTarget(CCNode *pTarget)
|
|||
_previousPosition = _startPosition = pTarget->getPosition();
|
||||
}
|
||||
|
||||
CCActionInterval* CCMoveBy::reverse(void)
|
||||
CCMoveBy* CCMoveBy::reverse() const
|
||||
{
|
||||
return CCMoveBy::create(_duration, ccp( -_positionDelta.x, -_positionDelta.y));
|
||||
}
|
||||
|
@ -1180,7 +1144,8 @@ bool CCMoveTo::initWithDuration(float duration, const CCPoint& position)
|
|||
|
||||
CCMoveTo* CCMoveTo::clone(void) const
|
||||
{
|
||||
auto a = new CCMoveTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCMoveTo();
|
||||
a->initWithDuration(_duration, _endPosition);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1254,12 +1219,19 @@ bool CCSkewTo::initWithDuration(float t, float sx, float sy)
|
|||
|
||||
CCSkewTo* CCSkewTo::clone(void) const
|
||||
{
|
||||
auto a = new CCSkewTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCSkewTo();
|
||||
a->initWithDuration(_duration, _endSkewX, _endSkewY);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCSkewTo* CCSkewTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() not supported in CCSkewTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCObject* CCSkewTo::copyWithZone(CCZone* pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -1371,6 +1343,15 @@ CCSkewBy* CCSkewBy::create(float t, float sx, float sy)
|
|||
return pSkewBy;
|
||||
}
|
||||
|
||||
CCSkewBy * CCSkewBy::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCSkewBy();
|
||||
a->initWithDuration(_duration, _skewX, _skewY);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
bool CCSkewBy::initWithDuration(float t, float deltaSkewX, float deltaSkewY)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
@ -1395,9 +1376,9 @@ void CCSkewBy::startWithTarget(CCNode *pTarget)
|
|||
_endSkewY = _startSkewY + _deltaY;
|
||||
}
|
||||
|
||||
CCActionInterval* CCSkewBy::reverse()
|
||||
CCSkewBy* CCSkewBy::reverse() const
|
||||
{
|
||||
return create(_duration, -_skewX, -_skewY);
|
||||
return CCSkewBy::create(_duration, -_skewX, -_skewY);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1429,7 +1410,8 @@ bool CCJumpBy::initWithDuration(float duration, const CCPoint& position, float h
|
|||
|
||||
CCJumpBy* CCJumpBy::clone(void) const
|
||||
{
|
||||
auto a = new CCJumpBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCJumpBy();
|
||||
a->initWithDuration(_duration, _delta, _height, _jumps);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1490,7 +1472,7 @@ void CCJumpBy::update(float t)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCJumpBy::reverse(void)
|
||||
CCJumpBy* CCJumpBy::reverse() const
|
||||
{
|
||||
return CCJumpBy::create(_duration, ccp(-_delta.x, -_delta.y),
|
||||
_height, _jumps);
|
||||
|
@ -1511,12 +1493,19 @@ CCJumpTo* CCJumpTo::create(float duration, const CCPoint& position, float height
|
|||
|
||||
CCJumpTo* CCJumpTo::clone(void) const
|
||||
{
|
||||
auto a = new CCJumpTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCJumpTo();
|
||||
a->initWithDuration(_duration, _delta, _height, _jumps);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCJumpTo* CCJumpTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() not supported in CCJumpTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCObject* CCJumpTo::copyWithZone(CCZone* pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -1590,7 +1579,8 @@ void CCBezierBy::startWithTarget(CCNode *pTarget)
|
|||
|
||||
CCBezierBy* CCBezierBy::clone(void) const
|
||||
{
|
||||
auto a = new CCBezierBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCBezierBy();
|
||||
a->initWithDuration(_duration, _config);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1651,7 +1641,7 @@ void CCBezierBy::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCBezierBy::reverse(void)
|
||||
CCBezierBy* CCBezierBy::reverse(void) const
|
||||
{
|
||||
ccBezierConfig r;
|
||||
|
||||
|
@ -1690,7 +1680,8 @@ bool CCBezierTo::initWithDuration(float t, const ccBezierConfig &c)
|
|||
|
||||
CCBezierTo* CCBezierTo::clone(void) const
|
||||
{
|
||||
auto a = new CCBezierTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCBezierTo();
|
||||
a->initWithDuration(_duration, _config);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1727,6 +1718,13 @@ void CCBezierTo::startWithTarget(CCNode *pTarget)
|
|||
_config.endPosition = ccpSub(_toConfig.endPosition, _startPosition);
|
||||
}
|
||||
|
||||
CCBezierTo* CCBezierTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "CCBezierTo doesn't support the 'reverse' method");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ScaleTo
|
||||
//
|
||||
|
@ -1739,6 +1737,15 @@ CCScaleTo* CCScaleTo::create(float duration, float s)
|
|||
return pScaleTo;
|
||||
}
|
||||
|
||||
CCScaleTo* CCScaleTo::create(float duration, float sx, float sy)
|
||||
{
|
||||
CCScaleTo *pScaleTo = new CCScaleTo();
|
||||
pScaleTo->initWithDuration(duration, sx, sy);
|
||||
pScaleTo->autorelease();
|
||||
|
||||
return pScaleTo;
|
||||
}
|
||||
|
||||
bool CCScaleTo::initWithDuration(float duration, float s)
|
||||
{
|
||||
if (CCActionInterval::initWithDuration(duration))
|
||||
|
@ -1752,15 +1759,6 @@ bool CCScaleTo::initWithDuration(float duration, float s)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCScaleTo* CCScaleTo::create(float duration, float sx, float sy)
|
||||
{
|
||||
CCScaleTo *pScaleTo = new CCScaleTo();
|
||||
pScaleTo->initWithDuration(duration, sx, sy);
|
||||
pScaleTo->autorelease();
|
||||
|
||||
return pScaleTo;
|
||||
}
|
||||
|
||||
bool CCScaleTo::initWithDuration(float duration, float sx, float sy)
|
||||
{
|
||||
if (CCActionInterval::initWithDuration(duration))
|
||||
|
@ -1776,12 +1774,20 @@ bool CCScaleTo::initWithDuration(float duration, float sx, float sy)
|
|||
|
||||
CCScaleTo* CCScaleTo::clone(void) const
|
||||
{
|
||||
auto a = new CCScaleTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCScaleTo();
|
||||
a->initWithDuration(_duration, _endScaleX, _endScaleY);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCScaleTo* CCScaleTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() not supported in CCScaleTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
CCObject* CCScaleTo::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -1848,7 +1854,8 @@ CCScaleBy* CCScaleBy::create(float duration, float sx, float sy)
|
|||
|
||||
CCScaleBy* CCScaleBy::clone(void) const
|
||||
{
|
||||
auto a = new CCScaleBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCScaleBy();
|
||||
a->initWithDuration(_duration, _endScaleX, _endScaleY);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1885,7 +1892,7 @@ void CCScaleBy::startWithTarget(CCNode *pTarget)
|
|||
_deltaY = _startScaleY * _endScaleY - _startScaleY;
|
||||
}
|
||||
|
||||
CCActionInterval* CCScaleBy::reverse(void)
|
||||
CCScaleBy* CCScaleBy::reverse() const
|
||||
{
|
||||
return CCScaleBy::create(_duration, 1 / _endScaleX, 1 / _endScaleY);
|
||||
}
|
||||
|
@ -1928,7 +1935,8 @@ void CCBlink::startWithTarget(CCNode *pTarget)
|
|||
|
||||
CCBlink* CCBlink::clone(void) const
|
||||
{
|
||||
auto a = new CCBlink(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCBlink();
|
||||
a->initWithDuration(_duration, (unsigned int)_times);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -1968,9 +1976,8 @@ void CCBlink::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCBlink::reverse(void)
|
||||
CCBlink* CCBlink::reverse() const
|
||||
{
|
||||
// return 'self'
|
||||
return CCBlink::create(_duration, _times);
|
||||
}
|
||||
|
||||
|
@ -1988,9 +1995,10 @@ CCFadeIn* CCFadeIn::create(float d)
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCFadeIn* CCFadeIn::clone(void) const
|
||||
CCFadeIn* CCFadeIn::clone() const
|
||||
{
|
||||
auto a = new CCFadeIn(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCFadeIn();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -2027,7 +2035,7 @@ void CCFadeIn::update(float time)
|
|||
/*_target->setOpacity((GLubyte)(255 * time));*/
|
||||
}
|
||||
|
||||
CCActionInterval* CCFadeIn::reverse(void)
|
||||
CCActionInterval* CCFadeIn::reverse() const
|
||||
{
|
||||
return CCFadeOut::create(_duration);
|
||||
}
|
||||
|
@ -2046,9 +2054,10 @@ CCFadeOut* CCFadeOut::create(float d)
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCFadeOut* CCFadeOut::clone(void) const
|
||||
CCFadeOut* CCFadeOut::clone() const
|
||||
{
|
||||
auto a = new CCFadeOut(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCFadeOut();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -2085,7 +2094,7 @@ void CCFadeOut::update(float time)
|
|||
/*_target->setOpacity(GLubyte(255 * (1 - time)));*/
|
||||
}
|
||||
|
||||
CCActionInterval* CCFadeOut::reverse(void)
|
||||
CCActionInterval* CCFadeOut::reverse() const
|
||||
{
|
||||
return CCFadeIn::create(_duration);
|
||||
}
|
||||
|
@ -2114,14 +2123,21 @@ bool CCFadeTo::initWithDuration(float duration, GLubyte opacity)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCFadeTo* CCFadeTo::clone(void) const
|
||||
CCFadeTo* CCFadeTo::clone() const
|
||||
{
|
||||
auto a = new CCFadeTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCFadeTo();
|
||||
a->initWithDuration(_duration, _toOpacity);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCFadeTo* CCFadeTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() not supported in CCFadeTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCObject* CCFadeTo::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -2190,14 +2206,21 @@ bool CCTintTo::initWithDuration(float duration, GLubyte red, GLubyte green, GLub
|
|||
return false;
|
||||
}
|
||||
|
||||
CCTintTo* CCTintTo::clone(void) const
|
||||
CCTintTo* CCTintTo::clone() const
|
||||
{
|
||||
auto a = new CCTintTo(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCTintTo();
|
||||
a->initWithDuration(_duration, _to.r, _to.g, _to.b);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCTintTo* CCTintTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() not supported in CCTintTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCObject* CCTintTo::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -2270,9 +2293,10 @@ bool CCTintBy::initWithDuration(float duration, GLshort deltaRed, GLshort deltaG
|
|||
return false;
|
||||
}
|
||||
|
||||
CCTintBy* CCTintBy::clone(void) const
|
||||
CCTintBy* CCTintBy::clone() const
|
||||
{
|
||||
auto a = new CCTintBy(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCTintBy();
|
||||
a->initWithDuration(_duration, (GLubyte)_deltaR, (GLubyte)_deltaG, (GLubyte)_deltaB);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -2326,7 +2350,7 @@ void CCTintBy::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCTintBy::reverse(void)
|
||||
CCTintBy* CCTintBy::reverse() const
|
||||
{
|
||||
return CCTintBy::create(_duration, -_deltaR, -_deltaG, -_deltaB);
|
||||
}
|
||||
|
@ -2344,9 +2368,10 @@ CCDelayTime* CCDelayTime::create(float d)
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCDelayTime* CCDelayTime::clone(void) const
|
||||
CCDelayTime* CCDelayTime::clone() const
|
||||
{
|
||||
auto a = new CCDelayTime(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCDelayTime();
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -2379,7 +2404,7 @@ void CCDelayTime::update(float time)
|
|||
return;
|
||||
}
|
||||
|
||||
CCActionInterval* CCDelayTime::reverse(void)
|
||||
CCDelayTime* CCDelayTime::reverse() const
|
||||
{
|
||||
return CCDelayTime::create(_duration);
|
||||
}
|
||||
|
@ -2392,7 +2417,7 @@ CCReverseTime* CCReverseTime::create(CCFiniteTimeAction *pAction)
|
|||
{
|
||||
// casting to prevent warnings
|
||||
CCReverseTime *pReverseTime = new CCReverseTime();
|
||||
pReverseTime->initWithAction(pAction);
|
||||
pReverseTime->initWithAction( pAction->clone() );
|
||||
pReverseTime->autorelease();
|
||||
|
||||
return pReverseTime;
|
||||
|
@ -2417,10 +2442,11 @@ bool CCReverseTime::initWithAction(CCFiniteTimeAction *pAction)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCReverseTime* CCReverseTime::clone(void) const
|
||||
CCReverseTime* CCReverseTime::clone() const
|
||||
{
|
||||
auto a = new CCReverseTime(*this);
|
||||
a->initWithAction((CCFiniteTimeAction*)_other->clone());
|
||||
// no copy constructor
|
||||
auto a = new CCReverseTime();
|
||||
a->initWithAction( _other->clone() );
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -2442,7 +2468,7 @@ CCObject* CCReverseTime::copyWithZone(CCZone *pZone)
|
|||
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
|
||||
pCopy->initWithAction((CCFiniteTimeAction*)(_other->copy()->autorelease()));
|
||||
pCopy->initWithAction(_other->clone());
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
|
@ -2478,9 +2504,9 @@ void CCReverseTime::update(float time)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCReverseTime::reverse(void)
|
||||
CCReverseTime* CCReverseTime::reverse() const
|
||||
{
|
||||
return (CCActionInterval*)(_other->copy()->autorelease());
|
||||
return (CCReverseTime*)_other->clone();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2529,10 +2555,11 @@ bool CCAnimate::initWithAnimation(CCAnimation *pAnimation)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCAnimate* CCAnimate::clone(void) const
|
||||
CCAnimate* CCAnimate::clone() const
|
||||
{
|
||||
auto a = new CCAnimate(*this);
|
||||
a->initWithAnimation((CCAnimation*)_animation->copy()->autorelease());
|
||||
// no copy constructor
|
||||
auto a = new CCAnimate();
|
||||
a->initWithAnimation(_animation->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
@ -2554,7 +2581,7 @@ CCObject* CCAnimate::copyWithZone(CCZone *pZone)
|
|||
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
|
||||
pCopy->initWithAnimation((CCAnimation*)_animation->copy()->autorelease());
|
||||
pCopy->initWithAnimation(_animation->clone());
|
||||
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pCopy;
|
||||
|
@ -2646,7 +2673,7 @@ void CCAnimate::update(float t)
|
|||
}
|
||||
}
|
||||
|
||||
CCActionInterval* CCAnimate::reverse(void)
|
||||
CCAnimate* CCAnimate::reverse() const
|
||||
{
|
||||
CCArray* pOldArray = _animation->getFrames();
|
||||
CCArray* pNewArray = CCArray::createWithCapacity(pOldArray->count());
|
||||
|
@ -2664,13 +2691,13 @@ CCActionInterval* CCAnimate::reverse(void)
|
|||
break;
|
||||
}
|
||||
|
||||
pNewArray->addObject((CCAnimationFrame*)(pElement->copy()->autorelease()));
|
||||
pNewArray->addObject(pElement->clone());
|
||||
}
|
||||
}
|
||||
|
||||
CCAnimation *newAnim = CCAnimation::create(pNewArray, _animation->getDelayPerUnit(), _animation->getLoops());
|
||||
newAnim->setRestoreOriginalFrame(_animation->getRestoreOriginalFrame());
|
||||
return create(newAnim);
|
||||
return CCAnimate::create(newAnim);
|
||||
}
|
||||
|
||||
// CCTargetedAction
|
||||
|
@ -2710,15 +2737,22 @@ bool CCTargetedAction::initWithTarget(CCNode* pTarget, CCFiniteTimeAction* pActi
|
|||
return false;
|
||||
}
|
||||
|
||||
CCTargetedAction* CCTargetedAction::clone(void) const
|
||||
CCTargetedAction* CCTargetedAction::clone() const
|
||||
{
|
||||
auto a = new CCTargetedAction(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCTargetedAction();
|
||||
// win32 : use the _other's copy object.
|
||||
a->initWithTarget(_forcedTarget, (CCFiniteTimeAction*)_action->clone());
|
||||
a->initWithTarget(_forcedTarget, _action->clone());
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCTargetedAction* CCTargetedAction::reverse(void) const
|
||||
{
|
||||
// no reverse for this action, just clone it
|
||||
return this->clone();
|
||||
}
|
||||
|
||||
CCObject* CCTargetedAction::copyWithZone(CCZone* pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -2734,7 +2768,7 @@ CCObject* CCTargetedAction::copyWithZone(CCZone* pZone)
|
|||
}
|
||||
CCActionInterval::copyWithZone(pZone);
|
||||
// win32 : use the _other's copy object.
|
||||
pRet->initWithTarget(_forcedTarget, (CCFiniteTimeAction*)_action->copy()->autorelease());
|
||||
pRet->initWithTarget(_forcedTarget, _action->clone());
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
|
|
@ -70,19 +70,13 @@ public:
|
|||
/** returns true if the action has finished */
|
||||
virtual bool isDone(void);
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCActionInterval* clone() const;
|
||||
|
||||
virtual void step(float dt);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
|
||||
/** returns a reversed action */
|
||||
virtual CCActionInterval* reverse(void);
|
||||
virtual CCActionInterval* reverse() const = 0;
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action */
|
||||
static CCActionInterval* create(float d);
|
||||
virtual CCActionInterval *clone() const = 0;
|
||||
|
||||
public:
|
||||
//extension in CCGridAction
|
||||
|
@ -108,10 +102,12 @@ public:
|
|||
/** returns a new clone of the action */
|
||||
virtual CCSequence* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCSequence* reverse() const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
virtual void update(float t);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -145,11 +141,13 @@ public:
|
|||
/** returns a new clone of the action */
|
||||
virtual CCRepeat* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCRepeat* reverse() const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
virtual void update(float dt);
|
||||
virtual bool isDone(void);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
inline void setInnerAction(CCFiniteTimeAction *pAction)
|
||||
{
|
||||
|
@ -196,10 +194,13 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCRepeatForever* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCRepeatForever* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode* pTarget);
|
||||
virtual void step(float dt);
|
||||
virtual bool isDone(void);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
inline void setInnerAction(CCActionInterval *pAction)
|
||||
{
|
||||
|
@ -238,10 +239,13 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCSpawn* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCSpawn* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -279,9 +283,13 @@ public:
|
|||
virtual bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCRotateTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCRotateTo* reverse() const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -312,9 +320,12 @@ public:
|
|||
/** returns a new clone of the action */
|
||||
virtual CCRotateBy* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCRotateBy* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
|
||||
protected:
|
||||
float _angleX;
|
||||
|
@ -339,8 +350,11 @@ public:
|
|||
/** returns a new clone of the action */
|
||||
virtual CCMoveBy* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCMoveBy* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
@ -387,6 +401,8 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCSkewTo* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCSkewTo* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
@ -414,7 +430,12 @@ class CC_DLL CCSkewBy : public CCSkewTo
|
|||
public:
|
||||
virtual bool initWithDuration(float t, float sx, float sy);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCSkewBy* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCSkewBy* reverse(void) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -433,10 +454,11 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCJumpBy* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCJumpBy* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
/** creates the action */
|
||||
|
@ -458,6 +480,8 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCJumpTo* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCJumpTo* reverse(void) const;
|
||||
|
||||
public:
|
||||
/** creates the action */
|
||||
|
@ -486,10 +510,11 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBezierBy* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCBezierBy* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
/** creates the action with a duration and a bezier configuration */
|
||||
|
@ -510,6 +535,8 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBezierTo* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCBezierTo* reverse(void) const;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -536,6 +563,8 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCScaleTo* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCScaleTo* reverse(void) const;
|
||||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
@ -564,9 +593,11 @@ class CC_DLL CCScaleBy : public CCScaleTo
|
|||
{
|
||||
public:
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCScaleBy* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCScaleBy* reverse(void) const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -588,9 +619,11 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBlink* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCBlink* reverse(void) const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -612,9 +645,12 @@ class CC_DLL CCFadeIn : public CCActionInterval
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFadeIn* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionInterval* reverse(void) const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -629,10 +665,12 @@ class CC_DLL CCFadeOut : public CCActionInterval
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFadeOut* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCActionInterval* reverse(void) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -651,6 +689,9 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFadeTo* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCFadeTo* reverse(void) const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
@ -675,6 +716,9 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCTintTo* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCTintTo* reverse(void) const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
@ -698,10 +742,12 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCTintBy* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCTintBy* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
/** creates an action with duration and color */
|
||||
|
@ -722,7 +768,8 @@ class CC_DLL CCDelayTime : public CCActionInterval
|
|||
{
|
||||
public:
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
/** returns a new reversed action */
|
||||
virtual CCDelayTime* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCDelayTime* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
@ -749,13 +796,14 @@ public:
|
|||
/** initializes the action */
|
||||
bool initWithAction(CCFiniteTimeAction *pAction);
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCReverseTime* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
virtual CCReverseTime* clone() const;
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
virtual void update(float time);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
public:
|
||||
/** creates the action */
|
||||
|
@ -777,11 +825,15 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCAnimate* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCAnimate* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
virtual void update(float t);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
|
||||
|
||||
|
||||
public:
|
||||
/** creates the action with an Animation and will restore the original frame when the animation is over */
|
||||
|
@ -811,6 +863,9 @@ public:
|
|||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCTargetedAction* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual CCTargetedAction* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void stop(void);
|
||||
|
|
|
@ -47,6 +47,15 @@ CCPageTurn3D* CCPageTurn3D::create(float duration, const CCSize& gridSize)
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCPageTurn3D *CCPageTurn3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCPageTurn3D();
|
||||
a->initWithDuration(_duration, _gridSize);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update each tick
|
||||
* Time is the percentage of the way through the duration
|
||||
|
|
|
@ -46,6 +46,9 @@ NS_CC_BEGIN
|
|||
class CC_DLL CCPageTurn3D : public CCGrid3DAction
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual CCPageTurn3D* clone() const;
|
||||
|
||||
virtual void update(float time);
|
||||
|
||||
public:
|
||||
|
|
|
@ -53,6 +53,21 @@ bool CCProgressTo::initWithDuration(float duration, float fPercent)
|
|||
return false;
|
||||
}
|
||||
|
||||
CCProgressTo* CCProgressTo::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCProgressTo();
|
||||
a->initWithDuration(_duration, _to);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCProgressTo* CCProgressTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() not supported in CCProgressTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCObject* CCProgressTo::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -118,6 +133,15 @@ bool CCProgressFromTo::initWithDuration(float duration, float fFromPercentage, f
|
|||
return false;
|
||||
}
|
||||
|
||||
CCProgressFromTo* CCProgressFromTo::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCProgressFromTo();
|
||||
a->initWithDuration(_duration, _from, _to);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCProgressFromTo::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -141,7 +165,7 @@ CCObject* CCProgressFromTo::copyWithZone(CCZone *pZone)
|
|||
return pCopy;
|
||||
}
|
||||
|
||||
CCActionInterval* CCProgressFromTo::reverse(void)
|
||||
CCProgressFromTo* CCProgressFromTo::reverse(void) const
|
||||
{
|
||||
return CCProgressFromTo::create(_duration, _to, _from);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,12 @@ public:
|
|||
/** Initializes with a duration and a percent */
|
||||
bool initWithDuration(float duration, float fPercent);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCProgressTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCProgressTo* reverse(void) const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
@ -66,8 +72,13 @@ public:
|
|||
/** Initializes the action with a duration, a "from" percentage and a "to" percentage */
|
||||
bool initWithDuration(float duration, float fFromPercentage, float fToPercentage);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCProgressFromTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCProgressFromTo* reverse(void) const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
virtual CCActionInterval* reverse(void);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
||||
|
|
|
@ -73,6 +73,15 @@ bool CCShakyTiles3D::initWithDuration(float duration, const CCSize& gridSize, in
|
|||
return false;
|
||||
}
|
||||
|
||||
CCShakyTiles3D* CCShakyTiles3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCShakyTiles3D();
|
||||
a->initWithDuration(_duration, _gridSize, _randrange, _shakeZ);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCShakyTiles3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -167,6 +176,15 @@ bool CCShatteredTiles3D::initWithDuration(float duration, const CCSize& gridSize
|
|||
return false;
|
||||
}
|
||||
|
||||
CCShatteredTiles3D* CCShatteredTiles3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCShatteredTiles3D();
|
||||
a->initWithDuration(_duration, _gridSize, _randrange, _shatterZ);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCShatteredTiles3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -266,6 +284,15 @@ bool CCShuffleTiles::initWithDuration(float duration, const CCSize& gridSize, un
|
|||
return false;
|
||||
}
|
||||
|
||||
CCShuffleTiles* CCShuffleTiles::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCShuffleTiles();
|
||||
a->initWithDuration(_duration, _gridSize, _seed);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCShuffleTiles::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -416,6 +443,15 @@ CCFadeOutTRTiles* CCFadeOutTRTiles::create(float duration, const CCSize& gridSiz
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCFadeOutTRTiles* CCFadeOutTRTiles::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCFadeOutTRTiles();
|
||||
a->initWithDuration(_duration, _gridSize);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
float CCFadeOutTRTiles::testFunc(const CCSize& pos, float time)
|
||||
{
|
||||
CCPoint n = ccpMult(ccp((float)_gridSize.width, (float)_gridSize.height), time);
|
||||
|
@ -505,6 +541,15 @@ CCFadeOutBLTiles* CCFadeOutBLTiles::create(float duration, const CCSize& gridSiz
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCFadeOutBLTiles* CCFadeOutBLTiles::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCFadeOutBLTiles();
|
||||
a->initWithDuration(_duration, _gridSize);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
float CCFadeOutBLTiles::testFunc(const CCSize& pos, float time)
|
||||
{
|
||||
CCPoint n = ccpMult(ccp((float)_gridSize.width, (float)_gridSize.height), (1.0f - time));
|
||||
|
@ -537,6 +582,15 @@ CCFadeOutUpTiles* CCFadeOutUpTiles::create(float duration, const CCSize& gridSiz
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCFadeOutUpTiles* CCFadeOutUpTiles::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCFadeOutUpTiles();
|
||||
a->initWithDuration(_duration, _gridSize);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
float CCFadeOutUpTiles::testFunc(const CCSize& pos, float time)
|
||||
{
|
||||
CCPoint n = ccpMult(ccp((float)_gridSize.width, (float)_gridSize.height), time);
|
||||
|
@ -582,6 +636,15 @@ CCFadeOutDownTiles* CCFadeOutDownTiles::create(float duration, const CCSize& gri
|
|||
return pAction;
|
||||
}
|
||||
|
||||
CCFadeOutDownTiles* CCFadeOutDownTiles::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCFadeOutDownTiles();
|
||||
a->initWithDuration(_duration, _gridSize);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
float CCFadeOutDownTiles::testFunc(const CCSize& pos, float time)
|
||||
{
|
||||
CCPoint n = ccpMult(ccp((float)_gridSize.width, (float)_gridSize.height), (1.0f - time));
|
||||
|
@ -641,6 +704,15 @@ bool CCTurnOffTiles::initWithDuration(float duration, const CCSize& gridSize, un
|
|||
return false;
|
||||
}
|
||||
|
||||
CCTurnOffTiles* CCTurnOffTiles::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCTurnOffTiles();
|
||||
a->initWithDuration(_duration, _gridSize, _seed );
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCTurnOffTiles::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -772,6 +844,15 @@ bool CCWavesTiles3D::initWithDuration(float duration, const CCSize& gridSize, un
|
|||
return false;
|
||||
}
|
||||
|
||||
CCWavesTiles3D* CCWavesTiles3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCWavesTiles3D();
|
||||
a->initWithDuration(_duration, _gridSize, _waves, _amplitude);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCWavesTiles3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -850,6 +931,15 @@ bool CCJumpTiles3D::initWithDuration(float duration, const CCSize& gridSize, uns
|
|||
return false;
|
||||
}
|
||||
|
||||
CCJumpTiles3D* CCJumpTiles3D::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCJumpTiles3D();
|
||||
a->initWithDuration(_duration, _gridSize, _jumps, _amplitude);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCJumpTiles3D::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -932,6 +1022,15 @@ bool CCSplitRows::initWithDuration(float duration, unsigned int nRows)
|
|||
return CCTiledGrid3DAction::initWithDuration(duration, CCSizeMake(1, nRows));
|
||||
}
|
||||
|
||||
CCSplitRows* CCSplitRows::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCSplitRows();
|
||||
a->initWithDuration(_duration, _rows);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCSplitRows::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -1010,6 +1109,15 @@ bool CCSplitCols::initWithDuration(float duration, unsigned int nCols)
|
|||
return CCTiledGrid3DAction::initWithDuration(duration, CCSizeMake(nCols, 1));
|
||||
}
|
||||
|
||||
CCSplitCols* CCSplitCols::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCSplitCols();
|
||||
a->initWithDuration(_duration, _cols);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCSplitCols::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||
virtual bool initWithDuration(float duration, const CCSize& gridSize, int nRange, bool bShakeZ);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCShakyTiles3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -61,6 +64,9 @@ public:
|
|||
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
||||
virtual bool initWithDuration(float duration, const CCSize& gridSize, int nRange, bool bShatterZ);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCShatteredTiles3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -90,6 +96,10 @@ public:
|
|||
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCShuffleTiles* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
public:
|
||||
|
@ -114,6 +124,9 @@ public:
|
|||
virtual void transformTile(const CCPoint& pos, float distance);
|
||||
virtual void update(float time);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFadeOutTRTiles* clone() const;
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the grid size and the duration */
|
||||
|
@ -128,6 +141,9 @@ class CC_DLL CCFadeOutBLTiles : public CCFadeOutTRTiles
|
|||
public:
|
||||
virtual float testFunc(const CCSize& pos, float time);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFadeOutBLTiles* clone() const;
|
||||
|
||||
public:
|
||||
|
||||
/** creates the action with the grid size and the duration */
|
||||
|
@ -143,6 +159,9 @@ public:
|
|||
virtual float testFunc(const CCSize& pos, float time);
|
||||
virtual void transformTile(const CCPoint& pos, float distance);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFadeOutUpTiles* clone() const;
|
||||
|
||||
public:
|
||||
/** creates the action with the grid size and the duration */
|
||||
static CCFadeOutUpTiles* create(float duration, const CCSize& gridSize);
|
||||
|
@ -155,6 +174,9 @@ public:
|
|||
class CC_DLL CCFadeOutDownTiles : public CCFadeOutUpTiles
|
||||
{
|
||||
public:
|
||||
/** returns a new clone of the action */
|
||||
virtual CCFadeOutDownTiles* clone() const;
|
||||
|
||||
virtual float testFunc(const CCSize& pos, float time);
|
||||
|
||||
public:
|
||||
|
@ -176,6 +198,9 @@ public:
|
|||
void turnOnTile(const CCPoint& pos);
|
||||
void turnOffTile(const CCPoint& pos);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCTurnOffTiles* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
virtual void update(float time);
|
||||
|
@ -208,6 +233,9 @@ public:
|
|||
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
virtual bool initWithDuration(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCWavesTiles3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -236,6 +264,10 @@ public:
|
|||
|
||||
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const CCSize& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCJumpTiles3D* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
|
||||
|
@ -256,6 +288,9 @@ public :
|
|||
/** initializes the action with the number of rows to split and the duration */
|
||||
virtual bool initWithDuration(float duration, unsigned int nRows);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCSplitRows* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
|
@ -276,6 +311,9 @@ public:
|
|||
/** initializes the action with the number of columns to split and the duration */
|
||||
virtual bool initWithDuration(float duration, unsigned int nCols);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCSplitCols* clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
virtual void update(float time);
|
||||
virtual void startWithTarget(CCNode *pTarget);
|
||||
|
|
|
@ -56,7 +56,8 @@ bool CCActionTween::initWithDuration(float aDuration, const char* key, float fro
|
|||
|
||||
CCActionTween *CCActionTween::clone() const
|
||||
{
|
||||
auto a = new CCActionTween(*this);
|
||||
// no copy constructor
|
||||
auto a = new CCActionTween();
|
||||
a->initWithDuration(_duration, _key.c_str(), _from, _to);
|
||||
a->autorelease();
|
||||
return a;
|
||||
|
@ -74,7 +75,7 @@ void CCActionTween::update(float dt)
|
|||
dynamic_cast<CCActionTweenDelegate*>(_target)->updateTweenAction(_to - _delta * (1 - dt), _key.c_str());
|
||||
}
|
||||
|
||||
CCActionInterval* CCActionTween::reverse()
|
||||
CCActionTween* CCActionTween::reverse() const
|
||||
{
|
||||
return CCActionTween::create(_duration, _key.c_str(), _to, _from);
|
||||
}
|
||||
|
|
|
@ -69,8 +69,8 @@ public:
|
|||
|
||||
void startWithTarget(CCNode *pTarget);
|
||||
void update(float dt);
|
||||
CCActionInterval* reverse();
|
||||
|
||||
/** returns a new reversed action */
|
||||
CCActionTween* reverse() const;
|
||||
/** returns a new clone of the action */
|
||||
CCActionTween *clone() const;
|
||||
|
||||
|
|
|
@ -50,6 +50,15 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/** Interface that defines how to clone an object */
|
||||
class CC_DLL CCClonable
|
||||
{
|
||||
public:
|
||||
/** returns a copy of the object */
|
||||
virtual CCClonable* clone() const = 0;
|
||||
virtual ~CCClonable() {};
|
||||
};
|
||||
|
||||
class CC_DLL CCObject : public CCCopying
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -57,6 +57,18 @@ CCAnimationFrame::~CCAnimationFrame()
|
|||
CC_SAFE_RELEASE(_userInfo);
|
||||
}
|
||||
|
||||
CCAnimationFrame* CCAnimationFrame::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto frame = new CCAnimationFrame();
|
||||
frame->initWithSpriteFrame(_spriteFrame->clone(),
|
||||
_delayUnits,
|
||||
_userInfo != NULL ? (CCDictionary*)_userInfo->copy()->autorelease() : NULL);
|
||||
|
||||
frame->autorelease();
|
||||
return frame;
|
||||
}
|
||||
|
||||
CCObject* CCAnimationFrame::copyWithZone(CCZone* pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
@ -205,6 +217,16 @@ float CCAnimation::getDuration(void) const
|
|||
return _totalDelayUnits * _delayPerUnit;
|
||||
}
|
||||
|
||||
CCAnimation* CCAnimation::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCAnimation();
|
||||
a->initWithAnimationFrames(_frames, _delayPerUnit, _loops);
|
||||
a->setRestoreOriginalFrame(_restoreOriginalFrame);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCObject* CCAnimation::copyWithZone(CCZone* pZone)
|
||||
{
|
||||
CCZone* pNewZone = NULL;
|
||||
|
|
|
@ -52,7 +52,7 @@ class CCSpriteFrame;
|
|||
|
||||
@since v2.0
|
||||
*/
|
||||
class CC_DLL CCAnimationFrame : public CCObject
|
||||
class CC_DLL CCAnimationFrame : public CCObject, public CCClonable
|
||||
{
|
||||
public:
|
||||
CCAnimationFrame();
|
||||
|
@ -60,7 +60,10 @@ public:
|
|||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
/** initializes the animation frame with a spriteframe, number of delay units and a notification user info */
|
||||
bool initWithSpriteFrame(CCSpriteFrame* spriteFrame, float delayUnits, CCDictionary* userInfo);
|
||||
|
||||
|
||||
/** returns a copy of the CCAnimationFrame */
|
||||
virtual CCAnimationFrame *clone() const;
|
||||
|
||||
/** CCSpriteFrameName to be used */
|
||||
CC_SYNTHESIZE_RETAIN(CCSpriteFrame*, _spriteFrame, SpriteFrame)
|
||||
|
||||
|
@ -82,7 +85,7 @@ You can animate a CCAnimation object by using the CCAnimate action. Example:
|
|||
[sprite runAction:[CCAnimate actionWithAnimation:animation]];
|
||||
|
||||
*/
|
||||
class CC_DLL CCAnimation : public CCObject
|
||||
class CC_DLL CCAnimation : public CCObject, public CCClonable
|
||||
{
|
||||
public:
|
||||
CCAnimation();
|
||||
|
@ -136,6 +139,9 @@ public:
|
|||
*/
|
||||
bool initWithAnimationFrames(CCArray* arrayOfAnimationFrames, float delayPerUnit, unsigned int loops);
|
||||
|
||||
/** returns a clone fo the animation */
|
||||
virtual CCAnimation *clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone* pZone);
|
||||
|
||||
/** total Delay units of the CCAnimation. */
|
||||
|
|
|
@ -120,6 +120,15 @@ CCSpriteFrame::~CCSpriteFrame(void)
|
|||
CC_SAFE_RELEASE(_texture);
|
||||
}
|
||||
|
||||
CCSpriteFrame* CCSpriteFrame::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
CCSpriteFrame *copy = new CCSpriteFrame();
|
||||
copy->initWithTextureFilename(_textureFilename.c_str(), _rectInPixels, _rotated, _offsetInPixels, _originalSizeInPixels);
|
||||
copy->setTexture(_texture);
|
||||
return copy;
|
||||
}
|
||||
|
||||
CCObject* CCSpriteFrame::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CC_UNUSED_PARAM(pZone);
|
||||
|
|
|
@ -52,7 +52,7 @@ class CCZone;
|
|||
CCSpriteFrame *frame = CCSpriteFrame::frameWithTexture(texture, rect, offset);
|
||||
sprite->setDisplayFrame(frame);
|
||||
*/
|
||||
class CC_DLL CCSpriteFrame : public CCObject
|
||||
class CC_DLL CCSpriteFrame : public CCObject, public CCClonable
|
||||
{
|
||||
public:
|
||||
// attributes
|
||||
|
@ -93,6 +93,10 @@ public:
|
|||
|
||||
public:
|
||||
~CCSpriteFrame(void);
|
||||
|
||||
/** returns a clone of the SpriteFrame */
|
||||
virtual CCSpriteFrame *clone() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
|
||||
/** Create a CCSpriteFrame with a texture filename, rect in points.
|
||||
|
|
|
@ -910,6 +910,21 @@ CCBSetSpriteFrame::~CCBSetSpriteFrame()
|
|||
CC_SAFE_RELEASE_NULL(mSpriteFrame);
|
||||
}
|
||||
|
||||
CCBSetSpriteFrame* CCBSetSpriteFrame::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCBSetSpriteFrame();
|
||||
a->initWithSpriteFrame(mSpriteFrame);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCBSetSpriteFrame* CCBSetSpriteFrame::reverse() const
|
||||
{
|
||||
// returns a copy of itself
|
||||
return this->clone();
|
||||
}
|
||||
|
||||
CCObject* CCBSetSpriteFrame::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone *pNewZone = NULL;
|
||||
|
@ -964,6 +979,21 @@ bool CCBSoundEffect::initWithSoundFile(const std::string &filename, float pitch,
|
|||
return true;
|
||||
}
|
||||
|
||||
CCBSoundEffect* CCBSoundEffect::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCBSoundEffect();
|
||||
a->initWithSoundFile(mSoundFile, mPitch, mPan, mGain);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCBSoundEffect* CCBSoundEffect::reverse() const
|
||||
{
|
||||
// returns a copy of itself
|
||||
return this->clone();
|
||||
}
|
||||
|
||||
CCObject* CCBSoundEffect::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone *pNewZone = NULL;
|
||||
|
@ -1025,6 +1055,21 @@ bool CCBRotateTo::initWithDuration(float fDuration, float fAngle)
|
|||
}
|
||||
}
|
||||
|
||||
CCBRotateTo* CCBRotateTo::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCBRotateTo();
|
||||
a->initWithDuration(_duration, mDstAngle);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCBRotateTo* CCBRotateTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() is not supported in CCBRotateTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCObject* CCBRotateTo::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone *pNewZone = NULL;
|
||||
|
@ -1108,6 +1153,21 @@ void CCBRotateXTo::startWithTarget(CCNode *pNode)
|
|||
mDiffAngle = mDstAngle - mStartAngle;
|
||||
}
|
||||
|
||||
CCBRotateXTo* CCBRotateXTo::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCBRotateXTo();
|
||||
a->initWithDuration(_duration, mDstAngle);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCBRotateXTo* CCBRotateXTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() is not supported in CCBRotateXTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CCObject* CCBRotateXTo::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone *pNewZone = NULL;
|
||||
|
@ -1172,6 +1232,21 @@ bool CCBRotateYTo::initWithDuration(float fDuration, float fAngle)
|
|||
}
|
||||
}
|
||||
|
||||
CCBRotateYTo* CCBRotateYTo::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCBRotateYTo();
|
||||
a->initWithDuration(_duration, mDstAngle);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCBRotateYTo* CCBRotateYTo::reverse() const
|
||||
{
|
||||
CCAssert(false, "reverse() is not supported in CCBRotateXTo");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void CCBRotateYTo::startWithTarget(CCNode *pNode)
|
||||
{
|
||||
|
@ -1229,6 +1304,20 @@ CCBEaseInstant* CCBEaseInstant::create(CCActionInterval *pAction)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
CCBEaseInstant* CCBEaseInstant::clone() const
|
||||
{
|
||||
// no copy constructor
|
||||
auto a = new CCBEaseInstant();
|
||||
a->initWithAction(_inner);
|
||||
a->autorelease();
|
||||
return a;
|
||||
}
|
||||
|
||||
CCBEaseInstant* CCBEaseInstant::reverse() const
|
||||
{
|
||||
return CCBEaseInstant::create(_inner->reverse());
|
||||
}
|
||||
|
||||
void CCBEaseInstant::update(float dt)
|
||||
{
|
||||
if (dt < 0)
|
||||
|
|
|
@ -139,6 +139,12 @@ public:
|
|||
static CCBSetSpriteFrame* create(CCSpriteFrame *pSpriteFrame);
|
||||
bool initWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBSetSpriteFrame* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBSetSpriteFrame* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
};
|
||||
|
||||
|
@ -156,6 +162,12 @@ public:
|
|||
static CCBSoundEffect* actionWithSoundFile(const std::string &file, float pitch, float pan, float gain);
|
||||
bool initWithSoundFile(const std::string &file, float pitch, float pan, float gain);
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBSoundEffect* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBSoundEffect* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
};
|
||||
|
||||
|
@ -171,6 +183,12 @@ public:
|
|||
static CCBRotateTo* create(float fDuration, float fAngle);
|
||||
bool initWithDuration(float fDuration, float fAngle);
|
||||
virtual void update(float time);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBRotateTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBRotateTo* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
virtual void startWithTarget(CCNode *pNode);
|
||||
};
|
||||
|
@ -185,6 +203,12 @@ public:
|
|||
static CCBRotateXTo* create(float fDuration, float fAngle);
|
||||
bool initWithDuration(float fDuration, float fAngle);
|
||||
virtual void startWithTarget(CCNode *pNode);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBRotateXTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBRotateXTo* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
virtual void update(float time);
|
||||
};
|
||||
|
@ -195,11 +219,17 @@ private:
|
|||
float mStartAngle;
|
||||
float mDstAngle;
|
||||
float mDiffAngle;
|
||||
|
||||
|
||||
public:
|
||||
static CCBRotateYTo* create(float fDuration, float fAngle);
|
||||
bool initWithDuration(float fDuration, float fAngle);
|
||||
virtual void startWithTarget(CCNode *pNode);
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBRotateYTo* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBRotateYTo* reverse() const;
|
||||
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
virtual void update(float time);
|
||||
};
|
||||
|
@ -209,7 +239,13 @@ class CCBEaseInstant : public CCActionEase
|
|||
{
|
||||
public:
|
||||
static CCBEaseInstant* create(CCActionInterval *pAction);
|
||||
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual CCBEaseInstant* clone() const;
|
||||
|
||||
/** returns a new reversed action */
|
||||
virtual CCBEaseInstant* reverse() const;
|
||||
|
||||
virtual void update(float dt);
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ CCLayer* restartEaseAction();
|
|||
// SpriteEase
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
#define CCCA(x) (x->copy()->autorelease())
|
||||
|
||||
void SpriteEase::onEnter()
|
||||
{
|
||||
EaseSpriteDemo::onEnter();
|
||||
|
@ -24,17 +24,17 @@ void SpriteEase::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseIn::create((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
|
||||
CCActionInterval* move_ease_in = CCEaseIn::create(move->clone(), 2.5f);
|
||||
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCActionInterval* move_ease_out = CCEaseOut::create((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
|
||||
CCActionInterval* move_ease_out = CCEaseOut::create(move->clone(), 2.5f);
|
||||
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL);
|
||||
|
||||
|
||||
CCAction *a2 = _grossini->runAction(CCRepeatForever::create(seq1));
|
||||
|
@ -76,20 +76,20 @@ void SpriteEaseInOut::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
// id move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_inout1 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.65f);
|
||||
CCActionInterval* move_ease_inout1 = CCEaseInOut::create(move->clone(), 0.65f);
|
||||
CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse();
|
||||
|
||||
CCActionInterval* move_ease_inout2 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 1.35f);
|
||||
CCActionInterval* move_ease_inout2 = CCEaseInOut::create(move->clone(), 1.35f);
|
||||
CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse();
|
||||
|
||||
CCActionInterval* move_ease_inout3 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 1.0f);
|
||||
CCActionInterval* move_ease_inout3 = CCEaseInOut::create(move->clone(), 1.0f);
|
||||
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create( move_ease_inout1, delay, move_ease_inout_back1, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create( move_ease_inout2, CCCA(delay), move_ease_inout_back2, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create( move_ease_inout3, CCCA(delay), move_ease_inout_back3, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create( move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create( move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create( move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), NULL);
|
||||
|
||||
_tamara->runAction(CCRepeatForever::create(seq1));
|
||||
_kathia->runAction(CCRepeatForever::create(seq2));
|
||||
|
@ -115,17 +115,17 @@ void SpriteEaseExponential::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseExponentialIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_in = CCEaseExponentialIn::create(move->clone());
|
||||
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCActionInterval* move_ease_out = CCEaseExponentialOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_out = CCEaseExponentialOut::create(move->clone());
|
||||
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL);
|
||||
|
||||
|
||||
_grossini->runAction( CCRepeatForever::create(seq1));
|
||||
|
@ -151,13 +151,13 @@ void SpriteEaseExponentialInOut::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseExponentialInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease = CCEaseExponentialInOut::create(move->clone() );
|
||||
CCActionInterval* move_ease_back = move_ease->reverse(); //--> reverse()
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create( move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create( move_ease, delay, move_ease_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create( move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create( move_ease, delay, move_ease_back, delay->clone(), NULL);
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
|
@ -184,17 +184,17 @@ void SpriteEaseSine::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseSineIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_in = CCEaseSineIn::create(move->clone() );
|
||||
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCActionInterval* move_ease_out = CCEaseSineOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_out = CCEaseSineOut::create(move->clone() );
|
||||
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL);
|
||||
|
||||
|
||||
_grossini->runAction( CCRepeatForever::create(seq1));
|
||||
|
@ -221,13 +221,13 @@ void SpriteEaseSineInOut::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseSineInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease = CCEaseSineInOut::create(move->clone() );
|
||||
CCActionInterval* move_ease_back = move_ease->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease, CCCA(delay), move_ease_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL);
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
|
@ -253,17 +253,17 @@ void SpriteEaseElastic::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseElasticIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_in = CCEaseElasticIn::create(move->clone() );
|
||||
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCActionInterval* move_ease_out = CCEaseElasticOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_out = CCEaseElasticOut::create(move->clone() );
|
||||
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL);
|
||||
|
||||
_grossini->runAction( CCRepeatForever::create(seq1));
|
||||
_tamara->runAction( CCRepeatForever::create(seq2));
|
||||
|
@ -288,20 +288,20 @@ void SpriteEaseElasticInOut::onEnter()
|
|||
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
|
||||
CCActionInterval* move_ease_inout1 = CCEaseElasticInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.3f);
|
||||
CCActionInterval* move_ease_inout1 = CCEaseElasticInOut::create(move->clone(), 0.3f);
|
||||
CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse();
|
||||
|
||||
CCActionInterval* move_ease_inout2 = CCEaseElasticInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.45f);
|
||||
CCActionInterval* move_ease_inout2 = CCEaseElasticInOut::create(move->clone(), 0.45f);
|
||||
CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse();
|
||||
|
||||
CCActionInterval* move_ease_inout3 = CCEaseElasticInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.6f);
|
||||
CCActionInterval* move_ease_inout3 = CCEaseElasticInOut::create(move->clone(), 0.6f);
|
||||
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move_ease_inout1, delay, move_ease_inout_back1, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_inout2, CCCA(delay), move_ease_inout_back2, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_inout3, CCCA(delay), move_ease_inout_back3, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), NULL);
|
||||
|
||||
_tamara->runAction( CCRepeatForever::create(seq1));
|
||||
_kathia->runAction( CCRepeatForever::create(seq2));
|
||||
|
@ -328,17 +328,17 @@ void SpriteEaseBounce::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseBounceIn::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_in = CCEaseBounceIn::create(move->clone() );
|
||||
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCActionInterval* move_ease_out = CCEaseBounceOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease_out = CCEaseBounceOut::create(move->clone() );
|
||||
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL);
|
||||
|
||||
_grossini->runAction( CCRepeatForever::create(seq1));
|
||||
_tamara->runAction( CCRepeatForever::create(seq2));
|
||||
|
@ -365,13 +365,13 @@ void SpriteEaseBounceInOut::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseBounceInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease = CCEaseBounceInOut::create(move->clone() );
|
||||
CCActionInterval* move_ease_back = move_ease->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease, CCCA(delay), move_ease_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL);
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
|
@ -398,17 +398,17 @@ void SpriteEaseBack::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease_in = CCEaseBackIn::create((CCActionInterval*)(move->copy()->autorelease()));
|
||||
CCActionInterval* move_ease_in = CCEaseBackIn::create(move->clone());
|
||||
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
|
||||
|
||||
CCActionInterval* move_ease_out = CCEaseBackOut::create((CCActionInterval*)(move->copy()->autorelease()));
|
||||
CCActionInterval* move_ease_out = CCEaseBackOut::create( move->clone());
|
||||
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL);
|
||||
CCSequence* seq3 = CCSequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL);
|
||||
|
||||
_grossini->runAction(CCRepeatForever::create(seq1));
|
||||
_tamara->runAction(CCRepeatForever::create(seq2));
|
||||
|
@ -434,13 +434,13 @@ void SpriteEaseBackInOut::onEnter()
|
|||
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
|
||||
CCActionInterval* move_back = move->reverse();
|
||||
|
||||
CCActionInterval* move_ease = CCEaseBackInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
|
||||
CCActionInterval* move_ease = CCEaseBackInOut::create(move->clone() );
|
||||
CCActionInterval* move_ease_back = move_ease->reverse();
|
||||
|
||||
CCDelayTime *delay = CCDelayTime::create(0.25f);
|
||||
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease, CCCA(delay), move_ease_back, CCCA(delay), NULL);
|
||||
CCSequence* seq1 = CCSequence::create(move, delay, move_back, delay->clone(), NULL);
|
||||
CCSequence* seq2 = CCSequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL);
|
||||
|
||||
this->positionForTwo();
|
||||
|
||||
|
@ -478,8 +478,8 @@ void SpeedTest::onEnter()
|
|||
CCSpeed* action = CCSpeed::create(CCRepeatForever::create(spawn), 1.0f);
|
||||
action->setTag(kTagAction1);
|
||||
|
||||
CCAction* action2 = (CCAction*)(action->copy()->autorelease());
|
||||
CCAction* action3 = (CCAction*)(action->copy()->autorelease());
|
||||
CCAction* action2 = action->clone();
|
||||
CCAction* action3 = action->clone();
|
||||
|
||||
action2->setTag(kTagAction1);
|
||||
action3->setTag(kTagAction1);
|
||||
|
|
|
@ -258,7 +258,7 @@ void SpriteProgressToRadialMidpointChanged::onEnter()
|
|||
addChild(left);
|
||||
left->setMidpoint(ccp(0.25f, 0.75f));
|
||||
left->setPosition(ccp(100, s.height/2));
|
||||
left->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease()));
|
||||
left->runAction(CCRepeatForever::create(action->clone()));
|
||||
|
||||
/**
|
||||
* Our image on the left should be a radial progress indicator, counter clockwise
|
||||
|
@ -273,7 +273,7 @@ void SpriteProgressToRadialMidpointChanged::onEnter()
|
|||
*/
|
||||
addChild(right);
|
||||
right->setPosition(ccp(s.width-100, s.height/2));
|
||||
right->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease()));
|
||||
right->runAction(CCRepeatForever::create(action->clone()));
|
||||
}
|
||||
|
||||
std::string SpriteProgressToRadialMidpointChanged::subtitle()
|
||||
|
@ -303,7 +303,7 @@ void SpriteProgressBarVarious::onEnter()
|
|||
left->setBarChangeRate(ccp(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(ccp(100, s.height/2));
|
||||
left->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
left->runAction(CCRepeatForever::create(to->clone()));
|
||||
|
||||
CCProgressTimer *middle = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
|
||||
middle->setType(kCCProgressTimerTypeBar);
|
||||
|
@ -313,7 +313,7 @@ void SpriteProgressBarVarious::onEnter()
|
|||
middle->setBarChangeRate(ccp(1,1));
|
||||
addChild(middle);
|
||||
middle->setPosition(ccp(s.width/2, s.height/2));
|
||||
middle->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
middle->runAction(CCRepeatForever::create(to->clone()));
|
||||
|
||||
CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
|
||||
right->setType(kCCProgressTimerTypeBar);
|
||||
|
@ -323,7 +323,7 @@ void SpriteProgressBarVarious::onEnter()
|
|||
right->setBarChangeRate(ccp(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(ccp(s.width-100, s.height/2));
|
||||
right->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
right->runAction(CCRepeatForever::create(to->clone()));
|
||||
}
|
||||
|
||||
std::string SpriteProgressBarVarious::subtitle()
|
||||
|
@ -343,13 +343,13 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCProgressTo *to = CCProgressTo::create(6, 100);
|
||||
CCAction *tint = CCSequence::create(CCTintTo::create(1, 255, 0, 0),
|
||||
CCTintTo::create(1, 0, 255, 0),
|
||||
CCTintTo::create(1, 0, 0, 255),
|
||||
NULL);
|
||||
CCAction *fade = CCSequence::create(CCFadeTo::create(1.0f, 0),
|
||||
CCFadeTo::create(1.0f, 255),
|
||||
NULL);
|
||||
auto tint = CCSequence::create(CCTintTo::create(1, 255, 0, 0),
|
||||
CCTintTo::create(1, 0, 255, 0),
|
||||
CCTintTo::create(1, 0, 0, 255),
|
||||
NULL);
|
||||
auto fade = CCSequence::create(CCFadeTo::create(1.0f, 0),
|
||||
CCFadeTo::create(1.0f, 255),
|
||||
NULL);
|
||||
|
||||
CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
|
||||
left->setType(kCCProgressTimerTypeBar);
|
||||
|
@ -360,8 +360,8 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
left->setBarChangeRate(ccp(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(ccp(100, s.height/2));
|
||||
left->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
left->runAction(CCRepeatForever::create((CCActionInterval *)tint->copy()->autorelease()));
|
||||
left->runAction(CCRepeatForever::create(to->clone()));
|
||||
left->runAction(CCRepeatForever::create(tint->clone()));
|
||||
|
||||
left->addChild(CCLabelTTF::create("Tint", "Marker Felt", 20.0f));
|
||||
|
||||
|
@ -373,8 +373,8 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
middle->setBarChangeRate(ccp(1, 1));
|
||||
addChild(middle);
|
||||
middle->setPosition(ccp(s.width/2, s.height/2));
|
||||
middle->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
middle->runAction(CCRepeatForever::create((CCActionInterval *)fade->copy()->autorelease()));
|
||||
middle->runAction(CCRepeatForever::create(to->clone()));
|
||||
middle->runAction(CCRepeatForever::create(fade->clone()));
|
||||
|
||||
middle->addChild(CCLabelTTF::create("Fade", "Marker Felt", 20.0f));
|
||||
|
||||
|
@ -386,9 +386,9 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
right->setBarChangeRate(ccp(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(ccp(s.width-100, s.height/2));
|
||||
right->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
right->runAction(CCRepeatForever::create((CCActionInterval *)tint->copy()->autorelease()));
|
||||
right->runAction(CCRepeatForever::create((CCActionInterval *)fade->copy()->autorelease()));
|
||||
right->runAction(CCRepeatForever::create(to->clone()));
|
||||
right->runAction(CCRepeatForever::create(tint->clone()));
|
||||
right->runAction(CCRepeatForever::create(fade->clone()));
|
||||
|
||||
right->addChild(CCLabelTTF::create("Tint and Fade", "Marker Felt", 20.0f));
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ void SpriteProgressWithSpriteFrame::onEnter()
|
|||
left->setBarChangeRate(ccp(1, 0));
|
||||
addChild(left);
|
||||
left->setPosition(ccp(100, s.height/2));
|
||||
left->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
left->runAction(CCRepeatForever::create(to->clone()));
|
||||
|
||||
CCProgressTimer *middle = CCProgressTimer::create(CCSprite::createWithSpriteFrameName("grossini_dance_02.png"));
|
||||
middle->setType(kCCProgressTimerTypeBar);
|
||||
|
@ -431,7 +431,7 @@ void SpriteProgressWithSpriteFrame::onEnter()
|
|||
middle->setBarChangeRate(ccp(1, 1));
|
||||
addChild(middle);
|
||||
middle->setPosition(ccp(s.width/2, s.height/2));
|
||||
middle->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
middle->runAction(CCRepeatForever::create(to->clone()));
|
||||
|
||||
CCProgressTimer *right = CCProgressTimer::create(CCSprite::createWithSpriteFrameName("grossini_dance_03.png"));
|
||||
right->setType(kCCProgressTimerTypeRadial);
|
||||
|
@ -441,7 +441,7 @@ void SpriteProgressWithSpriteFrame::onEnter()
|
|||
right->setBarChangeRate(ccp(0, 1));
|
||||
addChild(right);
|
||||
right->setPosition(ccp(s.width-100, s.height/2));
|
||||
right->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
|
||||
right->runAction(CCRepeatForever::create(to->clone()));
|
||||
}
|
||||
|
||||
std::string SpriteProgressWithSpriteFrame::subtitle()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "cocos2d.h"
|
||||
|
||||
static std::function<CCLayer*()> createFunctions[] = {
|
||||
|
||||
CL(ActionManual),
|
||||
CL(ActionMove),
|
||||
CL(ActionRotate),
|
||||
|
@ -466,7 +467,7 @@ void ActionRotate::onEnter()
|
|||
CCActionInterval* actionByBack = actionBy->reverse();
|
||||
_grossini->runAction( CCSequence::create(actionBy, actionByBack, NULL));
|
||||
|
||||
_kathia->runAction( CCSequence::create(actionTo2, actionTo0->copy()->autorelease(), NULL));
|
||||
_kathia->runAction( CCSequence::create(actionTo2, actionTo0->clone(), NULL));
|
||||
}
|
||||
|
||||
std::string ActionRotate::subtitle()
|
||||
|
@ -525,7 +526,7 @@ void ActionBezier::onEnter()
|
|||
|
||||
CCActionInterval* bezierForward = CCBezierBy::create(3, bezier);
|
||||
CCActionInterval* bezierBack = bezierForward->reverse();
|
||||
CCAction* rep = CCRepeatForever::create(CCSequence::create( bezierForward, bezierBack, NULL));
|
||||
CCAction* rep = CCRepeatForever::create((CCActionInterval*)CCSequence::create( bezierForward, bezierBack, NULL));
|
||||
|
||||
|
||||
// sprite 2
|
||||
|
@ -679,7 +680,7 @@ void ActionAnimate::onEnter()
|
|||
// File animation
|
||||
//
|
||||
// with 4 loops
|
||||
CCAnimation *animation3 = (CCAnimation *)animation2->copy()->autorelease();
|
||||
CCAnimation *animation3 = animation2->clone();
|
||||
animation3->setLoops(4);
|
||||
|
||||
|
||||
|
@ -1037,7 +1038,7 @@ void ActionRotateToRepeat::onEnter()
|
|||
CCActionInterval* act2 = CCRotateTo::create(1, 0);
|
||||
CCActionInterval* seq = CCSequence::create(act1, act2, NULL);
|
||||
CCAction* rep1 = CCRepeatForever::create(seq);
|
||||
CCActionInterval* rep2 = CCRepeat::create((CCFiniteTimeAction*)(seq->copy()->autorelease()), 10);
|
||||
CCActionInterval* rep2 = CCRepeat::create( seq->clone(), 10);
|
||||
|
||||
_tamara->runAction(rep1);
|
||||
_kathia->runAction(rep2);
|
||||
|
@ -1066,7 +1067,7 @@ void ActionRotateJerk::onEnter()
|
|||
NULL);
|
||||
|
||||
CCActionInterval* rep1 = CCRepeat::create(seq, 10);
|
||||
CCAction* rep2 = CCRepeatForever::create( (CCActionInterval*)(seq->copy()->autorelease()) );
|
||||
CCAction* rep2 = CCRepeatForever::create( (CCActionInterval*) seq->clone() );
|
||||
|
||||
_tamara->runAction(rep1);
|
||||
_kathia->runAction(rep2);
|
||||
|
@ -1162,26 +1163,23 @@ void ActionReverseSequence2::onEnter()
|
|||
|
||||
// Test:
|
||||
// Sequence should work both with IntervalAction and InstantActions
|
||||
CCActionInterval* move1 = CCMoveBy::create(1, ccp(250,0));
|
||||
CCActionInterval* move2 = CCMoveBy::create(1, ccp(0,50));
|
||||
CCToggleVisibility* tog1 = new CCToggleVisibility();
|
||||
CCToggleVisibility* tog2 = new CCToggleVisibility();
|
||||
tog1->autorelease();
|
||||
tog2->autorelease();
|
||||
CCFiniteTimeAction* seq = CCSequence::create( move1, tog1, move2, tog2, move1->reverse(), NULL);
|
||||
CCActionInterval* action = CCRepeat::create(CCSequence::create( seq, seq->reverse(), NULL), 3);
|
||||
|
||||
auto move1 = CCMoveBy::create(1, ccp(250,0));
|
||||
auto move2 = CCMoveBy::create(1, ccp(0,50));
|
||||
auto tog1 = CCToggleVisibility::create();
|
||||
auto tog2 = CCToggleVisibility::create();
|
||||
auto seq = CCSequence::create( move1, tog1, move2, tog2, move1->reverse(), NULL);
|
||||
auto action = CCRepeat::create(CCSequence::create( seq, seq->reverse(), NULL), 3);
|
||||
|
||||
|
||||
// Test:
|
||||
// Also test that the reverse of Hide is Show, and vice-versa
|
||||
_kathia->runAction(action);
|
||||
|
||||
CCActionInterval* move_tamara = CCMoveBy::create(1, ccp(100,0));
|
||||
CCActionInterval* move_tamara2 = CCMoveBy::create(1, ccp(50,0));
|
||||
CCActionInstant* hide = CCHide::create();
|
||||
CCFiniteTimeAction* seq_tamara = CCSequence::create( move_tamara, hide, move_tamara2, NULL);
|
||||
CCFiniteTimeAction* seq_back = seq_tamara->reverse();
|
||||
auto move_tamara = CCMoveBy::create(1, ccp(100,0));
|
||||
auto move_tamara2 = CCMoveBy::create(1, ccp(50,0));
|
||||
auto hide = CCHide::create();
|
||||
auto seq_tamara = CCSequence::create( move_tamara, hide, move_tamara2, NULL);
|
||||
auto seq_back = seq_tamara->reverse();
|
||||
_tamara->runAction( CCSequence::create( seq_tamara, seq_back, NULL));
|
||||
}
|
||||
std::string ActionReverseSequence2::subtitle()
|
||||
|
@ -1206,7 +1204,7 @@ void ActionRepeat::onEnter()
|
|||
CCSequence::create( CCPlace::create(ccp(60,60)), a1, NULL) ,
|
||||
3);
|
||||
CCAction* action2 = CCRepeatForever::create(
|
||||
CCSequence::create((CCActionInterval*)(a1->copy()->autorelease()), a1->reverse(), NULL)
|
||||
CCSequence::create((CCActionInterval*)(a1->clone()), a1->reverse(), NULL)
|
||||
);
|
||||
|
||||
_kathia->runAction(action1);
|
||||
|
@ -1256,8 +1254,8 @@ void ActionOrbit::onEnter()
|
|||
CCSequence* seq = CCSequence::create(move, move_back, NULL);
|
||||
CCAction* rfe = CCRepeatForever::create(seq);
|
||||
_kathia->runAction(rfe);
|
||||
_tamara->runAction((CCAction*)(rfe->copy()->autorelease()));
|
||||
_grossini->runAction((CCAction*)(rfe->copy()->autorelease()));
|
||||
_tamara->runAction(rfe->clone() );
|
||||
_grossini->runAction( rfe->clone() );
|
||||
}
|
||||
|
||||
std::string ActionOrbit::subtitle()
|
||||
|
@ -1311,9 +1309,9 @@ void ActionTargeted::onEnter()
|
|||
|
||||
|
||||
CCJumpBy* jump1 = CCJumpBy::create(2,CCPointZero,100,3);
|
||||
CCJumpBy* jump2 = (CCJumpBy*)jump1->copy()->autorelease();
|
||||
CCJumpBy* jump2 = jump1->clone();
|
||||
CCRotateBy* rot1 = CCRotateBy::create(1, 360);
|
||||
CCRotateBy* rot2 = (CCRotateBy*)rot1->copy()->autorelease();
|
||||
CCRotateBy* rot2 = rot1->clone();
|
||||
|
||||
CCTargetedAction *t1 = CCTargetedAction::create(_kathia, jump2);
|
||||
CCTargetedAction *t2 = CCTargetedAction::create(_kathia, rot2);
|
||||
|
@ -1410,7 +1408,7 @@ void ActionMoveStacked::runActionsInSprite(CCSprite *sprite)
|
|||
NULL)));
|
||||
|
||||
CCMoveBy* action = CCMoveBy::create(2.0f, ccp(400,0));
|
||||
CCMoveBy* action_back = (CCMoveBy*)action->reverse();
|
||||
CCMoveBy* action_back = action->reverse();
|
||||
|
||||
sprite->runAction(
|
||||
CCRepeatForever::create(
|
||||
|
@ -1436,7 +1434,7 @@ void ActionMoveJumpStacked::runActionsInSprite(CCSprite *sprite)
|
|||
NULL)));
|
||||
|
||||
CCJumpBy* jump = CCJumpBy::create(2.0f, ccp(400,0), 100, 5);
|
||||
CCJumpBy* jump_back = (CCJumpBy*)jump->reverse();
|
||||
CCJumpBy* jump_back = jump->reverse();
|
||||
|
||||
sprite->runAction(
|
||||
CCRepeatForever::create(
|
||||
|
@ -1462,7 +1460,7 @@ void ActionMoveBezierStacked::runActionsInSprite(CCSprite *sprite)
|
|||
bezier.endPosition = ccp(300,100);
|
||||
|
||||
CCBezierBy* bezierForward = CCBezierBy::create(3, bezier);
|
||||
CCBezierBy* bezierBack = (CCBezierBy*)bezierForward->reverse();
|
||||
CCBezierBy* bezierBack = bezierForward->reverse();
|
||||
CCSequence* seq = CCSequence::create(bezierForward, bezierBack, NULL);
|
||||
CCRepeatForever* rep = CCRepeatForever::create(seq);
|
||||
sprite->runAction(rep);
|
||||
|
@ -1511,7 +1509,7 @@ void ActionCatmullRomStacked::onEnter()
|
|||
array->addControlPoint(ccp(s.width/2, s.height/2));
|
||||
|
||||
CCCatmullRomBy *action = CCCatmullRomBy::create(3, array);
|
||||
CCCatmullRomBy* reverse = (CCCatmullRomBy*)action->reverse();
|
||||
CCCatmullRomBy* reverse = action->reverse();
|
||||
|
||||
CCSequence *seq = CCSequence::create(action, reverse, NULL);
|
||||
|
||||
|
@ -1543,7 +1541,7 @@ void ActionCatmullRomStacked::onEnter()
|
|||
|
||||
|
||||
CCCatmullRomTo *action2 = CCCatmullRomTo::create(3, array2);
|
||||
CCCatmullRomTo* reverse2 = (CCCatmullRomTo*)action2->reverse();
|
||||
CCCatmullRomTo* reverse2 = action2->reverse();
|
||||
|
||||
CCSequence *seq2 = CCSequence::create(action2, reverse2, NULL);
|
||||
|
||||
|
@ -1621,7 +1619,7 @@ void ActionCardinalSplineStacked::onEnter()
|
|||
|
||||
|
||||
CCCatmullRomBy *action = (CCCatmullRomBy*)CCCardinalSplineBy::create(3, array, 0);
|
||||
CCCatmullRomBy* reverse = (CCCatmullRomBy*)action->reverse();
|
||||
CCCatmullRomBy* reverse = action->reverse();
|
||||
|
||||
CCSequence *seq = CCSequence::create(action, reverse, NULL);
|
||||
|
||||
|
@ -1642,8 +1640,8 @@ void ActionCardinalSplineStacked::onEnter()
|
|||
// Spline with high tension (tension==1)
|
||||
//
|
||||
|
||||
CCCatmullRomBy *action2 = (CCCatmullRomBy*)CCCardinalSplineBy::create(3, array, 1);
|
||||
CCCatmullRomBy* reverse2 = (CCCatmullRomBy*)action2->reverse();
|
||||
CCCardinalSplineBy *action2 = CCCardinalSplineBy::create(3, array, 1);
|
||||
CCCardinalSplineBy* reverse2 = action2->reverse();
|
||||
|
||||
CCSequence *seq2 = CCSequence::create(action2, reverse2, NULL);
|
||||
|
||||
|
@ -1826,7 +1824,7 @@ void Issue1288::onEnter()
|
|||
addChild(spr);
|
||||
|
||||
CCMoveBy* act1 = CCMoveBy::create(0.5, ccp(100, 0));
|
||||
CCMoveBy* act2 = (CCMoveBy*)act1->reverse();
|
||||
CCMoveBy* act2 = act1->reverse();
|
||||
CCFiniteTimeAction* act3 = CCSequence::create(act1, act2, NULL);
|
||||
CCRepeat* act4 = CCRepeat::create(act3, 2);
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ void Effect2::onEnter()
|
|||
// id orbit_back = [orbit reverse];
|
||||
//
|
||||
// [target runAction: [RepeatForever::create: [Sequence actions: orbit, orbit_back, nil]]];
|
||||
target->runAction(CCSequence::create( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) );
|
||||
target->runAction(CCSequence::create( shaky, delay, reuse, shuffle, delay->clone(), turnoff, turnon, NULL) );
|
||||
}
|
||||
|
||||
std::string Effect2::title()
|
||||
|
|
|
@ -141,9 +141,9 @@ void ArmatureTestLayer::onEnter()
|
|||
}
|
||||
|
||||
// add menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ArmatureTestLayer::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ArmatureTestLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ArmatureTestLayer::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, CC_CALLBACK_1(ArmatureTestLayer::backCallback,this));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, CC_CALLBACK_1(ArmatureTestLayer::restartCallback, this));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, CC_CALLBACK_1(ArmatureTestLayer::nextCallback, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ cocos2d::CCNode* ComponentsTestLayer::createGameScene()
|
|||
root->addChild(player, 1, 1);
|
||||
|
||||
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(ComponentsTestLayer::toExtensionsMainLayer));
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", CC_CALLBACK_1(ComponentsTestLayer::toExtensionsMainLayer,this));
|
||||
itemBack->setColor(ccc3(0, 0, 0));
|
||||
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
|
||||
|
|
|
@ -419,7 +419,7 @@ Atlas3::Atlas3()
|
|||
label2->setAnchorPoint( ccp(0.5f, 0.5f) );
|
||||
label2->setColor( ccRED );
|
||||
addChild(label2, 0, kTagBitmapAtlas2);
|
||||
label2->runAction( (CCAction*)(repeat->copy()->autorelease()) );
|
||||
label2->runAction( repeat->clone() );
|
||||
|
||||
CCLabelBMFont* label3 = CCLabelBMFont::create("Test", "fonts/bitmapFontTest2.fnt");
|
||||
// testing anchors
|
||||
|
@ -520,7 +520,7 @@ Atlas4::Atlas4()
|
|||
label2->setPosition( ccp(s.width/2.0f, 80) );
|
||||
|
||||
CCSprite* lastChar = (CCSprite*) label2->getChildByTag(3);
|
||||
lastChar->runAction( (CCAction*)(rot_4ever->copy()->autorelease()) );
|
||||
lastChar->runAction( rot_4ever->clone() );
|
||||
|
||||
schedule( schedule_selector(Atlas4::step), 0.1f);
|
||||
}
|
||||
|
|
|
@ -342,8 +342,8 @@ MenuLayer3::MenuLayer3()
|
|||
item2->runAction( CCRepeatForever::create(CCSequence::create( jump, jump->reverse(), NULL)));
|
||||
|
||||
CCActionInterval* spin1 = CCRotateBy::create(3, 360);
|
||||
CCActionInterval* spin2 = (CCActionInterval*)(spin1->copy()->autorelease());
|
||||
CCActionInterval* spin3 = (CCActionInterval*)(spin1->copy()->autorelease());
|
||||
CCActionInterval* spin2 = spin1->clone();
|
||||
CCActionInterval* spin3 = spin1->clone();
|
||||
|
||||
item1->runAction( CCRepeatForever::create(spin1) );
|
||||
item2->runAction( CCRepeatForever::create(spin2) );
|
||||
|
|
|
@ -160,13 +160,12 @@ void Test2::onEnter()
|
|||
CCActionInterval* a2 = CCScaleBy::create(2, 2);
|
||||
|
||||
CCAction* action1 = CCRepeatForever::create( CCSequence::create(a1, a2, a2->reverse(), NULL) );
|
||||
CCAction* action2 = CCRepeatForever::create(
|
||||
CCSequence::create(
|
||||
(CCActionInterval*)(a1->copy()->autorelease()),
|
||||
(CCActionInterval*)(a2->copy()->autorelease()),
|
||||
a2->reverse(),
|
||||
NULL)
|
||||
);
|
||||
CCAction* action2 = CCRepeatForever::create( CCSequence::create(
|
||||
a1->clone(),
|
||||
a2->clone(),
|
||||
a2->reverse(),
|
||||
NULL)
|
||||
);
|
||||
|
||||
sp2->setAnchorPoint(ccp(0,0));
|
||||
|
||||
|
@ -238,7 +237,7 @@ Test5::Test5()
|
|||
CCRotateBy* rot = CCRotateBy::create(2, 360);
|
||||
CCActionInterval* rot_back = rot->reverse();
|
||||
CCAction* forever = CCRepeatForever::create(CCSequence::create(rot, rot_back, NULL));
|
||||
CCAction* forever2 = (CCAction*)(forever->copy()->autorelease());
|
||||
CCAction* forever2 = forever->clone();
|
||||
forever->setTag(101);
|
||||
forever2->setTag(102);
|
||||
|
||||
|
@ -293,10 +292,10 @@ Test6::Test6()
|
|||
CCActionInterval* rot = CCRotateBy::create(2, 360);
|
||||
CCActionInterval* rot_back = rot->reverse();
|
||||
CCAction* forever1 = CCRepeatForever::create(CCSequence::create(rot, rot_back, NULL));
|
||||
CCAction* forever11 = (CCAction*)(forever1->copy()->autorelease());
|
||||
CCAction* forever11 = forever1->clone();
|
||||
|
||||
CCAction* forever2 = (CCAction*)(forever1->copy()->autorelease());
|
||||
CCAction* forever21 = (CCAction*)(forever1->copy()->autorelease());
|
||||
CCAction* forever2 = forever1->clone();
|
||||
CCAction* forever21 = forever1->clone();
|
||||
|
||||
addChild(sp1, 0, kTagSprite1);
|
||||
sp1->addChild(sp11);
|
||||
|
@ -403,7 +402,7 @@ StressTest2::StressTest2()
|
|||
sp1->setPosition( ccp(80, s.height/2) );
|
||||
|
||||
CCActionInterval* move = CCMoveBy::create(3, ccp(350,0));
|
||||
CCActionInterval* move_ease_inout3 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 2.0f);
|
||||
CCActionInterval* move_ease_inout3 = CCEaseInOut::create(move->clone(), 2.0f);
|
||||
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
|
||||
CCSequence* seq3 = CCSequence::create( move_ease_inout3, move_ease_inout_back3, NULL);
|
||||
sp1->runAction( CCRepeatForever::create(seq3) );
|
||||
|
@ -413,7 +412,7 @@ StressTest2::StressTest2()
|
|||
fire->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
|
||||
fire->setPosition( ccp(80, s.height/2-50) );
|
||||
|
||||
CCActionInterval* copy_seq3 = (CCActionInterval*)(seq3->copy()->autorelease());
|
||||
CCActionInterval* copy_seq3 = seq3->clone();
|
||||
|
||||
fire->runAction( CCRepeatForever::create(copy_seq3) );
|
||||
sublayer->addChild(fire, 2);
|
||||
|
|
|
@ -68,10 +68,10 @@ void SpriteLayer::onEnter()
|
|||
CCActionInterval *rot2 = rot1->reverse();
|
||||
|
||||
spriteSister1->runAction(CCRepeat::create( CCSequence::create(jump2, jump1, NULL), 5 ));
|
||||
spriteSister2->runAction(CCRepeat::create( CCSequence::create((CCFiniteTimeAction *)(jump1->copy()->autorelease()), (CCFiniteTimeAction *)(jump2->copy()->autorelease()), NULL), 5 ));
|
||||
spriteSister2->runAction(CCRepeat::create( CCSequence::create(jump1->clone(), jump2->clone(), NULL), 5 ));
|
||||
|
||||
spriteSister1->runAction(CCRepeat::create( CCSequence::create(rot1, rot2, NULL), 5 ));
|
||||
spriteSister2->runAction(CCRepeat::create( CCSequence::create((CCFiniteTimeAction *)(rot2->copy()->autorelease()), (CCFiniteTimeAction *)(rot1->copy()->autorelease()), NULL), 5 ));
|
||||
spriteSister2->runAction(CCRepeat::create( CCSequence::create(rot2->clone(), rot1->clone(), NULL), 5 ));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
@ -119,9 +119,9 @@ void RotateWorldMainLayer::onEnter()
|
|||
CCAction* rot = CCRotateBy::create(8, 720);
|
||||
|
||||
blue->runAction(rot);
|
||||
red->runAction((CCAction *)(rot->copy()->autorelease()));
|
||||
green->runAction((CCAction *)(rot->copy()->autorelease()) );
|
||||
white->runAction((CCAction *)(rot->copy()->autorelease()) );
|
||||
red->runAction(rot->clone());
|
||||
green->runAction(rot->clone());
|
||||
white->runAction(rot->clone());
|
||||
}
|
||||
|
||||
void RotateWorldTestScene::runThisTest()
|
||||
|
|
|
@ -900,8 +900,8 @@ void SchedulerTimeScale::onEnter()
|
|||
CCFiniteTimeAction* spawn = CCSpawn::create(seq3_1, seq3_2, NULL);
|
||||
CCRepeat* action = CCRepeat::create(spawn, 50);
|
||||
|
||||
CCRepeat* action2 = (CCRepeat*)action->copy()->autorelease();
|
||||
CCRepeat* action3 = (CCRepeat*)action->copy()->autorelease();
|
||||
CCRepeat* action2 = action->clone();
|
||||
CCRepeat* action3 = action->clone();
|
||||
|
||||
CCSprite *grossini = CCSprite::create("Images/grossini.png");
|
||||
CCSprite *tamara = CCSprite::create("Images/grossinis_sister1.png");
|
||||
|
@ -998,9 +998,7 @@ void TwoSchedulers::onEnter()
|
|||
CCSprite *grossini = CCSprite::create("Images/grossini.png");
|
||||
addChild(grossini);
|
||||
grossini->setPosition(ccp(s.width/2,100));
|
||||
grossini->runAction((CCAction*)action->copy()->autorelease());
|
||||
|
||||
|
||||
grossini->runAction(action->clone());
|
||||
|
||||
CCScheduler *defaultScheduler = CCDirector::sharedDirector()->getScheduler();
|
||||
|
||||
|
@ -1027,7 +1025,7 @@ void TwoSchedulers::onEnter()
|
|||
addChild(sprite);
|
||||
sprite->setPosition(ccp(30+15*i,100));
|
||||
|
||||
sprite->runAction((CCAction*)action->copy()->autorelease());
|
||||
sprite->runAction(action->clone());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1052,7 +1050,7 @@ void TwoSchedulers::onEnter()
|
|||
addChild(sprite);
|
||||
sprite->setPosition(ccp(s.width-30-15*i,100));
|
||||
|
||||
sprite->runAction((CCAction*)action->copy()->autorelease());
|
||||
sprite->runAction(action->clone());
|
||||
}
|
||||
|
||||
sliderCtl1 = sliderCtl();
|
||||
|
|
|
@ -1 +1 @@
|
|||
ab1b2bfe1c0f7e0919fc455201086f8b6153c421
|
||||
0bb1102af021e356395f9d461a1b3d5dbb049b4a
|
|
@ -340,9 +340,9 @@ TMXReadWriteTest::TMXReadWriteTest()
|
|||
CCActionInterval* scaleback = CCScaleTo::create(1, 1);
|
||||
CCActionInstant* finish = CCCallFuncN::create(this, callfuncN_selector(TMXReadWriteTest::removeSprite));
|
||||
CCSequence* seq0 = CCSequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, NULL);
|
||||
CCActionInterval* seq1 = (CCActionInterval*)(seq0->copy()->autorelease());
|
||||
CCActionInterval* seq2 = (CCActionInterval*)(seq0->copy()->autorelease());
|
||||
CCActionInterval* seq3 = (CCActionInterval*)(seq0->copy()->autorelease());
|
||||
CCActionInterval* seq1 = seq0->clone();
|
||||
CCActionInterval* seq2 = seq0->clone();
|
||||
CCActionInterval* seq3 = seq0->clone();
|
||||
|
||||
tile0->runAction(seq0);
|
||||
tile1->runAction(seq1);
|
||||
|
|
|
@ -1 +1 @@
|
|||
b6c5b5f817aad6604c73f09eca6f352ccd4b9c29
|
||||
012bae6791265a61f825585ecdce0ca3382eeb70
|
Loading…
Reference in New Issue