From bc547078938519c38beaa9379c2fb011c5dcd99d Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 26 Dec 2013 16:29:59 +0800 Subject: [PATCH 1/2] modify coco action with new coding rule --- .../cocostudio/CCActionEaseEx.cpp | 224 +++---- .../cocostudio/CCActionEaseEx.h | 128 ++-- .../cocostudio/CCActionFrame.cpp | 132 ++--- .../editor-support/cocostudio/CCActionFrame.h | 552 +++++++++--------- .../cocostudio/CCActionFrameEasing.cpp | 44 +- .../cocostudio/CCActionFrameEasing.h | 54 +- .../cocostudio/CCActionManagerEx.cpp | 68 +-- .../cocostudio/CCActionManagerEx.h | 136 ++--- .../cocostudio/CCActionNode.cpp | 72 +-- .../editor-support/cocostudio/CCActionNode.h | 248 ++++---- .../cocostudio/CCActionObject.cpp | 62 +- .../cocostudio/CCActionObject.h | 222 +++---- .../proj.win32/libCocosStudio.vcxproj | 2 + .../proj.win32/libCocosStudio.vcxproj.filters | 6 + 14 files changed, 979 insertions(+), 971 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCActionEaseEx.cpp b/cocos/editor-support/cocostudio/CCActionEaseEx.cpp index 24d8105073..bf54d704ea 100644 --- a/cocos/editor-support/cocostudio/CCActionEaseEx.cpp +++ b/cocos/editor-support/cocostudio/CCActionEaseEx.cpp @@ -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 ); } -EaseBezierAction* EaseBezierAction::create(cocos2d::ActionInterval* pAction) +EaseBezierAction* EaseBezierAction::create(cocos2d::ActionInterval* action) { - EaseBezierAction *pRet = new EaseBezierAction(); - if (pRet) + EaseBezierAction *_ret = new EaseBezierAction(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } 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) @@ -85,22 +85,22 @@ EaseBezierAction* EaseBezierAction::reverse() const // EaseQuadraticActionIn // -EaseQuadraticActionIn* EaseQuadraticActionIn::create(ActionInterval* pAction) +EaseQuadraticActionIn* EaseQuadraticActionIn::create(ActionInterval* action) { - EaseQuadraticActionIn *pRet = new EaseQuadraticActionIn(); - if (pRet) + EaseQuadraticActionIn *_ret = new EaseQuadraticActionIn(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuadraticActionIn* EaseQuadraticActionIn::clone() const @@ -125,22 +125,22 @@ EaseQuadraticActionIn* EaseQuadraticActionIn::reverse() const // EaseQuadraticActionOut // -EaseQuadraticActionOut* EaseQuadraticActionOut::create(ActionInterval* pAction) +EaseQuadraticActionOut* EaseQuadraticActionOut::create(ActionInterval* action) { - EaseQuadraticActionOut *pRet = new EaseQuadraticActionOut(); - if (pRet) + EaseQuadraticActionOut *_ret = new EaseQuadraticActionOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuadraticActionOut* EaseQuadraticActionOut::clone() const @@ -166,22 +166,22 @@ EaseQuadraticActionOut* EaseQuadraticActionOut::reverse() const // EaseQuadraticActionInOut // -EaseQuadraticActionInOut* EaseQuadraticActionInOut::create(ActionInterval* pAction) +EaseQuadraticActionInOut* EaseQuadraticActionInOut::create(ActionInterval* action) { - EaseQuadraticActionInOut *pRet = new EaseQuadraticActionInOut(); - if (pRet) + EaseQuadraticActionInOut *_ret = new EaseQuadraticActionInOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuadraticActionInOut* EaseQuadraticActionInOut::clone() const @@ -219,22 +219,22 @@ EaseQuadraticActionInOut* EaseQuadraticActionInOut::reverse() const // EaseQuarticActionIn // -EaseQuarticActionIn* EaseQuarticActionIn::create(ActionInterval* pAction) +EaseQuarticActionIn* EaseQuarticActionIn::create(ActionInterval* action) { - EaseQuarticActionIn *pRet = new EaseQuarticActionIn(); - if (pRet) + EaseQuarticActionIn *_ret = new EaseQuarticActionIn(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuarticActionIn* EaseQuarticActionIn::clone() const @@ -260,22 +260,22 @@ EaseQuarticActionIn* EaseQuarticActionIn::reverse() const // EaseQuarticActionOut // -EaseQuarticActionOut* EaseQuarticActionOut::create(ActionInterval* pAction) +EaseQuarticActionOut* EaseQuarticActionOut::create(ActionInterval* action) { - EaseQuarticActionOut *pRet = new EaseQuarticActionOut(); - if (pRet) + EaseQuarticActionOut *_ret = new EaseQuarticActionOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuarticActionOut* EaseQuarticActionOut::clone() const @@ -302,22 +302,22 @@ EaseQuarticActionOut* EaseQuarticActionOut::reverse() const // EaseQuarticActionInOut // -EaseQuarticActionInOut* EaseQuarticActionInOut::create(ActionInterval* pAction) +EaseQuarticActionInOut* EaseQuarticActionInOut::create(ActionInterval* action) { - EaseQuarticActionInOut *pRet = new EaseQuarticActionInOut(); - if (pRet) + EaseQuarticActionInOut *_ret = new EaseQuarticActionInOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuarticActionInOut* EaseQuarticActionInOut::clone() const @@ -352,22 +352,22 @@ EaseQuarticActionInOut* EaseQuarticActionInOut::reverse() const // EaseQuinticActionIn // -EaseQuinticActionIn* EaseQuinticActionIn::create(ActionInterval* pAction) +EaseQuinticActionIn* EaseQuinticActionIn::create(ActionInterval* action) { - EaseQuinticActionIn *pRet = new EaseQuinticActionIn(); - if (pRet) + EaseQuinticActionIn *_ret = new EaseQuinticActionIn(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuinticActionIn* EaseQuinticActionIn::clone() const @@ -393,22 +393,22 @@ EaseQuinticActionIn* EaseQuinticActionIn::reverse() const // EaseQuinticActionOut // -EaseQuinticActionOut* EaseQuinticActionOut::create(ActionInterval* pAction) +EaseQuinticActionOut* EaseQuinticActionOut::create(ActionInterval* action) { - EaseQuinticActionOut *pRet = new EaseQuinticActionOut(); - if (pRet) + EaseQuinticActionOut *_ret = new EaseQuinticActionOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuinticActionOut* EaseQuinticActionOut::clone() const @@ -435,22 +435,22 @@ EaseQuinticActionOut* EaseQuinticActionOut::reverse() const // EaseQuinticActionInOut // -EaseQuinticActionInOut* EaseQuinticActionInOut::create(ActionInterval* pAction) +EaseQuinticActionInOut* EaseQuinticActionInOut::create(ActionInterval* action) { - EaseQuinticActionInOut *pRet = new EaseQuinticActionInOut(); - if (pRet) + EaseQuinticActionInOut *_ret = new EaseQuinticActionInOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseQuinticActionInOut* EaseQuinticActionInOut::clone() const @@ -485,22 +485,22 @@ EaseQuinticActionInOut* EaseQuinticActionInOut::reverse() const // EaseCircleActionIn // -EaseCircleActionIn* EaseCircleActionIn::create(ActionInterval* pAction) +EaseCircleActionIn* EaseCircleActionIn::create(ActionInterval* action) { - EaseCircleActionIn *pRet = new EaseCircleActionIn(); - if (pRet) + EaseCircleActionIn *_ret = new EaseCircleActionIn(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseCircleActionIn* EaseCircleActionIn::clone() const @@ -526,22 +526,22 @@ EaseCircleActionIn* EaseCircleActionIn::reverse() const // EaseCircleActionOut // -EaseCircleActionOut* EaseCircleActionOut::create(ActionInterval* pAction) +EaseCircleActionOut* EaseCircleActionOut::create(ActionInterval* action) { - EaseCircleActionOut *pRet = new EaseCircleActionOut(); - if (pRet) + EaseCircleActionOut *_ret = new EaseCircleActionOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseCircleActionOut* EaseCircleActionOut::clone() const @@ -568,22 +568,22 @@ EaseCircleActionOut* EaseCircleActionOut::reverse() const // EaseCircleActionInOut // -EaseCircleActionInOut* EaseCircleActionInOut::create(ActionInterval* pAction) +EaseCircleActionInOut* EaseCircleActionInOut::create(ActionInterval* action) { - EaseCircleActionInOut *pRet = new EaseCircleActionInOut(); - if (pRet) + EaseCircleActionInOut *_ret = new EaseCircleActionInOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseCircleActionInOut* EaseCircleActionInOut::clone() const @@ -618,22 +618,22 @@ EaseCircleActionInOut* EaseCircleActionInOut::reverse() const // EaseCubicActionIn // -EaseCubicActionIn* EaseCubicActionIn::create(ActionInterval* pAction) +EaseCubicActionIn* EaseCubicActionIn::create(ActionInterval* action) { - EaseCubicActionIn *pRet = new EaseCubicActionIn(); - if (pRet) + EaseCubicActionIn *_ret = new EaseCubicActionIn(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseCubicActionIn* EaseCubicActionIn::clone() const @@ -659,22 +659,22 @@ EaseCubicActionIn* EaseCubicActionIn::reverse() const // EaseCubicActionOut // -EaseCubicActionOut* EaseCubicActionOut::create(ActionInterval* pAction) +EaseCubicActionOut* EaseCubicActionOut::create(ActionInterval* action) { - EaseCubicActionOut *pRet = new EaseCubicActionOut(); - if (pRet) + EaseCubicActionOut *_ret = new EaseCubicActionOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseCubicActionOut* EaseCubicActionOut::clone() const @@ -700,22 +700,22 @@ EaseCubicActionOut* EaseCubicActionOut::reverse() const // EaseCubicActionInOut // -EaseCubicActionInOut* EaseCubicActionInOut::create(ActionInterval* pAction) +EaseCubicActionInOut* EaseCubicActionInOut::create(ActionInterval* action) { - EaseCubicActionInOut *pRet = new EaseCubicActionInOut(); - if (pRet) + EaseCubicActionInOut *_ret = new EaseCubicActionInOut(); + if (_ret) { - if (pRet->initWithAction(pAction)) + if (_ret->initWithAction(action)) { - pRet->autorelease(); + _ret->autorelease(); } else { - CC_SAFE_RELEASE_NULL(pRet); + CC_SAFE_RELEASE_NULL(_ret); } } - return pRet; + return _ret; } EaseCubicActionInOut* EaseCubicActionInOut::clone() const diff --git a/cocos/editor-support/cocostudio/CCActionEaseEx.h b/cocos/editor-support/cocostudio/CCActionEaseEx.h index e15b78d0a7..b24f2004b7 100644 --- a/cocos/editor-support/cocostudio/CCActionEaseEx.h +++ b/cocos/editor-support/cocostudio/CCActionEaseEx.h @@ -31,14 +31,14 @@ THE SOFTWARE. namespace cocostudio { /** - @brief Ease Bezier - @ingroup Actions - */ +@brief Ease Bezier +@ingroup Actions +*/ class EaseBezierAction : public cocos2d::ActionEase { public: /** creates the action */ - static EaseBezierAction* create(cocos2d::ActionInterval* pAction); + static EaseBezierAction* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseBezierAction* clone() const override; @@ -60,14 +60,14 @@ private: }; /** - @brief Ease Quadratic In - @ingroup Actions - */ +@brief Ease Quadratic In +@ingroup Actions +*/ class EaseQuadraticActionIn:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuadraticActionIn* create(cocos2d::ActionInterval* pAction); + static EaseQuadraticActionIn* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuadraticActionIn* clone() const override; @@ -83,14 +83,14 @@ private: }; /** - @brief Ease Quadratic Out - @ingroup Actions - */ +@brief Ease Quadratic Out +@ingroup Actions +*/ class EaseQuadraticActionOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuadraticActionOut* create(cocos2d::ActionInterval* pAction); + static EaseQuadraticActionOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuadraticActionOut* clone() const override; @@ -106,14 +106,14 @@ private: }; /** - @brief Ease Quadratic InOut - @ingroup Actions - */ +@brief Ease Quadratic InOut +@ingroup Actions +*/ class EaseQuadraticActionInOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuadraticActionInOut* create(cocos2d::ActionInterval* pAction); + static EaseQuadraticActionInOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuadraticActionInOut* clone() const override; @@ -128,14 +128,14 @@ private: }; /** - @brief Ease Quartic In - @ingroup Actions - */ +@brief Ease Quartic In +@ingroup Actions +*/ class EaseQuarticActionIn:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuarticActionIn* create(cocos2d::ActionInterval* pAction); + static EaseQuarticActionIn* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuarticActionIn* clone() const override; @@ -150,14 +150,14 @@ private: }; /** - @brief Ease Quartic Out - @ingroup Actions - */ +@brief Ease Quartic Out +@ingroup Actions +*/ class EaseQuarticActionOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuarticActionOut* create(cocos2d::ActionInterval* pAction); + static EaseQuarticActionOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuarticActionOut* clone() const override; @@ -172,14 +172,14 @@ private: }; /** - @brief Ease Quartic InOut - @ingroup Actions - */ +@brief Ease Quartic InOut +@ingroup Actions +*/ class EaseQuarticActionInOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuarticActionInOut* create(cocos2d::ActionInterval* pAction); + static EaseQuarticActionInOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuarticActionInOut* clone() const override; @@ -195,14 +195,14 @@ private: /** - @brief Ease Quintic In - @ingroup Actions - */ +@brief Ease Quintic In +@ingroup Actions +*/ class EaseQuinticActionIn:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuinticActionIn* create(cocos2d::ActionInterval* pAction); + static EaseQuinticActionIn* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuinticActionIn* clone() const override; @@ -217,14 +217,14 @@ private: }; /** - @brief Ease Quintic Out - @ingroup Actions - */ +@brief Ease Quintic Out +@ingroup Actions +*/ class EaseQuinticActionOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuinticActionOut* create(cocos2d::ActionInterval* pAction); + static EaseQuinticActionOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuinticActionOut* clone() const override; @@ -239,14 +239,14 @@ private: }; /** - @brief Ease Quintic InOut - @ingroup Actions - */ +@brief Ease Quintic InOut +@ingroup Actions +*/ class EaseQuinticActionInOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseQuinticActionInOut* create(cocos2d::ActionInterval* pAction); + static EaseQuinticActionInOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseQuinticActionInOut* clone() const override; @@ -261,14 +261,14 @@ private: }; /** - @brief Ease Circle In - @ingroup Actions - */ +@brief Ease Circle In +@ingroup Actions +*/ class EaseCircleActionIn:public cocos2d::ActionEase { public: /** creates the action */ - static EaseCircleActionIn* create(cocos2d::ActionInterval* pAction); + static EaseCircleActionIn* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseCircleActionIn* clone() const override; @@ -283,14 +283,14 @@ private: }; /** - @brief Ease Circle Out - @ingroup Actions - */ +@brief Ease Circle Out +@ingroup Actions +*/ class EaseCircleActionOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseCircleActionOut* create(cocos2d::ActionInterval* pAction); + static EaseCircleActionOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseCircleActionOut* clone() const override; @@ -305,14 +305,14 @@ private: }; /** - @brief Ease Circle InOut - @ingroup Actions - */ +@brief Ease Circle InOut +@ingroup Actions +*/ class EaseCircleActionInOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseCircleActionInOut* create(cocos2d::ActionInterval* pAction); + static EaseCircleActionInOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseCircleActionInOut* clone() const override; @@ -327,14 +327,14 @@ private: }; /** - @brief Ease Cubic In - @ingroup Actions - */ +@brief Ease Cubic In +@ingroup Actions +*/ class EaseCubicActionIn:public cocos2d::ActionEase { public: /** creates the action */ - static EaseCubicActionIn* create(cocos2d::ActionInterval* pAction); + static EaseCubicActionIn* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseCubicActionIn* clone() const override; @@ -349,14 +349,14 @@ private: }; /** - @brief Ease Cubic Out - @ingroup Actions - */ +@brief Ease Cubic Out +@ingroup Actions +*/ class EaseCubicActionOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseCubicActionOut* create(cocos2d::ActionInterval* pAction); + static EaseCubicActionOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseCubicActionOut* clone() const override; @@ -371,14 +371,14 @@ private: }; /** - @brief Ease Cubic InOut - @ingroup Actions - */ +@brief Ease Cubic InOut +@ingroup Actions +*/ class EaseCubicActionInOut:public cocos2d::ActionEase { public: /** creates the action */ - static EaseCubicActionInOut* create(cocos2d::ActionInterval* pAction); + static EaseCubicActionInOut* create(cocos2d::ActionInterval* action); virtual void update(float time) override; virtual EaseCubicActionInOut* clone() const override; diff --git a/cocos/editor-support/cocostudio/CCActionFrame.cpp b/cocos/editor-support/cocostudio/CCActionFrame.cpp index d8aa9c6086..df72b1d846 100644 --- a/cocos/editor-support/cocostudio/CCActionFrame.cpp +++ b/cocos/editor-support/cocostudio/CCActionFrame.cpp @@ -1,31 +1,31 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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 "CCActionFrame.h" #include "CCActionEaseEx.h" - using namespace cocos2d; +using namespace cocos2d; namespace cocostudio { @@ -33,7 +33,7 @@ ActionFrame::ActionFrame() : _frameType(0) , _frameIndex(0) , _fTime(0.0f) -, _easingType(FrameEase_Linear) +, _easingType(FrameEaseType::FrameEase_Linear) { } @@ -81,7 +81,7 @@ int ActionFrame::getEasingType() ActionInterval* ActionFrame::getAction(float fDuration) { log("Need a definition of for ActionFrame"); - return NULL; + return nullptr; } ActionInterval* ActionFrame::getAction(float fDuration,ActionFrame* srcFrame) { @@ -100,123 +100,123 @@ void ActionFrame::setEasingParameter(std::vector parameter) ActionInterval* ActionFrame::getEasingAction(ActionInterval* action) { - if (action == NULL) + if (action == nullptr) { - return NULL; + return nullptr; } switch (_easingType) { - case FrameEase_Custom: + case FrameEaseType::FrameEase_Custom: { EaseBezierAction* cAction = EaseBezierAction::create(action); cAction->setBezierParamer(_Parameter[0],_Parameter[1],_Parameter[2],_Parameter[3]); return cAction; } break; - case FrameEase_Linear: + case FrameEaseType::FrameEase_Linear: return action; break; - case FrameEase_Sine_EaseIn: + case FrameEaseType::FrameEase_Sine_EaseIn: return EaseSineIn::create(action); break; - case FrameEase_Sine_EaseOut: + case FrameEaseType::FrameEase_Sine_EaseOut: return EaseSineOut::create(action); break; - case FrameEase_Sine_EaseInOut: + case FrameEaseType::FrameEase_Sine_EaseInOut: return EaseSineInOut::create(action); break; - case FrameEase_Quad_EaseIn: + case FrameEaseType::FrameEase_Quad_EaseIn: return EaseQuadraticActionIn::create(action); break; - case FrameEase_Quad_EaseOut: + case FrameEaseType::FrameEase_Quad_EaseOut: return EaseQuadraticActionOut::create(action); break; - case FrameEase_Quad_EaseInOut: + case FrameEaseType::FrameEase_Quad_EaseInOut: return EaseQuadraticActionInOut::create(action); break; - case FrameEase_Cubic_EaseIn: + case FrameEaseType::FrameEase_Cubic_EaseIn: return EaseCubicActionIn::create(action); break; - case FrameEase_Cubic_EaseOut: + case FrameEaseType::FrameEase_Cubic_EaseOut: return EaseCubicActionOut::create(action); break; - case FrameEase_Cubic_EaseInOut: + case FrameEaseType::FrameEase_Cubic_EaseInOut: return EaseCubicActionInOut::create(action); break; - case FrameEase_Quart_EaseIn: + case FrameEaseType::FrameEase_Quart_EaseIn: return EaseQuarticActionIn::create(action); break; - case FrameEase_Quart_EaseOut: + case FrameEaseType::FrameEase_Quart_EaseOut: return EaseQuadraticActionOut::create(action); break; - case FrameEase_Quart_EaseInOut: + case FrameEaseType::FrameEase_Quart_EaseInOut: return EaseQuarticActionInOut::create(action); break; - case FrameEase_Quint_EaseIn: + case FrameEaseType::FrameEase_Quint_EaseIn: return EaseQuinticActionIn::create(action); break; - case FrameEase_Quint_EaseOut: + case FrameEaseType::FrameEase_Quint_EaseOut: return EaseQuinticActionOut::create(action); break; - case FrameEase_Quint_EaseInOut: + case FrameEaseType::FrameEase_Quint_EaseInOut: return EaseQuinticActionInOut::create(action); break; - case FrameEase_Expo_EaseIn: + case FrameEaseType::FrameEase_Expo_EaseIn: return EaseExponentialIn::create(action); break; - case FrameEase_Expo_EaseOut: + case FrameEaseType::FrameEase_Expo_EaseOut: return EaseExponentialOut::create(action); break; - case FrameEase_Expo_EaseInOut: + case FrameEaseType::FrameEase_Expo_EaseInOut: return EaseExponentialInOut::create(action); break; - case FrameEase_Circ_EaseIn: + case FrameEaseType::FrameEase_Circ_EaseIn: return EaseCircleActionIn::create(action); break; - case FrameEase_Circ_EaseOut: + case FrameEaseType::FrameEase_Circ_EaseOut: return EaseCircleActionOut::create(action); break; - case FrameEase_Circ_EaseInOut: + case FrameEaseType::FrameEase_Circ_EaseInOut: return EaseCircleActionInOut::create(action); break; - case FrameEase_Elastic_EaseIn: + case FrameEaseType::FrameEase_Elastic_EaseIn: { EaseElasticIn* cAction = EaseElasticIn::create(action); cAction->setPeriod(_Parameter[0]); return cAction; } break; - case FrameEase_Elastic_EaseOut: + case FrameEaseType::FrameEase_Elastic_EaseOut: { EaseElasticOut* cAction = EaseElasticOut::create(action); cAction->setPeriod(_Parameter[0]); return cAction; } break; - case FrameEase_Elastic_EaseInOut: + case FrameEaseType::FrameEase_Elastic_EaseInOut: { EaseElasticInOut* cAction = EaseElasticInOut::create(action); cAction->setPeriod(_Parameter[0]); return cAction; } break; - case FrameEase_Back_EaseIn: + case FrameEaseType::FrameEase_Back_EaseIn: return EaseBackIn::create(action); break; - case FrameEase_Back_EaseOut: + case FrameEaseType::FrameEase_Back_EaseOut: return EaseBackOut::create(action); break; - case FrameEase_Back_EaseInOut: + case FrameEaseType::FrameEase_Back_EaseInOut: return EaseBackInOut::create(action); break; - case FrameEase_Bounce_EaseIn: + case FrameEaseType::FrameEase_Bounce_EaseIn: return EaseBounceIn::create(action); break; - case FrameEase_Bounce_EaseOut: + case FrameEaseType::FrameEase_Bounce_EaseOut: return EaseBounceOut::create(action); break; - case FrameEase_Bounce_EaseInOut: + case FrameEaseType::FrameEase_Bounce_EaseInOut: return EaseBounceInOut::create(action); break; default: @@ -227,7 +227,7 @@ ActionInterval* ActionFrame::getEasingAction(ActionInterval* action) ////////////////////////////////////////////////////////////////////////// ActionMoveFrame::ActionMoveFrame() -: _position(Point(0.0f,0.0f)) + : _position(Point(0.0f,0.0f)) { _frameType = (int)kKeyframeMove; } @@ -250,8 +250,8 @@ ActionInterval* ActionMoveFrame::getAction(float fDuration) ////////////////////////////////////////////////////////////////////////// ActionScaleFrame::ActionScaleFrame() -: _scaleX(1.0f) -, _scaleY(1.0f) + : _scaleX(1.0f) + , _scaleY(1.0f) { _frameType = (int)kKeyframeScale; } @@ -287,7 +287,7 @@ ActionInterval* ActionScaleFrame::getAction(float fDuration) } ActionRotationFrame::ActionRotationFrame() -: _rotation(0.0f) + : _rotation(0.0f) { _frameType = (int)kKeyframeRotate; } @@ -314,7 +314,7 @@ ActionInterval* ActionRotationFrame::getAction(float fDuration) ActionInterval* ActionRotationFrame::getAction(float fDuration,ActionFrame* srcFrame) { ActionRotationFrame* srcRotationFrame = static_cast(srcFrame); - if (srcRotationFrame == NULL) + if (srcRotationFrame == nullptr) { return this->getAction(fDuration); } @@ -326,7 +326,7 @@ ActionInterval* ActionRotationFrame::getAction(float fDuration,ActionFrame* srcF } ActionFadeFrame::ActionFadeFrame() -: _opacity(255) + : _opacity(255) { _frameType = (int)kKeyframeFade; } @@ -353,7 +353,7 @@ ActionInterval* ActionFadeFrame::getAction(float fDuration) ActionTintFrame::ActionTintFrame() -: _color(Color3B(255,255,255)) + : _color(Color3B(255,255,255)) { _frameType = (int)kKeyframeTint; } diff --git a/cocos/editor-support/cocostudio/CCActionFrame.h b/cocos/editor-support/cocostudio/CCActionFrame.h index 306f2ba974..f8c4e8a36f 100644 --- a/cocos/editor-support/cocostudio/CCActionFrame.h +++ b/cocos/editor-support/cocostudio/CCActionFrame.h @@ -1,26 +1,26 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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. +****************************************************************************/ #ifndef __ActionFRAME_H__ #define __ActionFRAME_H__ @@ -39,7 +39,7 @@ enum FrameType kKeyframeMax }; -enum FrameEaseType +enum class FrameEaseType { FrameEase_Custom = -1, @@ -89,97 +89,97 @@ enum FrameEaseType FrameEase_TWEEN_EASING_MAX = 10000 }; /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionFrame:public cocos2d::Object { public: - - /** - * Default constructor - */ - ActionFrame(); - - /** - * Default destructor - */ - virtual ~ActionFrame(); - /** - * Changes the index of action frame - * - * @param index the index of action frame - */ + /** + * Default constructor + */ + ActionFrame(); + + /** + * Default destructor + */ + virtual ~ActionFrame(); + + /** + * Changes the index of action frame + * + * @param index the index of action frame + */ void setFrameIndex(int index); - - /** - * Gets the index of action frame - * - * @return the index of action frame - */ + + /** + * Gets the index of action frame + * + * @return the index of action frame + */ int getFrameIndex(); - /** - * Changes the time of action frame - * - * @param fTime the time of action frame - */ + /** + * Changes the time of action frame + * + * @param fTime the time of action frame + */ void setFrameTime(float fTime); - - /** - * Gets the time of action frame - * - * @return fTime the time of action frame - */ + + /** + * Gets the time of action frame + * + * @return fTime the time of action frame + */ float getFrameTime(); - /** - * Changes the type of action frame - * - * @param frameType the type of action frame - */ + /** + * Changes the type of action frame + * + * @param frameType the type of action frame + */ void setFrameType(int frameType); - - /** - * Gets the type of action frame - * - * @return the type of action frame - */ + + /** + * Gets the type of action frame + * + * @return the type of action frame + */ int getFrameType(); - /** - * Changes the easing type. - * - * @param easingType the easing type. - */ + /** + * Changes the easing type. + * + * @param easingType the easing type. + */ void setEasingType(int easingType); - - /** - * Gets the easing type. - * - * @return the easing type. - */ + + /** + * Gets the easing type. + * + * @return the easing type. + */ int getEasingType(); - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @return CCAction - */ + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration); - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @parame fDuration the source ActionFrame - * - * @return CCAction - */ + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @parame fDuration the source ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame); /** @@ -190,13 +190,13 @@ public: */ virtual void setEasingParameter(std::vector parameter); protected: - /** - * Gets the Easing Action of ActionFrame. - * - * @parame action the duration time of ActionFrame - * - * @return CCAction - */ + /** + * Gets the Easing Action of ActionFrame. + * + * @parame action the duration time of ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getEasingAction(cocos2d::ActionInterval* action); protected: int _frameType; @@ -207,243 +207,243 @@ protected: }; /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionMoveFrame:public ActionFrame { public: - - /** - * Default constructor - */ + + /** + * Default constructor + */ ActionMoveFrame(); - - /** - * Default destructor - */ + + /** + * Default destructor + */ virtual ~ActionMoveFrame(); - - /** - * Changes the move action position. - * - * @param the move action position. - */ + + /** + * Changes the move action position. + * + * @param the move action position. + */ void setPosition(cocos2d::Point pos); - - /** - * Gets the move action position. - * - * @return the move action position. - */ + + /** + * Gets the move action position. + * + * @return the move action position. + */ cocos2d::Point getPosition(); - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @return CCAction - */ + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration); protected: cocos2d::Point _position; }; /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionScaleFrame:public ActionFrame { public: - - /** - * Default constructor - */ + + /** + * Default constructor + */ ActionScaleFrame(); - - /** - * Default destructor - */ + + /** + * Default destructor + */ virtual ~ActionScaleFrame(); - - /** - * Changes the scale action scaleX. - * - * @param the scale action scaleX. - */ + + /** + * Changes the scale action scaleX. + * + * @param the scale action scaleX. + */ void setScaleX(float scaleX); - - /** - * Gets the scale action scaleX. - * - * @return the scale action scaleX. - */ + + /** + * Gets the scale action scaleX. + * + * @return the scale action scaleX. + */ float getScaleX(); - /** - * Changes the scale action scaleY. - * - * @param rotation the scale action scaleY. - */ + /** + * Changes the scale action scaleY. + * + * @param rotation the scale action scaleY. + */ void setScaleY(float scaleY); - - /** - * Gets the scale action scaleY. - * - * @return the the scale action scaleY. - */ + + /** + * Gets the scale action scaleY. + * + * @return the the scale action scaleY. + */ float getScaleY(); - - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @return CCAction - */ + + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration); protected: float _scaleX; float _scaleY; }; /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionRotationFrame:public ActionFrame { public: - - /** - * Default constructor - */ + + /** + * Default constructor + */ ActionRotationFrame(); - - /** - * Default destructor - */ + + /** + * Default destructor + */ virtual ~ActionRotationFrame(); - - /** - * Changes rotate action rotation. - * - * @param rotation rotate action rotation. - */ + + /** + * Changes rotate action rotation. + * + * @param rotation rotate action rotation. + */ void setRotation(float rotation); - - /** - * Gets the rotate action rotation. - * - * @return the rotate action rotation. - */ + + /** + * Gets the rotate action rotation. + * + * @return the rotate action rotation. + */ float getRotation(); - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @return CCAction - */ + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration); - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @parame fDuration the source ActionFrame - * - * @return CCAction - */ + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @parame fDuration the source ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame); public: float _rotation; }; /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionFadeFrame:public ActionFrame { public: - - /** - * Default constructor - */ + + /** + * Default constructor + */ ActionFadeFrame(); - - /** - * Default destructor - */ + + /** + * Default destructor + */ virtual ~ActionFadeFrame(); - - /** - * Changes the fade action opacity. - * - * @param opacity the fade action opacity - */ + + /** + * Changes the fade action opacity. + * + * @param opacity the fade action opacity + */ void setOpacity(int opacity); - - /** - * Gets the fade action opacity. - * - * @return the fade action opacity. - */ + + /** + * Gets the fade action opacity. + * + * @return the fade action opacity. + */ int getOpacity(); - - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @return CCAction - */ + + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration); protected: float _opacity; }; /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionTintFrame:public ActionFrame { public: - - /** - * Default constructor - */ + + /** + * Default constructor + */ ActionTintFrame(); - - /** - * Default destructor - */ + + /** + * Default destructor + */ virtual ~ActionTintFrame(); - - /** - * Changes the tint action color. - * - * @param ccolor the tint action color - */ + + /** + * Changes the tint action color. + * + * @param ccolor the tint action color + */ void setColor(cocos2d::Color3B ccolor); - - /** - * Gets the tint action color. - * - * @return the tint action color. - */ + + /** + * Gets the tint action color. + * + * @return the tint action color. + */ cocos2d::Color3B getColor(); - - /** - * Gets the CCAction of ActionFrame. - * - * @parame fDuration the duration time of ActionFrame - * - * @return CCAction - */ + + /** + * Gets the CCAction of ActionFrame. + * + * @parame fDuration the duration time of ActionFrame + * + * @return CCAction + */ virtual cocos2d::ActionInterval* getAction(float fDuration); protected: cocos2d::Color3B _color; diff --git a/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp b/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp index 7694b6e53c..25067811b1 100644 --- a/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp +++ b/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp @@ -1,26 +1,26 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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 #include "cocostudio/CCActionFrameEasing.h" diff --git a/cocos/editor-support/cocostudio/CCActionFrameEasing.h b/cocos/editor-support/cocostudio/CCActionFrameEasing.h index fe94a2de3a..b067949a76 100644 --- a/cocos/editor-support/cocostudio/CCActionFrameEasing.h +++ b/cocos/editor-support/cocostudio/CCActionFrameEasing.h @@ -1,26 +1,26 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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. +****************************************************************************/ #ifndef __ActionFrameEasing_H__ #define __ActionFrameEasing_H__ @@ -53,17 +53,17 @@ enum FrameEasingType }; /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionFrameEasing:public cocos2d::Object { protected: FrameEasingType _type; float _fValue; public: - ActionFrameEasing(); - virtual ~ActionFrameEasing(); + ActionFrameEasing(); + virtual ~ActionFrameEasing(); float bounceTime(float t); diff --git a/cocos/editor-support/cocostudio/CCActionManagerEx.cpp b/cocos/editor-support/cocostudio/CCActionManagerEx.cpp index 7ed7ab46c3..55532b2573 100644 --- a/cocos/editor-support/cocostudio/CCActionManagerEx.cpp +++ b/cocos/editor-support/cocostudio/CCActionManagerEx.cpp @@ -1,31 +1,31 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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 "cocostudio/CCActionManagerEx.h" #include "cocostudio/DictionaryHelper.h" - using namespace cocos2d; +using namespace cocos2d; namespace cocostudio { @@ -33,10 +33,10 @@ static ActionManagerEx* sharedActionManager = NULL; ActionManagerEx* ActionManagerEx::shareManager() { - if (!sharedActionManager) { - sharedActionManager = new ActionManagerEx(); - } - return sharedActionManager; + if (!sharedActionManager) { + sharedActionManager = new ActionManagerEx(); + } + return sharedActionManager; } void ActionManagerEx::purgeActionManager() @@ -61,13 +61,13 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V CCLOG("filename == %s",fileName.c_str()); cocos2d::Vector actionList; int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist"); - for (int i=0; iautorelease(); const rapidjson::Value &actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i); - action->initWithDictionary(actionDic,root); - actionList.pushBack(action); - } + action->initWithDictionary(actionDic,root); + actionList.pushBack(action); + } _pActionDic.insert(std::pair>(fileName, actionList)); } @@ -79,7 +79,7 @@ ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* { return NULL; } - auto actionList = iterator->second; + auto actionList = iterator->second; for (int i = 0; i < actionList.size(); i++) { ActionObject* action = actionList.at(i); @@ -113,7 +113,7 @@ ActionObject* ActionManagerEx::playActionByName(const char* jsonName,const char* void ActionManagerEx::releaseActions() { - _pActionDic.clear(); + _pActionDic.clear(); } } \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/CCActionManagerEx.h b/cocos/editor-support/cocostudio/CCActionManagerEx.h index dc224afe59..7523cde252 100644 --- a/cocos/editor-support/cocostudio/CCActionManagerEx.h +++ b/cocos/editor-support/cocostudio/CCActionManagerEx.h @@ -1,26 +1,26 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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. +****************************************************************************/ #ifndef __ActionMANAGER_H__ #define __ActionMANAGER_H__ @@ -34,56 +34,56 @@ namespace cocostudio { class ActionManagerEx:public cocos2d::Object { 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. - * @js purge - * @lua destroyActionManager - */ + /** + * 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. + * @js purge + * @lua destroyActionManager + */ static void purgeActionManager(); - /** - * Gets an ActionObject with a name. - * - * @param jsonName UI file name - * - * @param actionName action name in the UI file. - * - * @return ActionObject which named as the param name - */ + /** + * Gets an ActionObject with a name. + * + * @param jsonName UI file name + * + * @param actionName action name in the UI file. + * + * @return ActionObject which named as the param name + */ ActionObject* getActionByName(const char* jsonName,const char* actionName); /** - * Play an Action with a name. - * - * @param jsonName UI file name - * - * @param actionName action name in teh UIfile. - * - * @return ActionObject which named as the param name - */ + * Play an Action with a name. + * + * @param jsonName UI file name + * + * @param actionName action name in teh UIfile. + * + * @return ActionObject which named as the param name + */ ActionObject* playActionByName(const char* jsonName,const char* actionName); - + /** * Play an Action with a name. * @@ -98,9 +98,9 @@ public: /*init properties with json dictionay*/ void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Object* root); /** - * Release all actions. - * - */ + * Release all actions. + * + */ void releaseActions(); protected: diff --git a/cocos/editor-support/cocostudio/CCActionNode.cpp b/cocos/editor-support/cocostudio/CCActionNode.cpp index 0125ada02d..14bf5392b3 100644 --- a/cocos/editor-support/cocostudio/CCActionNode.cpp +++ b/cocos/editor-support/cocostudio/CCActionNode.cpp @@ -34,20 +34,20 @@ using namespace gui; namespace cocostudio { ActionNode::ActionNode() -: _currentFrameIndex(0) -, _destFrameIndex(0) -, _fUnitTime(0.1f) -, _actionTag(0) -, _actionSpawn(NULL) -, _action(NULL) -, _object(NULL) -, _frameArray(NULL) -, _frameArrayNum(0) + : _currentFrameIndex(0) + , _destFrameIndex(0) + , _fUnitTime(0.1f) + , _actionTag(0) + , _actionSpawn(NULL) + , _action(NULL) + , _object(NULL) + , _frameArray(NULL) + , _frameArrayNum(0) { _frameArrayNum = (int)kKeyframeMax; for(int i = 0; i < _frameArrayNum; i++) { - _frameArray.push_back(cocos2d::Vector()); + _frameArray.push_back(cocos2d::Vector()); } } @@ -61,8 +61,8 @@ ActionNode::~ActionNode() { CC_SAFE_RELEASE_NULL(_action); } - - _frameArray.clear(); + + _frameArray.clear(); } void ActionNode::initWithDictionary(const rapidjson::Value& dic,Object* root) @@ -214,11 +214,11 @@ void ActionNode::insertFrame(int index, ActionFrame* frame) return; } int frameType = frame->getFrameType(); - if(frameType < _frameArray.size()) - { - auto cArray = _frameArray.at(frameType); - cArray.insert(index, frame); - } + if(frameType < _frameArray.size()) + { + auto cArray = _frameArray.at(frameType); + cArray.insert(index, frame); + } } void ActionNode::addFrame(ActionFrame* frame) @@ -228,12 +228,12 @@ void ActionNode::addFrame(ActionFrame* frame) return; } int frameType = frame->getFrameType(); - - if(frameType < _frameArray.size()) - { - auto cArray = _frameArray.at(frameType); - cArray.pushBack(frame); - } + + if(frameType < _frameArray.size()) + { + auto cArray = _frameArray.at(frameType); + cArray.pushBack(frame); + } } void ActionNode::deleteFrame(ActionFrame* frame) @@ -243,19 +243,19 @@ void ActionNode::deleteFrame(ActionFrame* frame) return; } int frameType = frame->getFrameType(); - if(frameType < _frameArray.size()) - { - auto cArray = _frameArray.at(frameType); - cArray.eraseObject(frame); - } + if(frameType < _frameArray.size()) + { + auto cArray = _frameArray.at(frameType); + cArray.eraseObject(frame); + } } void ActionNode::clearAllFrame() { - for(auto array : _frameArray) - { - array.clear(); - } + for(auto array : _frameArray) + { + array.clear(); + } } Spawn * ActionNode::refreshActionProperty() @@ -265,7 +265,7 @@ Spawn * ActionNode::refreshActionProperty() return NULL; } Vector cSpawnArray; - + for (int n = 0; n < _frameArrayNum; n++) { auto cArray = _frameArray.at(n); @@ -287,8 +287,8 @@ Spawn * ActionNode::refreshActionProperty() auto srcFrame = cArray.at(i-1); float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex()) * getUnitTime(); Action* cAction = frame->getAction(duration); - if(cAction != NULL) - cSequenceArray.pushBack(static_cast(cAction)); + if(cAction != NULL) + cSequenceArray.pushBack(static_cast(cAction)); } } Sequence* cSequence = Sequence::create(cSequenceArray); @@ -408,7 +408,7 @@ bool ActionNode::updateActionToTimeLine(float fTime) bool bFindFrame = false; ActionFrame* srcFrame = NULL; -// ActionFrame* destFrame = NULL; + // ActionFrame* destFrame = NULL; for (int n = 0; n < _frameArrayNum; n++) { diff --git a/cocos/editor-support/cocostudio/CCActionNode.h b/cocos/editor-support/cocostudio/CCActionNode.h index 4ff272a573..a31064642a 100644 --- a/cocos/editor-support/cocostudio/CCActionNode.h +++ b/cocos/editor-support/cocostudio/CCActionNode.h @@ -1,26 +1,26 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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. +****************************************************************************/ #ifndef __ActionNODE_H__ #define __ActionNODE_H__ @@ -32,143 +32,143 @@ namespace cocostudio { /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionNode:public cocos2d::Object { public: - - /** - * Default constructor - */ - ActionNode(); - /** - * Default destructor - */ - virtual ~ActionNode(); - /** - * Sets the time interval of frame. - * - * @param fTime the time interval of frame - */ + /** + * Default constructor + */ + ActionNode(); + + /** + * Default destructor + */ + virtual ~ActionNode(); + /** + * Sets the time interval of frame. + * + * @param fTime the time interval of frame + */ void setUnitTime(float fTime); - - /** - * Gets the time interval of frame. - * - * @return fTime the time interval of frame - */ + + /** + * Gets the time interval of frame. + * + * @return fTime the time interval of frame + */ float getUnitTime(); - /** - * Sets tag for ActionNode - * - * @param tag tag of ActionNode - */ + /** + * Sets tag for ActionNode + * + * @param tag tag of ActionNode + */ void setActionTag(int tag); - - /** - * Gets tag for ActionNode - * - * @return tag tag of ActionNode - */ + + /** + * Gets tag for ActionNode + * + * @return tag tag of ActionNode + */ int getActionTag(); - /** - * Sets node which will run a action. - * - * @param node which will run a action - */ + /** + * Sets node which will run a action. + * + * @param node which will run a action + */ void setObject(cocos2d::Object* node); - - /** - * Gets node which will run a action. - * - * @return node which will run a action - */ + + /** + * Gets node which will run a action. + * + * @return node which will run a action + */ cocos2d::Object* getObject(); - /** - * Insets a ActionFrame to ActionNode. - * - * @param index the index of ActionFrame - * - * @param frame the ActionFrame which will be inserted - */ + /** + * Insets a ActionFrame to ActionNode. + * + * @param index the index of ActionFrame + * + * @param frame the ActionFrame which will be inserted + */ void insertFrame(int index, ActionFrame* frame); - - /** - * Pushs back a ActionFrame to ActionNode. - * - * @param frame the ActionFrame which will be added - */ + + /** + * Pushs back a ActionFrame to ActionNode. + * + * @param frame the ActionFrame which will be added + */ void addFrame(ActionFrame* frame); - - /** - * Remove a ActionFrame from ActionNode. - * - * @param frame the ActionFrame which will be removed - */ + + /** + * Remove a ActionFrame from ActionNode. + * + * @param frame the ActionFrame which will be removed + */ void deleteFrame(ActionFrame* frame ); - - /** - * Remove all ActionFrames from ActionNode. - */ + + /** + * Remove all ActionFrames from ActionNode. + */ void clearAllFrame(); - /** - * Gets index of first ActionFrame. - * - * @return index of first ActionFrame - */ + /** + * Gets index of first ActionFrame. + * + * @return index of first ActionFrame + */ int getFirstFrameIndex(); - - /** - * Gets index of last ActionFrame. - * - * @return index of last ActionFrame - */ + + /** + * Gets index of last ActionFrame. + * + * @return index of last ActionFrame + */ int getLastFrameIndex(); - /** - * Updates action states to some time. - * - * @param fTime the time when need to update - */ + /** + * Updates action states to some time. + * + * @param fTime the time when need to update + */ virtual bool updateActionToTimeLine(float fTime); - /** - * Play the action. - */ + /** + * Play the action. + */ virtual void playAction(); - - /** - * Stop the action. - */ + + /** + * Stop the action. + */ virtual void stopAction(); - - /*init properties with a json dictionary*/ + + /*init properties with a json dictionary*/ virtual void initWithDictionary(const rapidjson::Value& dic,Object* root); - /** - * Gets if the action is done once time. - * - * @return that if the action is done once time - */ + /** + * Gets if the action is done once time. + * + * @return that if the action is done once time + */ virtual bool isActionDoneOnce(); protected: int _currentFrameIndex; int _destFrameIndex; - + float _fUnitTime; - + int _actionTag; cocos2d::Spawn * _actionSpawn; cocos2d::Action* _action; cocos2d::Object* _object; - - std::vector> _frameArray; + + std::vector> _frameArray; int _frameArrayNum; protected: diff --git a/cocos/editor-support/cocostudio/CCActionObject.cpp b/cocos/editor-support/cocostudio/CCActionObject.cpp index a44371356e..2b9af9a6b9 100644 --- a/cocos/editor-support/cocostudio/CCActionObject.cpp +++ b/cocos/editor-support/cocostudio/CCActionObject.cpp @@ -1,26 +1,26 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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 "cocostudio/CCActionObject.h" #include "cocostudio/DictionaryHelper.h" @@ -105,23 +105,23 @@ bool ActionObject::isPlaying() void ActionObject::initWithDictionary(const rapidjson::Value& dic, Object* root) { - setName(DICTOOL->getStringValue_json(dic, "name")); - setLoop(DICTOOL->getBooleanValue_json(dic, "loop")); + setName(DICTOOL->getStringValue_json(dic, "name")); + setLoop(DICTOOL->getBooleanValue_json(dic, "loop")); setUnitTime(DICTOOL->getFloatValue_json(dic, "unittime")); - int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist"); + int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist"); int maxLength = 0; - for (int i=0; iautorelease(); const rapidjson::Value& actionNodeDic = DICTOOL->getDictionaryFromArray_json(dic, "actionnodelist", i); - actionNode->initWithDictionary(actionNodeDic,root); + actionNode->initWithDictionary(actionNodeDic,root); actionNode->setUnitTime(getUnitTime()); - _actionNodeList.pushBack(actionNode); + _actionNodeList.pushBack(actionNode); int length = actionNode->getLastFrameIndex() - actionNode->getFirstFrameIndex(); if(length > maxLength) maxLength = length; - } + } _fTotalTime = maxLength*_fTotalTime; } @@ -145,7 +145,7 @@ void ActionObject::removeActionNode(ActionNode* node) void ActionObject::play() { - stop(); + stop(); this->updateToFrameByTime(0.0f); auto frameNum = _actionNodeList.size(); for ( int i = 0; i < frameNum; i++ ) diff --git a/cocos/editor-support/cocostudio/CCActionObject.h b/cocos/editor-support/cocostudio/CCActionObject.h index 9b86009017..086a947f0c 100644 --- a/cocos/editor-support/cocostudio/CCActionObject.h +++ b/cocos/editor-support/cocostudio/CCActionObject.h @@ -1,26 +1,26 @@ /**************************************************************************** - Copyright (c) 2013 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - 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. - ****************************************************************************/ +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +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. +****************************************************************************/ #ifndef __ActionObject_H__ #define __ActionObject_H__ @@ -32,79 +32,79 @@ namespace cocostudio { /** - * @js NA - * @lua NA - */ +* @js NA +* @lua NA +*/ class ActionObject:public cocos2d::Object { public: - - /** - * Default constructor - */ - ActionObject(); - - /** - * Default destructor - */ - virtual ~ActionObject(); - - /** - * Sets name for object - * - * @param name name of object - */ + + /** + * Default constructor + */ + ActionObject(); + + /** + * Default destructor + */ + virtual ~ActionObject(); + + /** + * Sets name for object + * + * @param name name of object + */ void setName(const char* name); - - /** - * Sets name for object - * - * @return name of object - */ + + /** + * Sets name for object + * + * @return name of object + */ const char* getName(); - - /** - * Sets if the action will loop play. - * - * @param bLoop that if the action will loop play - */ + + /** + * Sets if the action will loop play. + * + * @param bLoop that if the action will loop play + */ void setLoop(bool bLoop); - - /** - * Gets if the action will loop play. - * - * @return that if the action will loop play - */ + + /** + * Gets if the action will loop play. + * + * @return that if the action will loop play + */ bool getLoop(); - - /** - * Sets the time interval of frame. - * - * @param fTime the time interval of frame - */ + + /** + * Sets the time interval of frame. + * + * @param fTime the time interval of frame + */ void setUnitTime(float fTime); - - /** - * Gets the time interval of frame. - * - * @return fTime the time interval of frame - */ + + /** + * Gets the time interval of frame. + * + * @return fTime the time interval of frame + */ float getUnitTime(); - /** - * Sets the current time of frame. - * - * @param fTime the current time of frame - */ - void setCurrentTime(float fTime); - - /** - * Gets the current time of frame. - * - * @return fTime the current time of frame - */ + /** + * Sets the current time of frame. + * + * @param fTime the current time of frame + */ + void setCurrentTime(float fTime); + + /** + * Gets the current time of frame. + * + * @return fTime the current time of frame + */ float getCurrentTime(); - + /** * Gets the total time of frame. * @@ -113,15 +113,15 @@ public: float getTotalTime(); /** - * Return if the action is playing. - * - * @return true if the action is playing, false the otherwise - */ + * Return if the action is playing. + * + * @return true if the action is playing, false the otherwise + */ bool isPlaying(); - /** - * Play the action. - */ + /** + * Play the action. + */ void play(); /** @@ -131,37 +131,37 @@ public: */ void play(cocos2d::CallFunc* func); - /** + /** * Pause the action. - */ + */ void pause(); - - /** - * Stop the action. - */ + + /** + * Stop the action. + */ void stop(); - /** - * Adds a ActionNode to play the action. - * - * @node the ActionNode which will play the action - */ + /** + * Adds a ActionNode to play the action. + * + * @node the ActionNode which will play the action + */ void addActionNode(ActionNode* node); - - /** - * Removes a ActionNode which play the action. - * - * @node the ActionNode which play the action - */ + + /** + * Removes a ActionNode which play the action. + * + * @node the ActionNode which play the action + */ void removeActionNode(ActionNode* node); - /*update frame method*/ + /*update frame method*/ void updateToFrameByTime(float fTime); - /*init properties with a json dictionary*/ + /*init properties with a json dictionary*/ void initWithDictionary(const rapidjson::Value& dic,Object* root); - /*scheduler update function*/ + /*scheduler update function*/ void simulationActionUpdate(float dt); protected: cocos2d::Vector _actionNodeList;/*actionnode*/ diff --git a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj index 2bf9e83e00..5245e71cdc 100644 --- a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj +++ b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj @@ -11,6 +11,7 @@ + @@ -55,6 +56,7 @@ + diff --git a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters index c031e3f446..89653341c6 100644 --- a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters +++ b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters @@ -135,6 +135,9 @@ armature + + action + @@ -263,5 +266,8 @@ json\rapidjson\internal + + action + \ No newline at end of file From a158e25767b5c685c6381c5743dd73117683feb8 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 26 Dec 2013 16:36:21 +0800 Subject: [PATCH 2/2] modify coco action with new coding rule --- .../editor-support/cocostudio/CCActionNode.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCActionNode.cpp b/cocos/editor-support/cocostudio/CCActionNode.cpp index 14bf5392b3..935186149f 100644 --- a/cocos/editor-support/cocostudio/CCActionNode.cpp +++ b/cocos/editor-support/cocostudio/CCActionNode.cpp @@ -34,15 +34,15 @@ using namespace gui; namespace cocostudio { ActionNode::ActionNode() - : _currentFrameIndex(0) - , _destFrameIndex(0) - , _fUnitTime(0.1f) - , _actionTag(0) - , _actionSpawn(NULL) - , _action(NULL) - , _object(NULL) - , _frameArray(NULL) - , _frameArrayNum(0) +: _currentFrameIndex(0) +, _destFrameIndex(0) +, _fUnitTime(0.1f) +, _actionTag(0) +, _actionSpawn(NULL) +, _action(NULL) +, _object(NULL) +, _frameArray(NULL) +, _frameArrayNum(0) { _frameArrayNum = (int)kKeyframeMax; for(int i = 0; i < _frameArrayNum; i++)