Merge pull request #4 from liamcindy/MergeCocos2d_3.0

modify coco action with new coding rule
This commit is contained in:
cheng.zhang 2013-12-26 00:47:29 -08:00
commit b50c3468c1
14 changed files with 970 additions and 962 deletions

View File

@ -33,22 +33,22 @@ static inline float bezieratFunction( float a, float b, float c, float d, float
return (powf(1-t,3) * a + 3*t*(powf(1-t,2))*b + 3*powf(t,2)*(1-t)*c + powf(t,3)*d ); return (powf(1-t,3) * a + 3*t*(powf(1-t,2))*b + 3*powf(t,2)*(1-t)*c + powf(t,3)*d );
} }
EaseBezierAction* EaseBezierAction::create(cocos2d::ActionInterval* pAction) EaseBezierAction* EaseBezierAction::create(cocos2d::ActionInterval* action)
{ {
EaseBezierAction *pRet = new EaseBezierAction(); EaseBezierAction *_ret = new EaseBezierAction();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
void EaseBezierAction::setBezierParamer( float p0, float p1, float p2, float p3) void EaseBezierAction::setBezierParamer( float p0, float p1, float p2, float p3)
@ -85,22 +85,22 @@ EaseBezierAction* EaseBezierAction::reverse() const
// EaseQuadraticActionIn // EaseQuadraticActionIn
// //
EaseQuadraticActionIn* EaseQuadraticActionIn::create(ActionInterval* pAction) EaseQuadraticActionIn* EaseQuadraticActionIn::create(ActionInterval* action)
{ {
EaseQuadraticActionIn *pRet = new EaseQuadraticActionIn(); EaseQuadraticActionIn *_ret = new EaseQuadraticActionIn();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuadraticActionIn* EaseQuadraticActionIn::clone() const EaseQuadraticActionIn* EaseQuadraticActionIn::clone() const
@ -125,22 +125,22 @@ EaseQuadraticActionIn* EaseQuadraticActionIn::reverse() const
// EaseQuadraticActionOut // EaseQuadraticActionOut
// //
EaseQuadraticActionOut* EaseQuadraticActionOut::create(ActionInterval* pAction) EaseQuadraticActionOut* EaseQuadraticActionOut::create(ActionInterval* action)
{ {
EaseQuadraticActionOut *pRet = new EaseQuadraticActionOut(); EaseQuadraticActionOut *_ret = new EaseQuadraticActionOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuadraticActionOut* EaseQuadraticActionOut::clone() const EaseQuadraticActionOut* EaseQuadraticActionOut::clone() const
@ -166,22 +166,22 @@ EaseQuadraticActionOut* EaseQuadraticActionOut::reverse() const
// EaseQuadraticActionInOut // EaseQuadraticActionInOut
// //
EaseQuadraticActionInOut* EaseQuadraticActionInOut::create(ActionInterval* pAction) EaseQuadraticActionInOut* EaseQuadraticActionInOut::create(ActionInterval* action)
{ {
EaseQuadraticActionInOut *pRet = new EaseQuadraticActionInOut(); EaseQuadraticActionInOut *_ret = new EaseQuadraticActionInOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuadraticActionInOut* EaseQuadraticActionInOut::clone() const EaseQuadraticActionInOut* EaseQuadraticActionInOut::clone() const
@ -219,22 +219,22 @@ EaseQuadraticActionInOut* EaseQuadraticActionInOut::reverse() const
// EaseQuarticActionIn // EaseQuarticActionIn
// //
EaseQuarticActionIn* EaseQuarticActionIn::create(ActionInterval* pAction) EaseQuarticActionIn* EaseQuarticActionIn::create(ActionInterval* action)
{ {
EaseQuarticActionIn *pRet = new EaseQuarticActionIn(); EaseQuarticActionIn *_ret = new EaseQuarticActionIn();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuarticActionIn* EaseQuarticActionIn::clone() const EaseQuarticActionIn* EaseQuarticActionIn::clone() const
@ -260,22 +260,22 @@ EaseQuarticActionIn* EaseQuarticActionIn::reverse() const
// EaseQuarticActionOut // EaseQuarticActionOut
// //
EaseQuarticActionOut* EaseQuarticActionOut::create(ActionInterval* pAction) EaseQuarticActionOut* EaseQuarticActionOut::create(ActionInterval* action)
{ {
EaseQuarticActionOut *pRet = new EaseQuarticActionOut(); EaseQuarticActionOut *_ret = new EaseQuarticActionOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuarticActionOut* EaseQuarticActionOut::clone() const EaseQuarticActionOut* EaseQuarticActionOut::clone() const
@ -302,22 +302,22 @@ EaseQuarticActionOut* EaseQuarticActionOut::reverse() const
// EaseQuarticActionInOut // EaseQuarticActionInOut
// //
EaseQuarticActionInOut* EaseQuarticActionInOut::create(ActionInterval* pAction) EaseQuarticActionInOut* EaseQuarticActionInOut::create(ActionInterval* action)
{ {
EaseQuarticActionInOut *pRet = new EaseQuarticActionInOut(); EaseQuarticActionInOut *_ret = new EaseQuarticActionInOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuarticActionInOut* EaseQuarticActionInOut::clone() const EaseQuarticActionInOut* EaseQuarticActionInOut::clone() const
@ -352,22 +352,22 @@ EaseQuarticActionInOut* EaseQuarticActionInOut::reverse() const
// EaseQuinticActionIn // EaseQuinticActionIn
// //
EaseQuinticActionIn* EaseQuinticActionIn::create(ActionInterval* pAction) EaseQuinticActionIn* EaseQuinticActionIn::create(ActionInterval* action)
{ {
EaseQuinticActionIn *pRet = new EaseQuinticActionIn(); EaseQuinticActionIn *_ret = new EaseQuinticActionIn();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuinticActionIn* EaseQuinticActionIn::clone() const EaseQuinticActionIn* EaseQuinticActionIn::clone() const
@ -393,22 +393,22 @@ EaseQuinticActionIn* EaseQuinticActionIn::reverse() const
// EaseQuinticActionOut // EaseQuinticActionOut
// //
EaseQuinticActionOut* EaseQuinticActionOut::create(ActionInterval* pAction) EaseQuinticActionOut* EaseQuinticActionOut::create(ActionInterval* action)
{ {
EaseQuinticActionOut *pRet = new EaseQuinticActionOut(); EaseQuinticActionOut *_ret = new EaseQuinticActionOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuinticActionOut* EaseQuinticActionOut::clone() const EaseQuinticActionOut* EaseQuinticActionOut::clone() const
@ -435,22 +435,22 @@ EaseQuinticActionOut* EaseQuinticActionOut::reverse() const
// EaseQuinticActionInOut // EaseQuinticActionInOut
// //
EaseQuinticActionInOut* EaseQuinticActionInOut::create(ActionInterval* pAction) EaseQuinticActionInOut* EaseQuinticActionInOut::create(ActionInterval* action)
{ {
EaseQuinticActionInOut *pRet = new EaseQuinticActionInOut(); EaseQuinticActionInOut *_ret = new EaseQuinticActionInOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseQuinticActionInOut* EaseQuinticActionInOut::clone() const EaseQuinticActionInOut* EaseQuinticActionInOut::clone() const
@ -485,22 +485,22 @@ EaseQuinticActionInOut* EaseQuinticActionInOut::reverse() const
// EaseCircleActionIn // EaseCircleActionIn
// //
EaseCircleActionIn* EaseCircleActionIn::create(ActionInterval* pAction) EaseCircleActionIn* EaseCircleActionIn::create(ActionInterval* action)
{ {
EaseCircleActionIn *pRet = new EaseCircleActionIn(); EaseCircleActionIn *_ret = new EaseCircleActionIn();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseCircleActionIn* EaseCircleActionIn::clone() const EaseCircleActionIn* EaseCircleActionIn::clone() const
@ -526,22 +526,22 @@ EaseCircleActionIn* EaseCircleActionIn::reverse() const
// EaseCircleActionOut // EaseCircleActionOut
// //
EaseCircleActionOut* EaseCircleActionOut::create(ActionInterval* pAction) EaseCircleActionOut* EaseCircleActionOut::create(ActionInterval* action)
{ {
EaseCircleActionOut *pRet = new EaseCircleActionOut(); EaseCircleActionOut *_ret = new EaseCircleActionOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseCircleActionOut* EaseCircleActionOut::clone() const EaseCircleActionOut* EaseCircleActionOut::clone() const
@ -568,22 +568,22 @@ EaseCircleActionOut* EaseCircleActionOut::reverse() const
// EaseCircleActionInOut // EaseCircleActionInOut
// //
EaseCircleActionInOut* EaseCircleActionInOut::create(ActionInterval* pAction) EaseCircleActionInOut* EaseCircleActionInOut::create(ActionInterval* action)
{ {
EaseCircleActionInOut *pRet = new EaseCircleActionInOut(); EaseCircleActionInOut *_ret = new EaseCircleActionInOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseCircleActionInOut* EaseCircleActionInOut::clone() const EaseCircleActionInOut* EaseCircleActionInOut::clone() const
@ -618,22 +618,22 @@ EaseCircleActionInOut* EaseCircleActionInOut::reverse() const
// EaseCubicActionIn // EaseCubicActionIn
// //
EaseCubicActionIn* EaseCubicActionIn::create(ActionInterval* pAction) EaseCubicActionIn* EaseCubicActionIn::create(ActionInterval* action)
{ {
EaseCubicActionIn *pRet = new EaseCubicActionIn(); EaseCubicActionIn *_ret = new EaseCubicActionIn();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseCubicActionIn* EaseCubicActionIn::clone() const EaseCubicActionIn* EaseCubicActionIn::clone() const
@ -659,22 +659,22 @@ EaseCubicActionIn* EaseCubicActionIn::reverse() const
// EaseCubicActionOut // EaseCubicActionOut
// //
EaseCubicActionOut* EaseCubicActionOut::create(ActionInterval* pAction) EaseCubicActionOut* EaseCubicActionOut::create(ActionInterval* action)
{ {
EaseCubicActionOut *pRet = new EaseCubicActionOut(); EaseCubicActionOut *_ret = new EaseCubicActionOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseCubicActionOut* EaseCubicActionOut::clone() const EaseCubicActionOut* EaseCubicActionOut::clone() const
@ -700,22 +700,22 @@ EaseCubicActionOut* EaseCubicActionOut::reverse() const
// EaseCubicActionInOut // EaseCubicActionInOut
// //
EaseCubicActionInOut* EaseCubicActionInOut::create(ActionInterval* pAction) EaseCubicActionInOut* EaseCubicActionInOut::create(ActionInterval* action)
{ {
EaseCubicActionInOut *pRet = new EaseCubicActionInOut(); EaseCubicActionInOut *_ret = new EaseCubicActionInOut();
if (pRet) if (_ret)
{ {
if (pRet->initWithAction(pAction)) if (_ret->initWithAction(action))
{ {
pRet->autorelease(); _ret->autorelease();
} }
else else
{ {
CC_SAFE_RELEASE_NULL(pRet); CC_SAFE_RELEASE_NULL(_ret);
} }
} }
return pRet; return _ret;
} }
EaseCubicActionInOut* EaseCubicActionInOut::clone() const EaseCubicActionInOut* EaseCubicActionInOut::clone() const

View File

@ -31,14 +31,14 @@ THE SOFTWARE.
namespace cocostudio { namespace cocostudio {
/** /**
@brief Ease Bezier @brief Ease Bezier
@ingroup Actions @ingroup Actions
*/ */
class EaseBezierAction : public cocos2d::ActionEase class EaseBezierAction : public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseBezierAction* create(cocos2d::ActionInterval* pAction); static EaseBezierAction* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBezierAction* clone() const override; virtual EaseBezierAction* clone() const override;
@ -60,14 +60,14 @@ private:
}; };
/** /**
@brief Ease Quadratic In @brief Ease Quadratic In
@ingroup Actions @ingroup Actions
*/ */
class EaseQuadraticActionIn:public cocos2d::ActionEase class EaseQuadraticActionIn:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuadraticActionIn* create(cocos2d::ActionInterval* pAction); static EaseQuadraticActionIn* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuadraticActionIn* clone() const override; virtual EaseQuadraticActionIn* clone() const override;
@ -83,14 +83,14 @@ private:
}; };
/** /**
@brief Ease Quadratic Out @brief Ease Quadratic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseQuadraticActionOut:public cocos2d::ActionEase class EaseQuadraticActionOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuadraticActionOut* create(cocos2d::ActionInterval* pAction); static EaseQuadraticActionOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuadraticActionOut* clone() const override; virtual EaseQuadraticActionOut* clone() const override;
@ -106,14 +106,14 @@ private:
}; };
/** /**
@brief Ease Quadratic InOut @brief Ease Quadratic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseQuadraticActionInOut:public cocos2d::ActionEase class EaseQuadraticActionInOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuadraticActionInOut* create(cocos2d::ActionInterval* pAction); static EaseQuadraticActionInOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuadraticActionInOut* clone() const override; virtual EaseQuadraticActionInOut* clone() const override;
@ -128,14 +128,14 @@ private:
}; };
/** /**
@brief Ease Quartic In @brief Ease Quartic In
@ingroup Actions @ingroup Actions
*/ */
class EaseQuarticActionIn:public cocos2d::ActionEase class EaseQuarticActionIn:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuarticActionIn* create(cocos2d::ActionInterval* pAction); static EaseQuarticActionIn* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuarticActionIn* clone() const override; virtual EaseQuarticActionIn* clone() const override;
@ -150,14 +150,14 @@ private:
}; };
/** /**
@brief Ease Quartic Out @brief Ease Quartic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseQuarticActionOut:public cocos2d::ActionEase class EaseQuarticActionOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuarticActionOut* create(cocos2d::ActionInterval* pAction); static EaseQuarticActionOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuarticActionOut* clone() const override; virtual EaseQuarticActionOut* clone() const override;
@ -172,14 +172,14 @@ private:
}; };
/** /**
@brief Ease Quartic InOut @brief Ease Quartic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseQuarticActionInOut:public cocos2d::ActionEase class EaseQuarticActionInOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuarticActionInOut* create(cocos2d::ActionInterval* pAction); static EaseQuarticActionInOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuarticActionInOut* clone() const override; virtual EaseQuarticActionInOut* clone() const override;
@ -195,14 +195,14 @@ private:
/** /**
@brief Ease Quintic In @brief Ease Quintic In
@ingroup Actions @ingroup Actions
*/ */
class EaseQuinticActionIn:public cocos2d::ActionEase class EaseQuinticActionIn:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuinticActionIn* create(cocos2d::ActionInterval* pAction); static EaseQuinticActionIn* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuinticActionIn* clone() const override; virtual EaseQuinticActionIn* clone() const override;
@ -217,14 +217,14 @@ private:
}; };
/** /**
@brief Ease Quintic Out @brief Ease Quintic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseQuinticActionOut:public cocos2d::ActionEase class EaseQuinticActionOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuinticActionOut* create(cocos2d::ActionInterval* pAction); static EaseQuinticActionOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuinticActionOut* clone() const override; virtual EaseQuinticActionOut* clone() const override;
@ -239,14 +239,14 @@ private:
}; };
/** /**
@brief Ease Quintic InOut @brief Ease Quintic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseQuinticActionInOut:public cocos2d::ActionEase class EaseQuinticActionInOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuinticActionInOut* create(cocos2d::ActionInterval* pAction); static EaseQuinticActionInOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuinticActionInOut* clone() const override; virtual EaseQuinticActionInOut* clone() const override;
@ -261,14 +261,14 @@ private:
}; };
/** /**
@brief Ease Circle In @brief Ease Circle In
@ingroup Actions @ingroup Actions
*/ */
class EaseCircleActionIn:public cocos2d::ActionEase class EaseCircleActionIn:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCircleActionIn* create(cocos2d::ActionInterval* pAction); static EaseCircleActionIn* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCircleActionIn* clone() const override; virtual EaseCircleActionIn* clone() const override;
@ -283,14 +283,14 @@ private:
}; };
/** /**
@brief Ease Circle Out @brief Ease Circle Out
@ingroup Actions @ingroup Actions
*/ */
class EaseCircleActionOut:public cocos2d::ActionEase class EaseCircleActionOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCircleActionOut* create(cocos2d::ActionInterval* pAction); static EaseCircleActionOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCircleActionOut* clone() const override; virtual EaseCircleActionOut* clone() const override;
@ -305,14 +305,14 @@ private:
}; };
/** /**
@brief Ease Circle InOut @brief Ease Circle InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseCircleActionInOut:public cocos2d::ActionEase class EaseCircleActionInOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCircleActionInOut* create(cocos2d::ActionInterval* pAction); static EaseCircleActionInOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCircleActionInOut* clone() const override; virtual EaseCircleActionInOut* clone() const override;
@ -327,14 +327,14 @@ private:
}; };
/** /**
@brief Ease Cubic In @brief Ease Cubic In
@ingroup Actions @ingroup Actions
*/ */
class EaseCubicActionIn:public cocos2d::ActionEase class EaseCubicActionIn:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCubicActionIn* create(cocos2d::ActionInterval* pAction); static EaseCubicActionIn* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCubicActionIn* clone() const override; virtual EaseCubicActionIn* clone() const override;
@ -349,14 +349,14 @@ private:
}; };
/** /**
@brief Ease Cubic Out @brief Ease Cubic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseCubicActionOut:public cocos2d::ActionEase class EaseCubicActionOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCubicActionOut* create(cocos2d::ActionInterval* pAction); static EaseCubicActionOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCubicActionOut* clone() const override; virtual EaseCubicActionOut* clone() const override;
@ -371,14 +371,14 @@ private:
}; };
/** /**
@brief Ease Cubic InOut @brief Ease Cubic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseCubicActionInOut:public cocos2d::ActionEase class EaseCubicActionInOut:public cocos2d::ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCubicActionInOut* create(cocos2d::ActionInterval* pAction); static EaseCubicActionInOut* create(cocos2d::ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCubicActionInOut* clone() const override; virtual EaseCubicActionInOut* clone() const override;

View File

@ -1,31 +1,31 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCActionFrame.h" #include "CCActionFrame.h"
#include "CCActionEaseEx.h" #include "CCActionEaseEx.h"
using namespace cocos2d; using namespace cocos2d;
namespace cocostudio { namespace cocostudio {
@ -33,7 +33,7 @@ ActionFrame::ActionFrame()
: _frameType(0) : _frameType(0)
, _frameIndex(0) , _frameIndex(0)
, _fTime(0.0f) , _fTime(0.0f)
, _easingType(FrameEase_Linear) , _easingType(FrameEaseType::FrameEase_Linear)
{ {
} }
@ -81,7 +81,7 @@ int ActionFrame::getEasingType()
ActionInterval* ActionFrame::getAction(float fDuration) ActionInterval* ActionFrame::getAction(float fDuration)
{ {
log("Need a definition of <getAction> for ActionFrame"); log("Need a definition of <getAction> for ActionFrame");
return NULL; return nullptr;
} }
ActionInterval* ActionFrame::getAction(float fDuration,ActionFrame* srcFrame) ActionInterval* ActionFrame::getAction(float fDuration,ActionFrame* srcFrame)
{ {
@ -100,123 +100,123 @@ void ActionFrame::setEasingParameter(std::vector<float> parameter)
ActionInterval* ActionFrame::getEasingAction(ActionInterval* action) ActionInterval* ActionFrame::getEasingAction(ActionInterval* action)
{ {
if (action == NULL) if (action == nullptr)
{ {
return NULL; return nullptr;
} }
switch (_easingType) switch (_easingType)
{ {
case FrameEase_Custom: case FrameEaseType::FrameEase_Custom:
{ {
EaseBezierAction* cAction = EaseBezierAction::create(action); EaseBezierAction* cAction = EaseBezierAction::create(action);
cAction->setBezierParamer(_Parameter[0],_Parameter[1],_Parameter[2],_Parameter[3]); cAction->setBezierParamer(_Parameter[0],_Parameter[1],_Parameter[2],_Parameter[3]);
return cAction; return cAction;
} }
break; break;
case FrameEase_Linear: case FrameEaseType::FrameEase_Linear:
return action; return action;
break; break;
case FrameEase_Sine_EaseIn: case FrameEaseType::FrameEase_Sine_EaseIn:
return EaseSineIn::create(action); return EaseSineIn::create(action);
break; break;
case FrameEase_Sine_EaseOut: case FrameEaseType::FrameEase_Sine_EaseOut:
return EaseSineOut::create(action); return EaseSineOut::create(action);
break; break;
case FrameEase_Sine_EaseInOut: case FrameEaseType::FrameEase_Sine_EaseInOut:
return EaseSineInOut::create(action); return EaseSineInOut::create(action);
break; break;
case FrameEase_Quad_EaseIn: case FrameEaseType::FrameEase_Quad_EaseIn:
return EaseQuadraticActionIn::create(action); return EaseQuadraticActionIn::create(action);
break; break;
case FrameEase_Quad_EaseOut: case FrameEaseType::FrameEase_Quad_EaseOut:
return EaseQuadraticActionOut::create(action); return EaseQuadraticActionOut::create(action);
break; break;
case FrameEase_Quad_EaseInOut: case FrameEaseType::FrameEase_Quad_EaseInOut:
return EaseQuadraticActionInOut::create(action); return EaseQuadraticActionInOut::create(action);
break; break;
case FrameEase_Cubic_EaseIn: case FrameEaseType::FrameEase_Cubic_EaseIn:
return EaseCubicActionIn::create(action); return EaseCubicActionIn::create(action);
break; break;
case FrameEase_Cubic_EaseOut: case FrameEaseType::FrameEase_Cubic_EaseOut:
return EaseCubicActionOut::create(action); return EaseCubicActionOut::create(action);
break; break;
case FrameEase_Cubic_EaseInOut: case FrameEaseType::FrameEase_Cubic_EaseInOut:
return EaseCubicActionInOut::create(action); return EaseCubicActionInOut::create(action);
break; break;
case FrameEase_Quart_EaseIn: case FrameEaseType::FrameEase_Quart_EaseIn:
return EaseQuarticActionIn::create(action); return EaseQuarticActionIn::create(action);
break; break;
case FrameEase_Quart_EaseOut: case FrameEaseType::FrameEase_Quart_EaseOut:
return EaseQuadraticActionOut::create(action); return EaseQuadraticActionOut::create(action);
break; break;
case FrameEase_Quart_EaseInOut: case FrameEaseType::FrameEase_Quart_EaseInOut:
return EaseQuarticActionInOut::create(action); return EaseQuarticActionInOut::create(action);
break; break;
case FrameEase_Quint_EaseIn: case FrameEaseType::FrameEase_Quint_EaseIn:
return EaseQuinticActionIn::create(action); return EaseQuinticActionIn::create(action);
break; break;
case FrameEase_Quint_EaseOut: case FrameEaseType::FrameEase_Quint_EaseOut:
return EaseQuinticActionOut::create(action); return EaseQuinticActionOut::create(action);
break; break;
case FrameEase_Quint_EaseInOut: case FrameEaseType::FrameEase_Quint_EaseInOut:
return EaseQuinticActionInOut::create(action); return EaseQuinticActionInOut::create(action);
break; break;
case FrameEase_Expo_EaseIn: case FrameEaseType::FrameEase_Expo_EaseIn:
return EaseExponentialIn::create(action); return EaseExponentialIn::create(action);
break; break;
case FrameEase_Expo_EaseOut: case FrameEaseType::FrameEase_Expo_EaseOut:
return EaseExponentialOut::create(action); return EaseExponentialOut::create(action);
break; break;
case FrameEase_Expo_EaseInOut: case FrameEaseType::FrameEase_Expo_EaseInOut:
return EaseExponentialInOut::create(action); return EaseExponentialInOut::create(action);
break; break;
case FrameEase_Circ_EaseIn: case FrameEaseType::FrameEase_Circ_EaseIn:
return EaseCircleActionIn::create(action); return EaseCircleActionIn::create(action);
break; break;
case FrameEase_Circ_EaseOut: case FrameEaseType::FrameEase_Circ_EaseOut:
return EaseCircleActionOut::create(action); return EaseCircleActionOut::create(action);
break; break;
case FrameEase_Circ_EaseInOut: case FrameEaseType::FrameEase_Circ_EaseInOut:
return EaseCircleActionInOut::create(action); return EaseCircleActionInOut::create(action);
break; break;
case FrameEase_Elastic_EaseIn: case FrameEaseType::FrameEase_Elastic_EaseIn:
{ {
EaseElasticIn* cAction = EaseElasticIn::create(action); EaseElasticIn* cAction = EaseElasticIn::create(action);
cAction->setPeriod(_Parameter[0]); cAction->setPeriod(_Parameter[0]);
return cAction; return cAction;
} }
break; break;
case FrameEase_Elastic_EaseOut: case FrameEaseType::FrameEase_Elastic_EaseOut:
{ {
EaseElasticOut* cAction = EaseElasticOut::create(action); EaseElasticOut* cAction = EaseElasticOut::create(action);
cAction->setPeriod(_Parameter[0]); cAction->setPeriod(_Parameter[0]);
return cAction; return cAction;
} }
break; break;
case FrameEase_Elastic_EaseInOut: case FrameEaseType::FrameEase_Elastic_EaseInOut:
{ {
EaseElasticInOut* cAction = EaseElasticInOut::create(action); EaseElasticInOut* cAction = EaseElasticInOut::create(action);
cAction->setPeriod(_Parameter[0]); cAction->setPeriod(_Parameter[0]);
return cAction; return cAction;
} }
break; break;
case FrameEase_Back_EaseIn: case FrameEaseType::FrameEase_Back_EaseIn:
return EaseBackIn::create(action); return EaseBackIn::create(action);
break; break;
case FrameEase_Back_EaseOut: case FrameEaseType::FrameEase_Back_EaseOut:
return EaseBackOut::create(action); return EaseBackOut::create(action);
break; break;
case FrameEase_Back_EaseInOut: case FrameEaseType::FrameEase_Back_EaseInOut:
return EaseBackInOut::create(action); return EaseBackInOut::create(action);
break; break;
case FrameEase_Bounce_EaseIn: case FrameEaseType::FrameEase_Bounce_EaseIn:
return EaseBounceIn::create(action); return EaseBounceIn::create(action);
break; break;
case FrameEase_Bounce_EaseOut: case FrameEaseType::FrameEase_Bounce_EaseOut:
return EaseBounceOut::create(action); return EaseBounceOut::create(action);
break; break;
case FrameEase_Bounce_EaseInOut: case FrameEaseType::FrameEase_Bounce_EaseInOut:
return EaseBounceInOut::create(action); return EaseBounceInOut::create(action);
break; break;
default: default:
@ -227,7 +227,7 @@ ActionInterval* ActionFrame::getEasingAction(ActionInterval* action)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ActionMoveFrame::ActionMoveFrame() ActionMoveFrame::ActionMoveFrame()
: _position(Point(0.0f,0.0f)) : _position(Point(0.0f,0.0f))
{ {
_frameType = (int)kKeyframeMove; _frameType = (int)kKeyframeMove;
} }
@ -250,8 +250,8 @@ ActionInterval* ActionMoveFrame::getAction(float fDuration)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ActionScaleFrame::ActionScaleFrame() ActionScaleFrame::ActionScaleFrame()
: _scaleX(1.0f) : _scaleX(1.0f)
, _scaleY(1.0f) , _scaleY(1.0f)
{ {
_frameType = (int)kKeyframeScale; _frameType = (int)kKeyframeScale;
} }
@ -287,7 +287,7 @@ ActionInterval* ActionScaleFrame::getAction(float fDuration)
} }
ActionRotationFrame::ActionRotationFrame() ActionRotationFrame::ActionRotationFrame()
: _rotation(0.0f) : _rotation(0.0f)
{ {
_frameType = (int)kKeyframeRotate; _frameType = (int)kKeyframeRotate;
} }
@ -314,7 +314,7 @@ ActionInterval* ActionRotationFrame::getAction(float fDuration)
ActionInterval* ActionRotationFrame::getAction(float fDuration,ActionFrame* srcFrame) ActionInterval* ActionRotationFrame::getAction(float fDuration,ActionFrame* srcFrame)
{ {
ActionRotationFrame* srcRotationFrame = static_cast<ActionRotationFrame*>(srcFrame); ActionRotationFrame* srcRotationFrame = static_cast<ActionRotationFrame*>(srcFrame);
if (srcRotationFrame == NULL) if (srcRotationFrame == nullptr)
{ {
return this->getAction(fDuration); return this->getAction(fDuration);
} }
@ -326,7 +326,7 @@ ActionInterval* ActionRotationFrame::getAction(float fDuration,ActionFrame* srcF
} }
ActionFadeFrame::ActionFadeFrame() ActionFadeFrame::ActionFadeFrame()
: _opacity(255) : _opacity(255)
{ {
_frameType = (int)kKeyframeFade; _frameType = (int)kKeyframeFade;
} }
@ -353,7 +353,7 @@ ActionInterval* ActionFadeFrame::getAction(float fDuration)
ActionTintFrame::ActionTintFrame() ActionTintFrame::ActionTintFrame()
: _color(Color3B(255,255,255)) : _color(Color3B(255,255,255))
{ {
_frameType = (int)kKeyframeTint; _frameType = (int)kKeyframeTint;
} }

View File

@ -1,26 +1,26 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef __ActionFRAME_H__ #ifndef __ActionFRAME_H__
#define __ActionFRAME_H__ #define __ActionFRAME_H__
@ -39,7 +39,7 @@ enum FrameType
kKeyframeMax kKeyframeMax
}; };
enum FrameEaseType enum class FrameEaseType
{ {
FrameEase_Custom = -1, FrameEase_Custom = -1,
@ -89,97 +89,97 @@ enum FrameEaseType
FrameEase_TWEEN_EASING_MAX = 10000 FrameEase_TWEEN_EASING_MAX = 10000
}; };
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionFrame:public cocos2d::Object class ActionFrame:public cocos2d::Object
{ {
public: public:
/**
* Default constructor
*/
ActionFrame();
/**
* Default destructor
*/
virtual ~ActionFrame();
/** /**
* Changes the index of action frame * Default constructor
* */
* @param index the index of action frame ActionFrame();
*/
/**
* Default destructor
*/
virtual ~ActionFrame();
/**
* Changes the index of action frame
*
* @param index the index of action frame
*/
void setFrameIndex(int index); void setFrameIndex(int index);
/** /**
* Gets the index of action frame * Gets the index of action frame
* *
* @return the index of action frame * @return the index of action frame
*/ */
int getFrameIndex(); int getFrameIndex();
/** /**
* Changes the time of action frame * Changes the time of action frame
* *
* @param fTime the time of action frame * @param fTime the time of action frame
*/ */
void setFrameTime(float fTime); void setFrameTime(float fTime);
/** /**
* Gets the time of action frame * Gets the time of action frame
* *
* @return fTime the time of action frame * @return fTime the time of action frame
*/ */
float getFrameTime(); float getFrameTime();
/** /**
* Changes the type of action frame * Changes the type of action frame
* *
* @param frameType the type of action frame * @param frameType the type of action frame
*/ */
void setFrameType(int frameType); void setFrameType(int frameType);
/** /**
* Gets the type of action frame * Gets the type of action frame
* *
* @return the type of action frame * @return the type of action frame
*/ */
int getFrameType(); int getFrameType();
/** /**
* Changes the easing type. * Changes the easing type.
* *
* @param easingType the easing type. * @param easingType the easing type.
*/ */
void setEasingType(int easingType); void setEasingType(int easingType);
/** /**
* Gets the easing type. * Gets the easing type.
* *
* @return the easing type. * @return the easing type.
*/ */
int getEasingType(); int getEasingType();
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration); virtual cocos2d::ActionInterval* getAction(float fDuration);
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @parame fDuration the source ActionFrame * @parame fDuration the source ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame); virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame);
/** /**
@ -190,13 +190,13 @@ public:
*/ */
virtual void setEasingParameter(std::vector<float> parameter); virtual void setEasingParameter(std::vector<float> parameter);
protected: protected:
/** /**
* Gets the Easing Action of ActionFrame. * Gets the Easing Action of ActionFrame.
* *
* @parame action the duration time of ActionFrame * @parame action the duration time of ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getEasingAction(cocos2d::ActionInterval* action); virtual cocos2d::ActionInterval* getEasingAction(cocos2d::ActionInterval* action);
protected: protected:
int _frameType; int _frameType;
@ -207,243 +207,243 @@ protected:
}; };
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionMoveFrame:public ActionFrame class ActionMoveFrame:public ActionFrame
{ {
public: public:
/** /**
* Default constructor * Default constructor
*/ */
ActionMoveFrame(); ActionMoveFrame();
/** /**
* Default destructor * Default destructor
*/ */
virtual ~ActionMoveFrame(); virtual ~ActionMoveFrame();
/** /**
* Changes the move action position. * Changes the move action position.
* *
* @param the move action position. * @param the move action position.
*/ */
void setPosition(cocos2d::Point pos); void setPosition(cocos2d::Point pos);
/** /**
* Gets the move action position. * Gets the move action position.
* *
* @return the move action position. * @return the move action position.
*/ */
cocos2d::Point getPosition(); cocos2d::Point getPosition();
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration); virtual cocos2d::ActionInterval* getAction(float fDuration);
protected: protected:
cocos2d::Point _position; cocos2d::Point _position;
}; };
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionScaleFrame:public ActionFrame class ActionScaleFrame:public ActionFrame
{ {
public: public:
/** /**
* Default constructor * Default constructor
*/ */
ActionScaleFrame(); ActionScaleFrame();
/** /**
* Default destructor * Default destructor
*/ */
virtual ~ActionScaleFrame(); virtual ~ActionScaleFrame();
/** /**
* Changes the scale action scaleX. * Changes the scale action scaleX.
* *
* @param the scale action scaleX. * @param the scale action scaleX.
*/ */
void setScaleX(float scaleX); void setScaleX(float scaleX);
/** /**
* Gets the scale action scaleX. * Gets the scale action scaleX.
* *
* @return the scale action scaleX. * @return the scale action scaleX.
*/ */
float getScaleX(); float getScaleX();
/** /**
* Changes the scale action scaleY. * Changes the scale action scaleY.
* *
* @param rotation the scale action scaleY. * @param rotation the scale action scaleY.
*/ */
void setScaleY(float scaleY); void setScaleY(float scaleY);
/** /**
* Gets the scale action scaleY. * Gets the scale action scaleY.
* *
* @return the the scale action scaleY. * @return the the scale action scaleY.
*/ */
float getScaleY(); float getScaleY();
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration); virtual cocos2d::ActionInterval* getAction(float fDuration);
protected: protected:
float _scaleX; float _scaleX;
float _scaleY; float _scaleY;
}; };
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionRotationFrame:public ActionFrame class ActionRotationFrame:public ActionFrame
{ {
public: public:
/** /**
* Default constructor * Default constructor
*/ */
ActionRotationFrame(); ActionRotationFrame();
/** /**
* Default destructor * Default destructor
*/ */
virtual ~ActionRotationFrame(); virtual ~ActionRotationFrame();
/** /**
* Changes rotate action rotation. * Changes rotate action rotation.
* *
* @param rotation rotate action rotation. * @param rotation rotate action rotation.
*/ */
void setRotation(float rotation); void setRotation(float rotation);
/** /**
* Gets the rotate action rotation. * Gets the rotate action rotation.
* *
* @return the rotate action rotation. * @return the rotate action rotation.
*/ */
float getRotation(); float getRotation();
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration); virtual cocos2d::ActionInterval* getAction(float fDuration);
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @parame fDuration the source ActionFrame * @parame fDuration the source ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame); virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame);
public: public:
float _rotation; float _rotation;
}; };
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionFadeFrame:public ActionFrame class ActionFadeFrame:public ActionFrame
{ {
public: public:
/** /**
* Default constructor * Default constructor
*/ */
ActionFadeFrame(); ActionFadeFrame();
/** /**
* Default destructor * Default destructor
*/ */
virtual ~ActionFadeFrame(); virtual ~ActionFadeFrame();
/** /**
* Changes the fade action opacity. * Changes the fade action opacity.
* *
* @param opacity the fade action opacity * @param opacity the fade action opacity
*/ */
void setOpacity(int opacity); void setOpacity(int opacity);
/** /**
* Gets the fade action opacity. * Gets the fade action opacity.
* *
* @return the fade action opacity. * @return the fade action opacity.
*/ */
int getOpacity(); int getOpacity();
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration); virtual cocos2d::ActionInterval* getAction(float fDuration);
protected: protected:
float _opacity; float _opacity;
}; };
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionTintFrame:public ActionFrame class ActionTintFrame:public ActionFrame
{ {
public: public:
/** /**
* Default constructor * Default constructor
*/ */
ActionTintFrame(); ActionTintFrame();
/** /**
* Default destructor * Default destructor
*/ */
virtual ~ActionTintFrame(); virtual ~ActionTintFrame();
/** /**
* Changes the tint action color. * Changes the tint action color.
* *
* @param ccolor the tint action color * @param ccolor the tint action color
*/ */
void setColor(cocos2d::Color3B ccolor); void setColor(cocos2d::Color3B ccolor);
/** /**
* Gets the tint action color. * Gets the tint action color.
* *
* @return the tint action color. * @return the tint action color.
*/ */
cocos2d::Color3B getColor(); cocos2d::Color3B getColor();
/** /**
* Gets the CCAction of ActionFrame. * Gets the CCAction of ActionFrame.
* *
* @parame fDuration the duration time of ActionFrame * @parame fDuration the duration time of ActionFrame
* *
* @return CCAction * @return CCAction
*/ */
virtual cocos2d::ActionInterval* getAction(float fDuration); virtual cocos2d::ActionInterval* getAction(float fDuration);
protected: protected:
cocos2d::Color3B _color; cocos2d::Color3B _color;

View File

@ -1,26 +1,26 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include <math.h> #include <math.h>
#include "cocostudio/CCActionFrameEasing.h" #include "cocostudio/CCActionFrameEasing.h"

View File

@ -1,26 +1,26 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef __ActionFrameEasing_H__ #ifndef __ActionFrameEasing_H__
#define __ActionFrameEasing_H__ #define __ActionFrameEasing_H__
@ -53,17 +53,17 @@ enum FrameEasingType
}; };
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionFrameEasing:public cocos2d::Object class ActionFrameEasing:public cocos2d::Object
{ {
protected: protected:
FrameEasingType _type; FrameEasingType _type;
float _fValue; float _fValue;
public: public:
ActionFrameEasing(); ActionFrameEasing();
virtual ~ActionFrameEasing(); virtual ~ActionFrameEasing();
float bounceTime(float t); float bounceTime(float t);

View File

@ -1,31 +1,31 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "cocostudio/CCActionManagerEx.h" #include "cocostudio/CCActionManagerEx.h"
#include "cocostudio/DictionaryHelper.h" #include "cocostudio/DictionaryHelper.h"
using namespace cocos2d; using namespace cocos2d;
namespace cocostudio { namespace cocostudio {
@ -33,10 +33,10 @@ static ActionManagerEx* sharedActionManager = NULL;
ActionManagerEx* ActionManagerEx::shareManager() ActionManagerEx* ActionManagerEx::shareManager()
{ {
if (!sharedActionManager) { if (!sharedActionManager) {
sharedActionManager = new ActionManagerEx(); sharedActionManager = new ActionManagerEx();
} }
return sharedActionManager; return sharedActionManager;
} }
void ActionManagerEx::purgeActionManager() void ActionManagerEx::purgeActionManager()
@ -61,13 +61,13 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
CCLOG("filename == %s",fileName.c_str()); CCLOG("filename == %s",fileName.c_str());
cocos2d::Vector<ActionObject*> actionList; cocos2d::Vector<ActionObject*> actionList;
int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist"); int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist");
for (int i=0; i<actionCount; i++) { for (int i=0; i<actionCount; i++) {
ActionObject* action = new ActionObject(); ActionObject* action = new ActionObject();
action->autorelease(); action->autorelease();
const rapidjson::Value &actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i); const rapidjson::Value &actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i);
action->initWithDictionary(actionDic,root); action->initWithDictionary(actionDic,root);
actionList.pushBack(action); actionList.pushBack(action);
} }
_pActionDic.insert(std::pair<std::string, cocos2d::Vector<ActionObject*>>(fileName, actionList)); _pActionDic.insert(std::pair<std::string, cocos2d::Vector<ActionObject*>>(fileName, actionList));
} }
@ -79,7 +79,7 @@ ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char*
{ {
return NULL; return NULL;
} }
auto actionList = iterator->second; auto actionList = iterator->second;
for (int i = 0; i < actionList.size(); i++) for (int i = 0; i < actionList.size(); i++)
{ {
ActionObject* action = actionList.at(i); ActionObject* action = actionList.at(i);
@ -113,7 +113,7 @@ ActionObject* ActionManagerEx::playActionByName(const char* jsonName,const char*
void ActionManagerEx::releaseActions() void ActionManagerEx::releaseActions()
{ {
_pActionDic.clear(); _pActionDic.clear();
} }
} }

View File

@ -1,26 +1,26 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef __ActionMANAGER_H__ #ifndef __ActionMANAGER_H__
#define __ActionMANAGER_H__ #define __ActionMANAGER_H__
@ -34,56 +34,56 @@ namespace cocostudio {
class ActionManagerEx:public cocos2d::Object class ActionManagerEx:public cocos2d::Object
{ {
public: public:
/**
* Default constructor
* @js ctor
*/
ActionManagerEx();
/**
* Default destructor
* @js NA
* @lua NA
*/
virtual ~ActionManagerEx();
/**
* Gets the static instance of ActionManager.
* @js getInstance
* @lua getInstance
*/
static ActionManagerEx* shareManager();
/** /**
* Purges ActionManager point. * Default constructor
* @js purge * @js ctor
* @lua destroyActionManager */
*/ ActionManagerEx();
/**
* Default destructor
* @js NA
* @lua NA
*/
virtual ~ActionManagerEx();
/**
* Gets the static instance of ActionManager.
* @js getInstance
* @lua getInstance
*/
static ActionManagerEx* shareManager();
/**
* Purges ActionManager point.
* @js purge
* @lua destroyActionManager
*/
static void purgeActionManager(); static void purgeActionManager();
/** /**
* Gets an ActionObject with a name. * Gets an ActionObject with a name.
* *
* @param jsonName UI file name * @param jsonName UI file name
* *
* @param actionName action name in the UI file. * @param actionName action name in the UI file.
* *
* @return ActionObject which named as the param name * @return ActionObject which named as the param name
*/ */
ActionObject* getActionByName(const char* jsonName,const char* actionName); ActionObject* getActionByName(const char* jsonName,const char* actionName);
/** /**
* Play an Action with a name. * Play an Action with a name.
* *
* @param jsonName UI file name * @param jsonName UI file name
* *
* @param actionName action name in teh UIfile. * @param actionName action name in teh UIfile.
* *
* @return ActionObject which named as the param name * @return ActionObject which named as the param name
*/ */
ActionObject* playActionByName(const char* jsonName,const char* actionName); ActionObject* playActionByName(const char* jsonName,const char* actionName);
/** /**
* Play an Action with a name. * Play an Action with a name.
* *
@ -98,9 +98,9 @@ public:
/*init properties with json dictionay*/ /*init properties with json dictionay*/
void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Object* root); void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Object* root);
/** /**
* Release all actions. * Release all actions.
* *
*/ */
void releaseActions(); void releaseActions();
protected: protected:

View File

@ -47,7 +47,7 @@ ActionNode::ActionNode()
_frameArrayNum = (int)kKeyframeMax; _frameArrayNum = (int)kKeyframeMax;
for(int i = 0; i < _frameArrayNum; i++) for(int i = 0; i < _frameArrayNum; i++)
{ {
_frameArray.push_back(cocos2d::Vector<ActionFrame*>()); _frameArray.push_back(cocos2d::Vector<ActionFrame*>());
} }
} }
@ -61,8 +61,8 @@ ActionNode::~ActionNode()
{ {
CC_SAFE_RELEASE_NULL(_action); CC_SAFE_RELEASE_NULL(_action);
} }
_frameArray.clear(); _frameArray.clear();
} }
void ActionNode::initWithDictionary(const rapidjson::Value& dic,Object* root) void ActionNode::initWithDictionary(const rapidjson::Value& dic,Object* root)
@ -214,11 +214,11 @@ void ActionNode::insertFrame(int index, ActionFrame* frame)
return; return;
} }
int frameType = frame->getFrameType(); int frameType = frame->getFrameType();
if(frameType < _frameArray.size()) if(frameType < _frameArray.size())
{ {
auto cArray = _frameArray.at(frameType); auto cArray = _frameArray.at(frameType);
cArray.insert(index, frame); cArray.insert(index, frame);
} }
} }
void ActionNode::addFrame(ActionFrame* frame) void ActionNode::addFrame(ActionFrame* frame)
@ -228,12 +228,12 @@ void ActionNode::addFrame(ActionFrame* frame)
return; return;
} }
int frameType = frame->getFrameType(); int frameType = frame->getFrameType();
if(frameType < _frameArray.size()) if(frameType < _frameArray.size())
{ {
auto cArray = _frameArray.at(frameType); auto cArray = _frameArray.at(frameType);
cArray.pushBack(frame); cArray.pushBack(frame);
} }
} }
void ActionNode::deleteFrame(ActionFrame* frame) void ActionNode::deleteFrame(ActionFrame* frame)
@ -243,19 +243,19 @@ void ActionNode::deleteFrame(ActionFrame* frame)
return; return;
} }
int frameType = frame->getFrameType(); int frameType = frame->getFrameType();
if(frameType < _frameArray.size()) if(frameType < _frameArray.size())
{ {
auto cArray = _frameArray.at(frameType); auto cArray = _frameArray.at(frameType);
cArray.eraseObject(frame); cArray.eraseObject(frame);
} }
} }
void ActionNode::clearAllFrame() void ActionNode::clearAllFrame()
{ {
for(auto array : _frameArray) for(auto array : _frameArray)
{ {
array.clear(); array.clear();
} }
} }
Spawn * ActionNode::refreshActionProperty() Spawn * ActionNode::refreshActionProperty()
@ -265,7 +265,7 @@ Spawn * ActionNode::refreshActionProperty()
return NULL; return NULL;
} }
Vector<FiniteTimeAction*> cSpawnArray; Vector<FiniteTimeAction*> cSpawnArray;
for (int n = 0; n < _frameArrayNum; n++) for (int n = 0; n < _frameArrayNum; n++)
{ {
auto cArray = _frameArray.at(n); auto cArray = _frameArray.at(n);
@ -287,8 +287,8 @@ Spawn * ActionNode::refreshActionProperty()
auto srcFrame = cArray.at(i-1); auto srcFrame = cArray.at(i-1);
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex()) * getUnitTime(); float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex()) * getUnitTime();
Action* cAction = frame->getAction(duration); Action* cAction = frame->getAction(duration);
if(cAction != NULL) if(cAction != NULL)
cSequenceArray.pushBack(static_cast<FiniteTimeAction*>(cAction)); cSequenceArray.pushBack(static_cast<FiniteTimeAction*>(cAction));
} }
} }
Sequence* cSequence = Sequence::create(cSequenceArray); Sequence* cSequence = Sequence::create(cSequenceArray);
@ -408,7 +408,7 @@ bool ActionNode::updateActionToTimeLine(float fTime)
bool bFindFrame = false; bool bFindFrame = false;
ActionFrame* srcFrame = NULL; ActionFrame* srcFrame = NULL;
// ActionFrame* destFrame = NULL; // ActionFrame* destFrame = NULL;
for (int n = 0; n < _frameArrayNum; n++) for (int n = 0; n < _frameArrayNum; n++)
{ {

View File

@ -1,26 +1,26 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef __ActionNODE_H__ #ifndef __ActionNODE_H__
#define __ActionNODE_H__ #define __ActionNODE_H__
@ -32,143 +32,143 @@
namespace cocostudio { namespace cocostudio {
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionNode:public cocos2d::Object class ActionNode:public cocos2d::Object
{ {
public: public:
/**
* Default constructor
*/
ActionNode();
/** /**
* Default destructor * Default constructor
*/ */
virtual ~ActionNode(); ActionNode();
/**
* Sets the time interval of frame. /**
* * Default destructor
* @param fTime the time interval of frame */
*/ virtual ~ActionNode();
/**
* Sets the time interval of frame.
*
* @param fTime the time interval of frame
*/
void setUnitTime(float fTime); void setUnitTime(float fTime);
/** /**
* Gets the time interval of frame. * Gets the time interval of frame.
* *
* @return fTime the time interval of frame * @return fTime the time interval of frame
*/ */
float getUnitTime(); float getUnitTime();
/** /**
* Sets tag for ActionNode * Sets tag for ActionNode
* *
* @param tag tag of ActionNode * @param tag tag of ActionNode
*/ */
void setActionTag(int tag); void setActionTag(int tag);
/** /**
* Gets tag for ActionNode * Gets tag for ActionNode
* *
* @return tag tag of ActionNode * @return tag tag of ActionNode
*/ */
int getActionTag(); int getActionTag();
/** /**
* Sets node which will run a action. * Sets node which will run a action.
* *
* @param node which will run a action * @param node which will run a action
*/ */
void setObject(cocos2d::Object* node); void setObject(cocos2d::Object* node);
/** /**
* Gets node which will run a action. * Gets node which will run a action.
* *
* @return node which will run a action * @return node which will run a action
*/ */
cocos2d::Object* getObject(); cocos2d::Object* getObject();
/** /**
* Insets a ActionFrame to ActionNode. * Insets a ActionFrame to ActionNode.
* *
* @param index the index of ActionFrame * @param index the index of ActionFrame
* *
* @param frame the ActionFrame which will be inserted * @param frame the ActionFrame which will be inserted
*/ */
void insertFrame(int index, ActionFrame* frame); void insertFrame(int index, ActionFrame* frame);
/** /**
* Pushs back a ActionFrame to ActionNode. * Pushs back a ActionFrame to ActionNode.
* *
* @param frame the ActionFrame which will be added * @param frame the ActionFrame which will be added
*/ */
void addFrame(ActionFrame* frame); void addFrame(ActionFrame* frame);
/** /**
* Remove a ActionFrame from ActionNode. * Remove a ActionFrame from ActionNode.
* *
* @param frame the ActionFrame which will be removed * @param frame the ActionFrame which will be removed
*/ */
void deleteFrame(ActionFrame* frame ); void deleteFrame(ActionFrame* frame );
/** /**
* Remove all ActionFrames from ActionNode. * Remove all ActionFrames from ActionNode.
*/ */
void clearAllFrame(); void clearAllFrame();
/** /**
* Gets index of first ActionFrame. * Gets index of first ActionFrame.
* *
* @return index of first ActionFrame * @return index of first ActionFrame
*/ */
int getFirstFrameIndex(); int getFirstFrameIndex();
/** /**
* Gets index of last ActionFrame. * Gets index of last ActionFrame.
* *
* @return index of last ActionFrame * @return index of last ActionFrame
*/ */
int getLastFrameIndex(); int getLastFrameIndex();
/** /**
* Updates action states to some time. * Updates action states to some time.
* *
* @param fTime the time when need to update * @param fTime the time when need to update
*/ */
virtual bool updateActionToTimeLine(float fTime); virtual bool updateActionToTimeLine(float fTime);
/** /**
* Play the action. * Play the action.
*/ */
virtual void playAction(); virtual void playAction();
/** /**
* Stop the action. * Stop the action.
*/ */
virtual void stopAction(); virtual void stopAction();
/*init properties with a json dictionary*/ /*init properties with a json dictionary*/
virtual void initWithDictionary(const rapidjson::Value& dic,Object* root); virtual void initWithDictionary(const rapidjson::Value& dic,Object* root);
/** /**
* Gets if the action is done once time. * Gets if the action is done once time.
* *
* @return that if the action is done once time * @return that if the action is done once time
*/ */
virtual bool isActionDoneOnce(); virtual bool isActionDoneOnce();
protected: protected:
int _currentFrameIndex; int _currentFrameIndex;
int _destFrameIndex; int _destFrameIndex;
float _fUnitTime; float _fUnitTime;
int _actionTag; int _actionTag;
cocos2d::Spawn * _actionSpawn; cocos2d::Spawn * _actionSpawn;
cocos2d::Action* _action; cocos2d::Action* _action;
cocos2d::Object* _object; cocos2d::Object* _object;
std::vector<cocos2d::Vector<ActionFrame*>> _frameArray; std::vector<cocos2d::Vector<ActionFrame*>> _frameArray;
int _frameArrayNum; int _frameArrayNum;
protected: protected:

View File

@ -1,26 +1,26 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "cocostudio/CCActionObject.h" #include "cocostudio/CCActionObject.h"
#include "cocostudio/DictionaryHelper.h" #include "cocostudio/DictionaryHelper.h"
@ -105,23 +105,23 @@ bool ActionObject::isPlaying()
void ActionObject::initWithDictionary(const rapidjson::Value& dic, Object* root) void ActionObject::initWithDictionary(const rapidjson::Value& dic, Object* root)
{ {
setName(DICTOOL->getStringValue_json(dic, "name")); setName(DICTOOL->getStringValue_json(dic, "name"));
setLoop(DICTOOL->getBooleanValue_json(dic, "loop")); setLoop(DICTOOL->getBooleanValue_json(dic, "loop"));
setUnitTime(DICTOOL->getFloatValue_json(dic, "unittime")); setUnitTime(DICTOOL->getFloatValue_json(dic, "unittime"));
int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist"); int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist");
int maxLength = 0; int maxLength = 0;
for (int i=0; i<actionNodeCount; i++) { for (int i=0; i<actionNodeCount; i++) {
ActionNode* actionNode = new ActionNode(); ActionNode* actionNode = new ActionNode();
actionNode->autorelease(); actionNode->autorelease();
const rapidjson::Value& actionNodeDic = DICTOOL->getDictionaryFromArray_json(dic, "actionnodelist", i); const rapidjson::Value& actionNodeDic = DICTOOL->getDictionaryFromArray_json(dic, "actionnodelist", i);
actionNode->initWithDictionary(actionNodeDic,root); actionNode->initWithDictionary(actionNodeDic,root);
actionNode->setUnitTime(getUnitTime()); actionNode->setUnitTime(getUnitTime());
_actionNodeList.pushBack(actionNode); _actionNodeList.pushBack(actionNode);
int length = actionNode->getLastFrameIndex() - actionNode->getFirstFrameIndex(); int length = actionNode->getLastFrameIndex() - actionNode->getFirstFrameIndex();
if(length > maxLength) if(length > maxLength)
maxLength = length; maxLength = length;
} }
_fTotalTime = maxLength*_fTotalTime; _fTotalTime = maxLength*_fTotalTime;
} }
@ -145,7 +145,7 @@ void ActionObject::removeActionNode(ActionNode* node)
void ActionObject::play() void ActionObject::play()
{ {
stop(); stop();
this->updateToFrameByTime(0.0f); this->updateToFrameByTime(0.0f);
auto frameNum = _actionNodeList.size(); auto frameNum = _actionNodeList.size();
for ( int i = 0; i < frameNum; i++ ) for ( int i = 0; i < frameNum; i++ )

View File

@ -1,26 +1,26 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013 cocos2d-x.org Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef __ActionObject_H__ #ifndef __ActionObject_H__
#define __ActionObject_H__ #define __ActionObject_H__
@ -32,79 +32,79 @@
namespace cocostudio { namespace cocostudio {
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
class ActionObject:public cocos2d::Object class ActionObject:public cocos2d::Object
{ {
public: public:
/** /**
* Default constructor * Default constructor
*/ */
ActionObject(); ActionObject();
/** /**
* Default destructor * Default destructor
*/ */
virtual ~ActionObject(); virtual ~ActionObject();
/** /**
* Sets name for object * Sets name for object
* *
* @param name name of object * @param name name of object
*/ */
void setName(const char* name); void setName(const char* name);
/** /**
* Sets name for object * Sets name for object
* *
* @return name of object * @return name of object
*/ */
const char* getName(); const char* getName();
/** /**
* Sets if the action will loop play. * Sets if the action will loop play.
* *
* @param bLoop that if the action will loop play * @param bLoop that if the action will loop play
*/ */
void setLoop(bool bLoop); void setLoop(bool bLoop);
/** /**
* Gets if the action will loop play. * Gets if the action will loop play.
* *
* @return that if the action will loop play * @return that if the action will loop play
*/ */
bool getLoop(); bool getLoop();
/** /**
* Sets the time interval of frame. * Sets the time interval of frame.
* *
* @param fTime the time interval of frame * @param fTime the time interval of frame
*/ */
void setUnitTime(float fTime); void setUnitTime(float fTime);
/** /**
* Gets the time interval of frame. * Gets the time interval of frame.
* *
* @return fTime the time interval of frame * @return fTime the time interval of frame
*/ */
float getUnitTime(); float getUnitTime();
/** /**
* Sets the current time of frame. * Sets the current time of frame.
* *
* @param fTime the current time of frame * @param fTime the current time of frame
*/ */
void setCurrentTime(float fTime); void setCurrentTime(float fTime);
/** /**
* Gets the current time of frame. * Gets the current time of frame.
* *
* @return fTime the current time of frame * @return fTime the current time of frame
*/ */
float getCurrentTime(); float getCurrentTime();
/** /**
* Gets the total time of frame. * Gets the total time of frame.
* *
@ -113,15 +113,15 @@ public:
float getTotalTime(); float getTotalTime();
/** /**
* Return if the action is playing. * Return if the action is playing.
* *
* @return true if the action is playing, false the otherwise * @return true if the action is playing, false the otherwise
*/ */
bool isPlaying(); bool isPlaying();
/** /**
* Play the action. * Play the action.
*/ */
void play(); void play();
/** /**
@ -131,37 +131,37 @@ public:
*/ */
void play(cocos2d::CallFunc* func); void play(cocos2d::CallFunc* func);
/** /**
* Pause the action. * Pause the action.
*/ */
void pause(); void pause();
/** /**
* Stop the action. * Stop the action.
*/ */
void stop(); void stop();
/** /**
* Adds a ActionNode to play the action. * Adds a ActionNode to play the action.
* *
* @node the ActionNode which will play the action * @node the ActionNode which will play the action
*/ */
void addActionNode(ActionNode* node); void addActionNode(ActionNode* node);
/** /**
* Removes a ActionNode which play the action. * Removes a ActionNode which play the action.
* *
* @node the ActionNode which play the action * @node the ActionNode which play the action
*/ */
void removeActionNode(ActionNode* node); void removeActionNode(ActionNode* node);
/*update frame method*/ /*update frame method*/
void updateToFrameByTime(float fTime); void updateToFrameByTime(float fTime);
/*init properties with a json dictionary*/ /*init properties with a json dictionary*/
void initWithDictionary(const rapidjson::Value& dic,Object* root); void initWithDictionary(const rapidjson::Value& dic,Object* root);
/*scheduler update function*/ /*scheduler update function*/
void simulationActionUpdate(float dt); void simulationActionUpdate(float dt);
protected: protected:
cocos2d::Vector<ActionNode*> _actionNodeList;/*actionnode*/ cocos2d::Vector<ActionNode*> _actionNodeList;/*actionnode*/

View File

@ -11,6 +11,7 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\CCActionEaseEx.cpp" />
<ClCompile Include="..\CCActionFrame.cpp" /> <ClCompile Include="..\CCActionFrame.cpp" />
<ClCompile Include="..\CCActionFrameEasing.cpp" /> <ClCompile Include="..\CCActionFrameEasing.cpp" />
<ClCompile Include="..\CCActionManagerEx.cpp" /> <ClCompile Include="..\CCActionManagerEx.cpp" />
@ -55,6 +56,7 @@
<ClInclude Include="..\..\..\..\external\json\reader.h" /> <ClInclude Include="..\..\..\..\external\json\reader.h" />
<ClInclude Include="..\..\..\..\external\json\stringbuffer.h" /> <ClInclude Include="..\..\..\..\external\json\stringbuffer.h" />
<ClInclude Include="..\..\..\..\external\json\writer.h" /> <ClInclude Include="..\..\..\..\external\json\writer.h" />
<ClInclude Include="..\CCActionEaseEx.h" />
<ClInclude Include="..\CCActionFrame.h" /> <ClInclude Include="..\CCActionFrame.h" />
<ClInclude Include="..\CCActionFrameEasing.h" /> <ClInclude Include="..\CCActionFrameEasing.h" />
<ClInclude Include="..\CCActionManagerEx.h" /> <ClInclude Include="..\CCActionManagerEx.h" />

View File

@ -135,6 +135,9 @@
<ClCompile Include="..\CCBone.cpp"> <ClCompile Include="..\CCBone.cpp">
<Filter>armature</Filter> <Filter>armature</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\CCActionEaseEx.cpp">
<Filter>action</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\CCActionFrameEasing.h"> <ClInclude Include="..\CCActionFrameEasing.h">
@ -263,5 +266,8 @@
<ClInclude Include="..\..\..\..\external\json\internal\strfunc.h"> <ClInclude Include="..\..\..\..\external\json\internal\strfunc.h">
<Filter>json\rapidjson\internal</Filter> <Filter>json\rapidjson\internal</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CCActionEaseEx.h">
<Filter>action</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>