diff --git a/cocos/2d/CCActionEase.h b/cocos/2d/CCActionEase.h index 327fbac4d8..11b1b2a93f 100644 --- a/cocos/2d/CCActionEase.h +++ b/cocos/2d/CCActionEase.h @@ -37,13 +37,20 @@ NS_CC_BEGIN */ /** - @brief Base class for Easing actions + @class ActionEase + @brief Base class for Easing actions. + @detail Ease actions are created from other interval actions. + The ease action will change the timeline of the inner action. @ingroup Actions */ class CC_DLL ActionEase : public ActionInterval { public: + /** + @brief Get the pointer of the inner action. + @return The pointer of the inner action. + */ virtual ActionInterval* getInnerAction(); // @@ -63,15 +70,15 @@ public: virtual void startWithTarget(Node *target) override; virtual void stop() override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: ActionEase() {} virtual ~ActionEase(); - /** initializes the action */ + /** + @brief Initializes the action. + @return Return true when the initialization success, otherwise return false. + */ bool initWithAction(ActionInterval *action); protected: @@ -82,15 +89,23 @@ private: }; /** - @brief Base class for Easing actions with rate parameters + @class EaseRateAction + @brief Base class for Easing actions with rate parameters. + @detail Ease the inner action with specified rate. @ingroup Actions */ class CC_DLL EaseRateAction : public ActionEase { public: - /** set rate value for the actions */ + /** + @brief Set the rate value for the ease rate action. + @param rate The value will be set. + */ inline void setRate(float rate) { _rate = rate; } - /** get rate value for the actions */ + /** + @brief Get the rate value of the ease rate action. + @return Return the rate value of the ease rate action. + */ inline float getRate() const { return _rate; } // @@ -110,7 +125,12 @@ public: CC_CONSTRUCTOR_ACCESS: EaseRateAction() {} virtual ~EaseRateAction(); - /** Initializes the action with the inner action and the rate parameter */ + /** + @brief Initializes the action with the inner action and the rate parameter. + @param pAction The pointer of the inner action. + @param fRate The value of the rate parameter. + @return Return true when the initialization success, otherwise return false. + */ bool initWithAction(ActionInterval *pAction, float fRate); protected: @@ -121,19 +141,24 @@ private: }; /** - @brief EaseIn action with a rate + @class EaseIn + @brief EaseIn action with a rate. + @detail The timeline of inner action will be changed by: + \f$time^rate\f$ @ingroup Actions */ class CC_DLL EaseIn : public EaseRateAction { public: - /** Creates the action with the inner action and the rate parameter */ + /** + @brief Create the action with the inner action and the rate parameter. + @param action The pointer of the inner action. + @param rate The value of the rate parameter. + @return A pointer of EaseIn action. If creation failed, return nil. + */ static EaseIn* create(ActionInterval* action, float rate); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseIn* clone() const override; virtual EaseIn* reverse() const override; @@ -147,19 +172,24 @@ private: }; /** - @brief EaseOut action with a rate + @class EaseOut + @brief EaseOut action with a rate. + @detail The timeline of inner action will be changed by: + \f$time^(1/rate)\f$ @ingroup Actions */ class CC_DLL EaseOut : public EaseRateAction { public: - /** Creates the action with the inner action and the rate parameter */ + /** + @brief Create the action with the inner action and the rate parameter. + @param action The pointer of the inner action. + @param rate The value of the rate parameter. + @return A pointer of EaseOut action. If creation failed, return nil. + */ static EaseOut* create(ActionInterval* action, float rate); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseOut* clone() const override; virtual EaseOut* reverse() const override; @@ -173,19 +203,26 @@ private: }; /** + @class EaseInOut @brief EaseInOut action with a rate + @detail If time * 2 < 1, the timeline of inner action will be changed by: + \f$0.5*{ time }^{ rate }\f$ + Else, the timeline of inner action will be changed by: + \f$1.0-0.5*{ 2-time }^{ rate }\f$ @ingroup Actions */ class CC_DLL EaseInOut : public EaseRateAction { public: - /** Creates the action with the inner action and the rate parameter */ + /** + @brief Create the action with the inner action and the rate parameter. + @param action The pointer of the inner action. + @param rate The value of the rate parameter. + @return A pointer of EaseInOut action. If creation failed, return nil. + */ static EaseInOut* create(ActionInterval* action, float rate); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseInOut* clone() const override; virtual EaseInOut* reverse() const override; @@ -199,19 +236,23 @@ private: }; /** - @brief Ease Exponential In + @class EaseExponentialIn + @brief Ease Exponential In action. + @detail The timeline of inner action will be changed by: + \f${ 2 }^{ 10*(time-1) }-1*0.001\f$ @ingroup Actions */ class CC_DLL EaseExponentialIn : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseExponentialIn action. If creation failed, return nil. + */ static EaseExponentialIn* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseExponentialIn* clone() const override; virtual ActionEase* reverse() const override; @@ -225,19 +266,23 @@ private: }; /** + @class EaseExponentialOut @brief Ease Exponential Out + @detail The timeline of inner action will be changed by: + \f$1-{ 2 }^{ -10*(time-1) }\f$ @ingroup Actions */ class CC_DLL EaseExponentialOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseExponentialOut action. If creation failed, return nil. + */ static EaseExponentialOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseExponentialOut* clone() const override; virtual ActionEase* reverse() const override; @@ -251,19 +296,25 @@ private: }; /** + @class EaseExponentialInOut @brief Ease Exponential InOut + @detail If time * 2 < 1, the timeline of inner action will be changed by: + \f$0.5*{ 2 }^{ 10*(time-1) }\f$ + else, the timeline of inner action will be changed by: + \f$0.5*(2-{ 2 }^{ -10*(time-1) })\f$ @ingroup Actions */ class CC_DLL EaseExponentialInOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseExponentialInOut action. If creation failed, return nil. + */ static EaseExponentialInOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseExponentialInOut* clone() const override; virtual EaseExponentialInOut* reverse() const override; @@ -277,19 +328,23 @@ private: }; /** + @class EaseSineIn @brief Ease Sine In + @detail The timeline of inner action will be changed by: + \f$1-cos(time*\frac { \pi }{ 2 } )\f$ @ingroup Actions */ class CC_DLL EaseSineIn : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseSineIn action. If creation failed, return nil. + */ static EaseSineIn* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseSineIn* clone() const override; virtual ActionEase* reverse() const override; @@ -303,19 +358,23 @@ private: }; /** + @class EaseSineOut @brief Ease Sine Out + @detail The timeline of inner action will be changed by: + \f$sin(time*\frac { \pi }{ 2 } )\f$ @ingroup Actions */ class CC_DLL EaseSineOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseSineOut action. If creation failed, return nil. + */ static EaseSineOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseSineOut* clone() const override; virtual ActionEase* reverse() const override; @@ -329,19 +388,23 @@ private: }; /** + @class EaseSineInOut @brief Ease Sine InOut + @detail The timeline of inner action will be changed by: + \f$-0.5*(cos(\pi *time)-1)\f$ @ingroup Actions */ class CC_DLL EaseSineInOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseSineInOut action. If creation failed, return nil. + */ static EaseSineInOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseSineInOut* clone() const override; virtual EaseSineInOut* reverse() const override; @@ -355,6 +418,7 @@ private: }; /** + @class EaseElastic @brief Ease Elastic abstract class @since v0.8.2 @ingroup Actions @@ -363,9 +427,15 @@ class CC_DLL EaseElastic : public ActionEase { public: - /** get period of the wave in radians. default is 0.3 */ + /** + @brief Get period of the wave in radians. Default value is 0.3. + @return Return the period of the wave in radians. + */ inline float getPeriod() const { return _period; } - /** set period of the wave in radians. */ + /** + @brief Set period of the wave in radians. + @param fPeriod The value will be set. + */ inline void setPeriod(float fPeriod) { _period = fPeriod; } // @@ -386,7 +456,12 @@ public: CC_CONSTRUCTOR_ACCESS: EaseElastic() {} virtual ~EaseElastic() {} - /** Initializes the action with the inner action and the period in radians (default is 0.3) */ + /** + @brief Initializes the action with the inner action and the period in radians. + @param action The pointer of the inner action. + @param period Period of the wave in radians. Default is 0.3. + @return Return true when the initialization success, otherwise return false. + */ bool initWithAction(ActionInterval *action, float period = 0.3f); protected: @@ -398,22 +473,36 @@ private: }; /** + @class EaseElasticIn @brief Ease Elastic In action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @detail If time == 0 or time == 1, the timeline of inner action will not be changed. + Else, the timeline of inner action will be changed by: + \f$-{ 2 }^{ 10*(time-1) }*sin((time-1-\frac { period }{ 4 } )*\pi *2/period)\f$ + + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseElasticIn : public EaseElastic { public: - /** Creates the action with the inner action and the period in radians (default is 0.3) */ + /** + @brief Create the EaseElasticIn action with the inner action and the period in radians. + @param action The pointer of the inner action. + @param period Period of the wave in radians. + @return A pointer of EaseElasticIn action. If creation failed, return nil. + */ static EaseElasticIn* create(ActionInterval *action, float period); + + /** + @brief Create the EaseElasticIn action with the inner action and period value is 0.3. + @param action The pointer of the inner action. + @return A pointer of EaseElasticIn action. If creation failed, return nil. + */ static EaseElasticIn* create(ActionInterval *action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseElasticIn* clone() const override; virtual EaseElastic* reverse() const override; @@ -427,22 +516,35 @@ private: }; /** + @class EaseElasticOut @brief Ease Elastic Out action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @detail If time == 0 or time == 1, the timeline of inner action will not be changed. + Else, the timeline of inner action will be changed by: + \f${ 2 }^{ -10*time }*sin((time-\frac { period }{ 4 } )*\pi *2/period)+1\f$ + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseElasticOut : public EaseElastic { public: - /** Creates the action with the inner action and the period in radians (default is 0.3) */ + /** + @brief Create the EaseElasticOut action with the inner action and the period in radians. + @param action The pointer of the inner action. + @param period Period of the wave in radians. + @return A pointer of EaseElasticOut action. If creation failed, return nil. + */ static EaseElasticOut* create(ActionInterval *action, float period); + + /** + @brief Create the EaseElasticOut action with the inner action and period value is 0.3. + @param action The pointer of the inner action. + @return A pointer of EaseElasticOut action. If creation failed, return nil. + */ static EaseElasticOut* create(ActionInterval *action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseElasticOut* clone() const override; virtual EaseElastic* reverse() const override; @@ -456,22 +558,32 @@ private: }; /** + @class EaseElasticInOut @brief Ease Elastic InOut action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseElasticInOut : public EaseElastic { public: - /** Creates the action with the inner action and the period in radians (default is 0.3) */ + /** + @brief Create the EaseElasticInOut action with the inner action and the period in radians. + @param action The pointer of the inner action. + @param period Period of the wave in radians. + @return A pointer of EaseElasticInOut action. If creation failed, return nil. + */ static EaseElasticInOut* create(ActionInterval *action, float period); + + /** + @brief Create the EaseElasticInOut action with the inner action and period value is 0.3. + @param action The pointer of the inner action. + @return A pointer of EaseElasticInOut action. If creation failed, return nil. + */ static EaseElasticInOut* create(ActionInterval *action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseElasticInOut* clone() const override; virtual EaseElasticInOut* reverse() const override; @@ -485,6 +597,7 @@ private: }; /** + @class EaseBounce @brief EaseBounce abstract class. @since v0.8.2 @ingroup Actions @@ -515,21 +628,24 @@ private: }; /** + @class EaseBounceIn @brief EaseBounceIn action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseBounceIn : public EaseBounce { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseBounceIn action. If creation failed, return nil. + */ static EaseBounceIn* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseBounceIn* clone() const override; virtual EaseBounce* reverse() const override; @@ -543,21 +659,24 @@ private: }; /** + @class EaseBounceOut @brief EaseBounceOut action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseBounceOut : public EaseBounce { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseBounceOut action. If creation failed, return nil. + */ static EaseBounceOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseBounceOut* clone() const override; virtual EaseBounce* reverse() const override; @@ -571,21 +690,24 @@ private: }; /** + @class EaseBounceInOut @brief EaseBounceInOut action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseBounceInOut : public EaseBounce { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseBounceInOut action. If creation failed, return nil. + */ static EaseBounceInOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseBounceInOut* clone() const override; virtual EaseBounceInOut* reverse() const override; @@ -599,21 +721,24 @@ private: }; /** + @class EaseBackIn @brief EaseBackIn action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseBackIn : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseBackIn action. If creation failed, return nil. + */ static EaseBackIn* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseBackIn* clone() const override; virtual ActionEase* reverse() const override; @@ -627,21 +752,24 @@ private: }; /** + @class EaseBackOut @brief EaseBackOut action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseBackOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseBackOut action. If creation failed, return nil. + */ static EaseBackOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseBackOut* clone() const override; virtual ActionEase* reverse() const override; @@ -655,21 +783,24 @@ private: }; /** + @class EaseBackInOut @brief EaseBackInOut action. - @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. + @warning This action doesn't use a bijective function. + Actions like Sequence might have an unexpected result when used with this action. @since v0.8.2 @ingroup Actions */ class CC_DLL EaseBackInOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseBackInOut action. If creation failed, return nil. + */ static EaseBackInOut* create(ActionInterval* action); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseBackInOut* clone() const override; virtual EaseBackInOut* reverse() const override; @@ -684,22 +815,27 @@ private: /** +@class EaseBezierAction @brief Ease Bezier @ingroup Actions */ class CC_DLL EaseBezierAction : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseBezierAction action. If creation failed, return nil. + */ static EaseBezierAction* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseBezierAction* clone() const override; virtual EaseBezierAction* reverse() const override; + /** + @brief Set the bezier parameters. + */ virtual void setBezierParamer( float p0, float p1, float p2, float p3); CC_CONSTRUCTOR_ACCESS: @@ -717,18 +853,20 @@ private: }; /** +@class EaseQuadraticActionIn @brief Ease Quadratic In @ingroup Actions */ class CC_DLL EaseQuadraticActionIn : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuadraticActionIn action. If creation failed, return nil. + */ static EaseQuadraticActionIn* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuadraticActionIn* clone() const override; virtual EaseQuadraticActionIn* reverse() const override; @@ -743,18 +881,20 @@ private: }; /** +@class EaseQuadraticActionOut @brief Ease Quadratic Out @ingroup Actions */ class CC_DLL EaseQuadraticActionOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuadraticActionOut action. If creation failed, return nil. + */ static EaseQuadraticActionOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuadraticActionOut* clone() const override; virtual EaseQuadraticActionOut* reverse() const override; @@ -769,18 +909,20 @@ private: }; /** +@class EaseQuadraticActionInOut @brief Ease Quadratic InOut @ingroup Actions */ class CC_DLL EaseQuadraticActionInOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuadraticActionInOut action. If creation failed, return nil. + */ static EaseQuadraticActionInOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuadraticActionInOut* clone() const override; virtual EaseQuadraticActionInOut* reverse() const override; @@ -794,18 +936,20 @@ private: }; /** +@class EaseQuarticActionIn @brief Ease Quartic In @ingroup Actions */ class CC_DLL EaseQuarticActionIn : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuarticActionIn action. If creation failed, return nil. + */ static EaseQuarticActionIn* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuarticActionIn* clone() const override; virtual EaseQuarticActionIn* reverse() const override; @@ -819,18 +963,20 @@ private: }; /** +@class EaseQuarticActionOut @brief Ease Quartic Out @ingroup Actions */ class CC_DLL EaseQuarticActionOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuarticActionOut action. If creation failed, return nil. + */ static EaseQuarticActionOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuarticActionOut* clone() const override; virtual EaseQuarticActionOut* reverse() const override; @@ -844,18 +990,20 @@ private: }; /** +@class EaseQuarticActionInOut @brief Ease Quartic InOut @ingroup Actions */ class CC_DLL EaseQuarticActionInOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuarticActionInOut action. If creation failed, return nil. + */ static EaseQuarticActionInOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuarticActionInOut* clone() const override; virtual EaseQuarticActionInOut* reverse() const override; @@ -870,18 +1018,20 @@ private: /** +@class EaseQuinticActionIn @brief Ease Quintic In @ingroup Actions */ class CC_DLL EaseQuinticActionIn : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuinticActionIn action. If creation failed, return nil. + */ static EaseQuinticActionIn* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuinticActionIn* clone() const override; virtual EaseQuinticActionIn* reverse() const override; @@ -895,18 +1045,20 @@ private: }; /** +@class EaseQuinticActionOut @brief Ease Quintic Out @ingroup Actions */ class CC_DLL EaseQuinticActionOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuinticActionOut action. If creation failed, return nil. + */ static EaseQuinticActionOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuinticActionOut* clone() const override; virtual EaseQuinticActionOut* reverse() const override; @@ -920,18 +1072,20 @@ private: }; /** +@class EaseQuinticActionInOut @brief Ease Quintic InOut @ingroup Actions */ class CC_DLL EaseQuinticActionInOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseQuinticActionInOut action. If creation failed, return nil. + */ static EaseQuinticActionInOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseQuinticActionInOut* clone() const override; virtual EaseQuinticActionInOut* reverse() const override; @@ -945,18 +1099,20 @@ private: }; /** +@class EaseCircleActionIn @brief Ease Circle In @ingroup Actions */ class CC_DLL EaseCircleActionIn : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseCircleActionIn action. If creation failed, return nil. + */ static EaseCircleActionIn* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseCircleActionIn* clone() const override; virtual EaseCircleActionIn* reverse() const override; @@ -970,18 +1126,20 @@ private: }; /** +@class EaseCircleActionOut @brief Ease Circle Out @ingroup Actions */ class CC_DLL EaseCircleActionOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseCircleActionOut action. If creation failed, return nil. + */ static EaseCircleActionOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseCircleActionOut* clone() const override; virtual EaseCircleActionOut* reverse() const override; @@ -995,18 +1153,20 @@ private: }; /** +@class EaseCircleActionInOut @brief Ease Circle InOut @ingroup Actions */ class CC_DLL EaseCircleActionInOut:public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseCircleActionInOut action. If creation failed, return nil. + */ static EaseCircleActionInOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseCircleActionInOut* clone() const override; virtual EaseCircleActionInOut* reverse() const override; @@ -1020,18 +1180,20 @@ private: }; /** +@class EaseCubicActionIn @brief Ease Cubic In @ingroup Actions */ class CC_DLL EaseCubicActionIn:public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseCubicActionIn action. If creation failed, return nil. + */ static EaseCubicActionIn* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseCubicActionIn* clone() const override; virtual EaseCubicActionIn* reverse() const override; @@ -1045,18 +1207,20 @@ private: }; /** +@class EaseCubicActionOut @brief Ease Cubic Out @ingroup Actions */ class CC_DLL EaseCubicActionOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseCubicActionOut action. If creation failed, return nil. + */ static EaseCubicActionOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseCubicActionOut* clone() const override; virtual EaseCubicActionOut* reverse() const override; @@ -1070,18 +1234,20 @@ private: }; /** +@class EaseCubicActionInOut @brief Ease Cubic InOut @ingroup Actions */ class CC_DLL EaseCubicActionInOut : public ActionEase { public: - /** creates the action */ + /** + @brief Create the action with the inner action. + @param action The pointer of the inner action. + @return A pointer of EaseCubicActionInOut action. If creation failed, return nil. + */ static EaseCubicActionInOut* create(ActionInterval* action); - /** - * @param time in seconds - */ virtual void update(float time) override; virtual EaseCubicActionInOut* clone() const override; virtual EaseCubicActionInOut* reverse() const override; diff --git a/cocos/2d/CCActionGrid.h b/cocos/2d/CCActionGrid.h index ea38ef2337..e37f201ad0 100644 --- a/cocos/2d/CCActionGrid.h +++ b/cocos/2d/CCActionGrid.h @@ -39,12 +39,19 @@ class NodeGrid; * @{ */ -/** @brief Base class for Grid actions */ +/** +@class GridAction +@brief Base class for Grid actions. +@detail Grid actions are the actions take effect on GridBase. +*/ class CC_DLL GridAction : public ActionInterval { public: - /** returns the grid */ + /** + @brief Get the pointer of GridBase. + @return The pointer of GridBase. + */ virtual GridBase* getGrid(); // overrides @@ -60,8 +67,10 @@ CC_CONSTRUCTOR_ACCESS: GridAction() {} virtual ~GridAction() {} /** - * initializes the action with size and duration - * @param duration in seconds + * @brief Initializes the action with size and duration. + * @param duration The duration of the GridAction. It's a value in seconds. + * @param gridSize The size of the GridAction should be. + * @return Return true when the initialization success, otherwise return false. */ bool initWithDuration(float duration, const Size& gridSize); @@ -78,15 +87,18 @@ private: /** @brief Base class for Grid3D actions. - Grid3D actions can modify a non-tiled grid. + @detail Grid3D actions can modify a non-tiled grid. */ class CC_DLL Grid3DAction : public GridAction { public: - /** returns the grid */ + virtual GridBase* getGrid() override; - /** returns the vertex than belongs to certain position in the grid + /** + * @brief Get the vertex that belongs to certain position in the grid. + * @param position The position of the grid. + * @return Return a pointer of vertex. * @js NA * @lua NA */ @@ -98,7 +110,10 @@ public: */ CC_DEPRECATED_ATTRIBUTE inline Vec3 vertex(const Vec2& position) { return getVertex(position); } - /** returns the non-transformed vertex than belongs to certain position in the grid + /** + * @brief Get the non-transformed vertex that belongs to certain position in the grid. + * @param position The position of the grid. + * @return Return a pointer of vertex. * @js NA * @lua NA */ @@ -110,7 +125,10 @@ public: */ CC_DEPRECATED_ATTRIBUTE inline Vec3 originalVertex(const Vec2& position) { return getOriginalVertex(position); } - /** sets a new vertex to a certain position of the grid + /** + * @brief Set a new vertex to a certain position of the grid. + * @param position The position of the grid. + * @param vertex The vertex will be used on the certain position of grid. * @js NA * @lua NA */ @@ -124,17 +142,26 @@ public: } }; -/** @brief Base class for TiledGrid3D actions */ +/** +@brief Base class for TiledGrid3D actions +*/ class CC_DLL TiledGrid3DAction : public GridAction { public: - /** creates the action with size and duration + /** + * @brief Create the action with size and duration. + * @param duration The duration of the action. It's a value in seconds. + * @param gridSize Specify the grid size of the action. + * @return A pointer of TiledGrid3DAction. If creation failed, return nil. * @js NA * @lua NA */ static TiledGrid3DAction* create(float duration, const Size& gridSize); - /** returns the tile that belongs to a certain position of the grid + /** + * @brief Get the tile that belongs to a certain position of the grid. + * @param position The position of the tile want to get. + * @return A quadrilateral of the tile. * @js NA * @lua NA */ @@ -146,19 +173,25 @@ public: */ CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Vec2& position) { return getTile(position); } - /** returns the non-transformed tile that belongs to a certain position of the grid + /** + * @brief Get the non-transformed tile that belongs to a certain position of the grid. + * @param position The position of the tile want to get. + * @return A quadrilateral of the tile. * @js NA * @lua NA */ Quad3 getOriginalTile(const Vec2& position) const; - /** @deprecated Use getOriginalTile() instead + /** @deprecated Use getOriginalTile() instead. * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Vec2& position) { return getOriginalTile(position); } - /** sets a new tile to a certain position of the grid + /** + * @brief Set a new tile to a certain position of the grid. + * @param position The position of the tile. + * @param coords The quadrilateral of the new tile. * @js NA * @lua NA */ @@ -175,23 +208,33 @@ public: } }; -/** @brief AccelDeccelAmplitude action */ +/** +@brief AccelDeccelAmplitude action. +*/ class CC_DLL AccelDeccelAmplitude : public ActionInterval { public: - /** creates the action with an inner action that has the amplitude property, and a duration time */ + /** + @brief Create the action with an inner action that has the amplitude property, and a duration time. + @@param action A pointer of the inner action. + @param duration Specify the duration of the AccelDeccelAmplitude action. + @return Return a pointer of AccelDeccelAmplitude action. When the creation failed, return nil. + */ static AccelDeccelAmplitude* create(Action *action, float duration); - /** get amplitude rate */ + /** + @brief Get the value of amplitude rate. + @return the value of amplitude rate. + */ inline float getRate(void) const { return _rate; } - /** set amplitude rate */ + /** + @brief Set the value of amplitude rate. + @param rate Specify the value of amplitude rate. + */ inline void setRate(float rate) { _rate = rate; } // Overrides virtual void startWithTarget(Node *target) override; - /** - * @param time in seconds - */ virtual void update(float time) override; virtual AccelDeccelAmplitude* clone() const override; virtual AccelDeccelAmplitude* reverse() const override; @@ -200,7 +243,12 @@ CC_CONSTRUCTOR_ACCESS: AccelDeccelAmplitude() {} virtual ~AccelDeccelAmplitude(); - /** initializes the action with an inner action that has the amplitude property, and a duration time */ + /** + @brief Initializes the action with an inner action that has the amplitude property, and a duration time. + @param action A pointer of the inner action. + @param duration Specify the duration of the AccelDeccelAmplitude action. + @return If the initialization success, return true; otherwise, return false. + */ bool initWithAction(Action *action, float duration); protected: @@ -211,23 +259,33 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude); }; -/** @brief AccelAmplitude action */ +/** +@brief AccelAmplitude action. +*/ class CC_DLL AccelAmplitude : public ActionInterval { public: - /** creates the action with an inner action that has the amplitude property, and a duration time */ + /** + @brief Create the action with an inner action that has the amplitude property, and a duration time. + @param action A pointer of the inner action. + @param duration Specify the duration of the AccelAmplitude action. + @return Return a pointer of AccelAmplitude action. When the creation failed, return nil. + */ static AccelAmplitude* create(Action *action, float duration); - /** get amplitude rate */ + /** + @brief Get the value of amplitude rate. + @return The value of amplitude rate. + */ inline float getRate() const { return _rate; } - /** set amplitude rate */ + /** + @brief Set the value of amplitude rate. + @param rate Specify the value of amplitude rate. + */ inline void setRate(float rate) { _rate = rate; } // Overrides virtual void startWithTarget(Node *target) override; - /** - * @param time in seconds - */ virtual void update(float time) override; virtual AccelAmplitude* clone() const override; virtual AccelAmplitude* reverse() const override; @@ -246,23 +304,33 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude); }; -/** @brief DeccelAmplitude action */ +/** +@brief DeccelAmplitude action +*/ class CC_DLL DeccelAmplitude : public ActionInterval { public: - /** creates the action with an inner action that has the amplitude property, and a duration time */ + /** + @brief Creates the action with an inner action that has the amplitude property, and a duration time. + @param action A pointer of the inner action. + @param duration Specify the duration of the DeccelAmplitude action. + @return Return a pointer of DeccelAmplitude. When the creation failed, return nil. + */ static DeccelAmplitude* create(Action *action, float duration); - /** get amplitude rate */ + /** + @brief Get the value of amplitude rate. + @return The value of amplitude rate. + */ inline float getRate() const { return _rate; } - /** set amplitude rate */ + /** + @brief Set the value of amplitude rate. + @param rate Specify the value. + */ inline void setRate(float rate) { _rate = rate; } // overrides virtual void startWithTarget(Node *target) override; - /** - * @param time in seconds - */ virtual void update(float time) override; virtual DeccelAmplitude* clone() const override; virtual DeccelAmplitude* reverse() const override; @@ -271,7 +339,12 @@ CC_CONSTRUCTOR_ACCESS: DeccelAmplitude() {} virtual ~DeccelAmplitude(); - /** initializes the action with an inner action that has the amplitude property, and a duration time */ + /** + @brief Initializes the action with an inner action that has the amplitude property, and a duration time. + @param action The pointer of inner action. + @param duration The duration of the DeccelAmplitude action. + @return If the initilization sucess, return true; otherwise, return false. + */ bool initWithAction(Action *action, float duration); protected: @@ -282,7 +355,8 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude); }; -/** @brief StopGrid action. +/** + @brief StopGrid action. @warning Don't call this action if another grid action is active. Call if you want to remove the the grid effect. Example: Sequence::actions(Lens::action(...), StopGrid::action(...), nullptr); @@ -290,7 +364,10 @@ private: class CC_DLL StopGrid : public ActionInstant { public: - /** Allocates and initializes the action */ + /** + @brief Create a StopGrid Action. + @return Return a pointer of StopGrid. When the creation failed, return nil. + */ static StopGrid* create(); // Overrides @@ -311,11 +388,17 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(StopGrid); }; -/** @brief ReuseGrid action */ +/** +@brief ReuseGrid action. +*/ class CC_DLL ReuseGrid : public ActionInstant { public: - /** creates an action with the number of times that the current grid will be reused */ + /** + @brief Create an action with the number of times that the current grid will be reused. + @param times Specify times the grid will be reused. + @return Return a pointer of ReuseGrid. When the creation failed, return nil. + */ static ReuseGrid* create(int times); // Override @@ -327,7 +410,11 @@ CC_CONSTRUCTOR_ACCESS: ReuseGrid() {} virtual ~ReuseGrid() {} - /** initializes an action with the number of times that the current grid will be reused */ + /** + @brief Initializes an action with the number of times that the current grid will be reused. + @param times Specify times the grid will be reused. + @return If the initialization sucess, return true; otherwise, return false. + */ bool initWithTimes(int times); protected: diff --git a/cocos/2d/CCActionGrid3D.h b/cocos/2d/CCActionGrid3D.h index ea9bbec084..d357277251 100644 --- a/cocos/2d/CCActionGrid3D.h +++ b/cocos/2d/CCActionGrid3D.h @@ -36,36 +36,62 @@ NS_CC_BEGIN */ /** -@brief Waves3D action +@brief Waves3D action. +@detail This action is used for take effect on the target node as 3D waves. + You can control the effect by these parameters: + duration, grid size, waves count, amplitude. */ class CC_DLL Waves3D : public Grid3DAction { public: - /** creates an action with duration, grid size, waves and amplitude */ + /** + @brief Create an action with duration, grid size, waves and amplitude. + @param duration Specify the duration of the Waves3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param waves Specify the waves count of the Waves3D action. + @param amplitude Specify the amplitude of the Waves3D action. + @return If the creation sucess, return a pointer of Waves3D action; otherwise, return nil. + */ static Waves3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude); - /** returns the amplitude of the effect */ + /** + @brief Get the amplitude of the effect. + @return Return the amplitude of the effect. + */ inline float getAmplitude() const { return _amplitude; } - /** sets the amplitude to the effect */ + /** + @brief Set the amplitude to the effect. + @param amplitude The value of amplitude will be set. + */ inline void setAmplitude(float amplitude) { _amplitude = amplitude; } - /** returns the amplitude rate */ + /** + @brief Get the amplitude rate of the effect. + @return Return the amplitude rate of the effect. + */ inline float getAmplitudeRate() const { return _amplitudeRate; } - /** sets the ampliture rate */ + /** + @brief Set the ampliture rate of the effect. + @param amplitudeRate The value of amplitude rate will be set. + */ inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; } // Overrides virtual Waves3D* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: Waves3D() {} virtual ~Waves3D() {} - /** initializes an action with duration, grid size, waves and amplitude */ + /** + @brief Initializes an action with duration, grid size, waves and amplitude. + @param duration Specify the duration of the Waves3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param waves Specify the waves count of the Waves3D action. + @param amplitude Specify the amplitude of the Waves3D action. + @return If the initialization success, return true; otherwise, return false. + */ bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude); protected: @@ -77,43 +103,62 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Waves3D); }; -/** @brief FlipX3D action */ +/** +@brief FlipX3D action. +@detail This action is used for flipping the target node on the x axis. +*/ class CC_DLL FlipX3D : public Grid3DAction { public: - /** creates the action with duration */ + /** + @brief Create the action with duration. + @param duration Specify the duration of the FilpX3D action. It's a value in seconds. + @return If the creation sucess, return a pointer of FilpX3D action; otherwise, return nil. + */ static FlipX3D* create(float duration); // Override virtual FlipX3D* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: FlipX3D() {} virtual ~FlipX3D() {} - /** initializes the action with duration */ + /** + @brief Initializes an action with duration. + @param duration Specify the duration of the FlipX3D action. It's a value in seconds. + @return If the initialization success, return true; otherwise, return false. + */ bool initWithDuration(float duration); + + /** + @brief Initializes an action with duration and grid size. + @param gridSize Specify the grid size of the FlipX3D action. + @param duration Specify the duration of the FlipX3D action. It's a value in seconds. + @return If the initialization success, return true; otherwise, return false. + */ virtual bool initWithSize(const Size& gridSize, float duration); private: CC_DISALLOW_COPY_AND_ASSIGN(FlipX3D); }; -/** @brief FlipY3D action */ +/** +@brief FlipY3D action. +@detail This action is used for flipping the target node on the y axis. +*/ class CC_DLL FlipY3D : public FlipX3D { public: - /** creates the action with duration */ + /** + @brief Create the action with duration. + @param duration Specify the duration of the FlipY3D action. It's a value in seconds. + @return If the creation sucess, return a pointer of FlipY3D action; otherwise, return nil. + */ static FlipY3D* create(float duration); // Overrides - /** - * @param time in seconds - */ virtual void update(float time) override; virtual FlipY3D* clone() const override; @@ -124,35 +169,72 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(FlipY3D); }; -/** @brief Lens3D action */ +/** +@brief Lens3D action. +@detail This action is used for take effect on the target node as lens. + You can create the action by these parameters: + duration, grid size, center position of lens, radius of lens. + Also you can change the lens effect value & whether effect is concave by the setter methods. +*/ class CC_DLL Lens3D : public Grid3DAction { public: - /** creates the action with center position, radius, a grid size and duration */ + /** + @brief Create the action with center position, radius, a grid size and duration. + @param duration Specify the duration of the Lens3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param position Specify the center position of the lens. + @param radius Specify the radius of the lens. + @return If the creation sucess, return a pointer of Lens3D action; otherwise, return nil. + */ static Lens3D* create(float duration, const Size& gridSize, const Vec2& position, float radius); - /** Get lens center position */ + /** + @brief Get the value of lens effect. Default value is 0.7. + @return The value of lens effect. + */ inline float getLensEffect() const { return _lensEffect; } - /** Set lens center position */ + + /** + @brief Set the value of lens effect. + @param lensEffect The value of lens effect will be set. + */ inline void setLensEffect(float lensEffect) { _lensEffect = lensEffect; } - /** Set whether lens is concave */ + + /** + @brief Set whether lens is concave. + @param concave Whether lens is concave. + */ inline void setConcave(bool concave) { _concave = concave; } - + + /** + @brief Get the center position of lens effect. + @return The center position of lens effect. + */ inline const Vec2& getPosition() const { return _position; } + + /** + @brief Set the center position of lens effect. + @param The center position will be set. + */ void setPosition(const Vec2& position); // Overrides virtual Lens3D* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: Lens3D() {} virtual ~Lens3D() {} - /** initializes the action with center position, radius, a grid size and duration */ + /** + @brief Initializes the action with center position, radius, grid size and duration. + @param duration Specify the duration of the Lens3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param position Specify the center position of the lens effect. + @param radius Specify the radius of the lens effect. + @return If the initialization success, return true; otherwise, return false. + */ bool initWithDuration(float duration, const Size& gridSize, const Vec2& position, float radius); protected: @@ -170,36 +252,79 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Lens3D); }; -/** @brief Ripple3D action */ +/** +@brief Ripple3D action. +@detail This action is used for take effect on the target node as ripple. + You can create the action by these parameters: + duration, grid size, center position of ripple, + radius of ripple, waves count, amplitude. +*/ class CC_DLL Ripple3D : public Grid3DAction { public: - /** creates the action with radius, number of waves, amplitude, a grid size and duration */ + /** + @brief Create the action with center position, radius, number of waves, amplitude, a grid size and duration. + @param duration Specify the duration of the Ripple3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param position Specify the center position of the ripple effect. + @param radius Specify the radius of the ripple effect. + @param waves Specify the waves count of the ripple effect. + @param amplitude Specify the amplitude of the ripple effect. + @return If the creation sucess, return a pointer of Ripple3D action; otherwise, return nil. + */ static Ripple3D* create(float duration, const Size& gridSize, const Vec2& position, float radius, unsigned int waves, float amplitude); - /** get center position */ + /** + @brief Get the center position of ripple effect. + @return The center position of ripple effect. + */ inline const Vec2& getPosition() const { return _position; } - /** set center position */ + /** + @brief Set the center position of ripple effect. + @param position The center position of ripple effect will be set. + */ void setPosition(const Vec2& position); + /** + @brief Get the amplitude of ripple effect. + @return The amplitude of ripple effect. + */ inline float getAmplitude() const { return _amplitude; } + /** + @brief Set the amplitude of ripple effect. + @param fAmplitude The amplitude of ripple effect. + */ inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; } + /** + @brief Get the amplitude rate of ripple effect. + @return The amplitude rate of ripple effect. + */ inline float getAmplitudeRate() const { return _amplitudeRate; } + /** + @brief Set the amplitude rate of ripple effect. + @param fAmplitudeRate The amplitude rate of ripple effect. + */ inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; } // Override virtual Ripple3D* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: Ripple3D() {} virtual ~Ripple3D() {} - /** initializes the action with radius, number of waves, amplitude, a grid size and duration */ + /** + @brief Initializes the action with center position, radius, number of waves, amplitude, a grid size and duration. + @param duration Specify the duration of the Ripple3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param position Specify the center position of the ripple effect. + @param radius Specify the radius of the ripple effect. + @param waves Specify the waves count of the ripple effect. + @param amplitude Specify the amplitude of the ripple effect. + @return If the initialization success, return true; otherwise, return false. + */ bool initWithDuration(float duration, const Size& gridSize, const Vec2& position, float radius, unsigned int waves, float amplitude); protected: @@ -214,12 +339,24 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Ripple3D); }; -/** @brief Shaky3D action */ +/** +@brief Shaky3D action. +@detail This action is used for take effect on the target node as shaky. + You can create the action by these parameters: + duration, grid size, range, whether shake on the z axis. +*/ class CC_DLL Shaky3D : public Grid3DAction { public: - /** creates the action with a range, shake Z vertices, a grid and duration */ - static Shaky3D* create(float duration, const Size& gridSize, int range, bool shakeZ); + /** + @brief Create the action with a range, shake Z vertices, a grid and duration. + @param duration Specify the duration of the Shaky3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param range Specify the range of the shaky effect. + @param shakeZ Specify whether shake on the z axis. + @return If the creation sucess, return a pointer of Shaky3D action; otherwise, return nil. + */ + static Shaky3D* create(float initWithDuration, const Size& gridSize, int range, bool shakeZ); // Overrides virtual Shaky3D* clone() const override; @@ -230,9 +367,13 @@ CC_CONSTRUCTOR_ACCESS: virtual ~Shaky3D() {} /** - * initializes the action with a range, shake Z vertices, a grid and duration - * @param duration in seconds - */ + @brief Initializes the action with a range, shake Z vertices, grid size and duration. + @param duration Specify the duration of the Shaky3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param range Specify the range of the shaky effect. + @param shakeZ Specify whether shake on the z axis. + @return If the Initialization sucess, return true; otherwise, return false. + */ bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ); protected: @@ -243,31 +384,63 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Shaky3D); }; -/** @brief Liquid action */ +/** +@brief Liquid action. +@detail This action is used for take effect on the target node as liquid. + You can create the action by these parameters: + duration, grid size, waves count, amplitude of the liquid effect. +*/ class CC_DLL Liquid : public Grid3DAction { public: - /** creates the action with amplitude, a grid and duration */ + /** + @brief Create the action with amplitude, grid size, waves count and duration. + @param duration Specify the duration of the Liquid action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param waves Specify the waves count of the Liquid action. + @param amplitude Specify the amplitude of the Liquid action. + @return If the creation sucess, return a pointer of Liquid action; otherwise, return nil. + */ static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude); + /** + @brief Get the amplitude of the effect. + @return Return the amplitude of the effect. + */ inline float getAmplitude() const { return _amplitude; } + /** + @brief Set the amplitude to the effect. + @param amplitude The value of amplitude will be set. + */ inline void setAmplitude(float amplitude) { _amplitude = amplitude; } + /** + @brief Get the amplitude rate of the effect. + @return Return the amplitude rate of the effect. + */ inline float getAmplitudeRate() const { return _amplitudeRate; } + /** + @brief Set the ampliture rate of the effect. + @param amplitudeRate The value of amplitude rate will be set. + */ inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; } // Overrides virtual Liquid* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: Liquid() {} virtual ~Liquid() {} - /** initializes the action with amplitude, a grid and duration */ + /** + @brief Initializes the action with amplitude, grid size, waves count and duration. + @param duration Specify the duration of the Liquid action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param waves Specify the waves count of the Liquid action. + @param amplitude Specify the amplitude of the Liquid action. + @return If the initialization sucess, return true; otherwise, return false. + */ bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude); protected: @@ -279,31 +452,68 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Liquid); }; -/** @brief Waves action */ +/** +@brief Waves action. +@detail This action is used for take effect on the target node as waves. + You can control the effect by these parameters: + duration, grid size, waves count, amplitude, + whether waves on horizontal and whether waves on vertical. +*/ class CC_DLL Waves : public Grid3DAction { public: - /** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */ + /** + @brief Create the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration. + @param duration Specify the duration of the Waves action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param waves Specify the waves count of the Waves action. + @param amplitude Specify the amplitude of the Waves action. + @param horizontal Specify whether waves on horizontal. + @param vertical Specify whether waves on vertical. + @return If the creation sucess, return a pointer of Waves action; otherwise, return nil. + */ static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical); + /** + @brief Get the amplitude of the effect. + @return Return the amplitude of the effect. + */ inline float getAmplitude() const { return _amplitude; } + /** + @brief Set the amplitude to the effect. + @param amplitude The value of amplitude will be set. + */ inline void setAmplitude(float amplitude) { _amplitude = amplitude; } + /** + @brief Get the amplitude rate of the effect. + @return Return the amplitude rate of the effect. + */ inline float getAmplitudeRate() const { return _amplitudeRate; } + /** + @brief Set the ampliture rate of the effect. + @param amplitudeRate The value of amplitude rate will be set. + */ inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; } // Overrides virtual Waves* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: Waves() {} virtual ~Waves() {} - /** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */ + /** + @brief Initializes the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration. + @param duration Specify the duration of the Waves action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param waves Specify the waves count of the Waves action. + @param amplitude Specify the amplitude of the Waves action. + @param horizontal Specify whether waves on horizontal. + @param vertical Specify whether waves on vertical. + @return If the initialization sucess, return true; otherwise, return false. + */ bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical); protected: @@ -317,37 +527,77 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Waves); }; -/** @brief Twirl action */ +/** +@brief Twirl action. +@detail This action is used for take effect on the target node as twirl. + You can control the effect by these parameters: + duration, grid size, center position, twirls count, amplitude. +*/ class CC_DLL Twirl : public Grid3DAction { public: - /** creates the action with center position, number of twirls, amplitude, a grid size and duration */ + /** + @brief Create the action with center position, number of twirls, amplitude, a grid size and duration. + @param duration Specify the duration of the Twirl action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param position Specify the center position of the twirl action. + @param twirls Specify the twirls count of the Twirl action. + @param amplitude Specify the amplitude of the Twirl action. + @return If the creation sucess, return a pointer of Twirl action; otherwise, return nil. + */ static Twirl* create(float duration, const Size& gridSize, Vec2 position, unsigned int twirls, float amplitude); - /** get twirl center */ + /** + @brief Get the center position of twirl action. + @return The center position of twirl action. + */ inline const Vec2& getPosition() const { return _position; } - /** set twirl center */ + /** + @brief Set the center position of twirl action. + @param position The center position of twirl action will be set. + */ void setPosition(const Vec2& position); + /** + @brief Get the amplitude of the effect. + @return Return the amplitude of the effect. + */ inline float getAmplitude() const { return _amplitude; } + /** + @brief Set the amplitude to the effect. + @param amplitude The value of amplitude will be set. + */ inline void setAmplitude(float amplitude) { _amplitude = amplitude; } + /** + @brief Get the amplitude rate of the effect. + @return Return the amplitude rate of the effect. + */ inline float getAmplitudeRate() const { return _amplitudeRate; } + /** + @brief Set the ampliture rate of the effect. + @param amplitudeRate The value of amplitude rate will be set. + */ inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; } // Overrides virtual Twirl* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: Twirl() {} virtual ~Twirl() {} - - /** initializes the action with center position, number of twirls, amplitude, a grid size and duration */ + + /** + @brief Initializes the action with center position, number of twirls, amplitude, a grid size and duration. + @param duration Specify the duration of the Twirl action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @param position Specify the center position of the twirl action. + @param twirls Specify the twirls count of the Twirl action. + @param amplitude Specify the amplitude of the Twirl action. + @return If the initialization sucess, return true; otherwise, return false. + */ bool initWithDuration(float duration, const Size& gridSize, Vec2 position, unsigned int twirls, float amplitude); protected: diff --git a/cocos/2d/CCActionPageTurn3D.h b/cocos/2d/CCActionPageTurn3D.h index 40758f6444..e195ae97ba 100644 --- a/cocos/2d/CCActionPageTurn3D.h +++ b/cocos/2d/CCActionPageTurn3D.h @@ -37,10 +37,10 @@ NS_CC_BEGIN /** @brief This action simulates a page turn from the bottom right hand corner of the screen. - It's not much use by itself but is used by the PageTurnTransition. - Based on an original paper by L Hong et al. - http://www.parc.com/publication/1638/turning-pages-of-3d-electronic-books.html + @detail It's not much use by itself but is used by the PageTurnTransition. + Based on an original paper by L Hong et al. + http://www.parc.com/publication/1638/turning-pages-of-3d-electronic-books.html @since v0.8.2 */ @@ -48,14 +48,17 @@ class CC_DLL PageTurn3D : public Grid3DAction { public: virtual GridBase* getGrid() override; - /** create the action */ + + /** + @brief Create an action with duration, grid size. + @param duration Specify the duration of the PageTurn3D action. It's a value in seconds. + @param gridSize Specify the size of the grid. + @return If the creation sucess, return a pointer of PageTurn3D action; otherwise, return nil. + */ static PageTurn3D* create(float duration, const Size& gridSize); // Overrides virtual PageTurn3D* clone() const override; - /** - * @param time in seconds - */ virtual void update(float time) override; }; diff --git a/cocos/2d/CCActionProgressTimer.h b/cocos/2d/CCActionProgressTimer.h index ea5453a181..67542ebee1 100644 --- a/cocos/2d/CCActionProgressTimer.h +++ b/cocos/2d/CCActionProgressTimer.h @@ -36,15 +36,19 @@ NS_CC_BEGIN */ /** -@brief Progress to percentage +@brief Progress to percentage. +@detail This action show the target node from current percentage to the specified percentage. + You should specify the destination percentage when creating the action. @since v0.99.1 */ class CC_DLL ProgressTo : public ActionInterval { public: /** - * Creates and initializes with a duration and a percent - * @param duration in seconds + * @brief Create and initializes with a duration and a destination percentage. + * @param duration Specify the duration of the ProgressTo action. It's a value in seconds. + * @param percent Specify the destination percentage. + * @return If the creation sucess, return a pointer of ProgressTo action; otherwise, return nil. */ static ProgressTo* create(float duration, float percent); @@ -54,9 +58,6 @@ public: virtual ProgressTo* clone() const override; virtual ProgressTo* reverse() const override; virtual void startWithTarget(Node *target) override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: @@ -64,8 +65,10 @@ CC_CONSTRUCTOR_ACCESS: virtual ~ProgressTo() {} /** - * Initializes with a duration and a percent - * @param duration in seconds + * @brief Initializes with a duration and destination percentage. + * @param duration Specify the duration of the ProgressTo action. It's a value in seconds. + * @param percent Specify the destination percentage. + * @return If the creation sucess, return true; otherwise, return false. */ bool initWithDuration(float duration, float percent); @@ -78,15 +81,18 @@ private: }; /** -@brief Progress from a percentage to another percentage +@brief Progress from a percentage to another percentage. @since v0.99.1 */ class CC_DLL ProgressFromTo : public ActionInterval { public: /** - * Creates and initializes the action with a duration, a "from" percentage and a "to" percentage - * @param duration in seconds + * @brief Create and initializes the action with a duration, a "from" percentage and a "to" percentage. + * @param duration Specify the duration of the ProgressFromTo action. It's a value in seconds. + * @param fromPercentage Specify the source percentage. + * @param toPercentage Specify the destination percentage. + * @return If the creation sucess, return a pointer of ProgressFromTo action; otherwise, return nil. */ static ProgressFromTo* create(float duration, float fromPercentage, float toPercentage); @@ -96,16 +102,19 @@ public: virtual ProgressFromTo* clone() const override; virtual ProgressFromTo* reverse() const override; virtual void startWithTarget(Node *target) override; - /** - * @param time in seconds - */ virtual void update(float time) override; CC_CONSTRUCTOR_ACCESS: ProgressFromTo() {} virtual ~ProgressFromTo() {} - /** Initializes the action with a duration, a "from" percentage and a "to" percentage */ + /** + * @brief Initializes the action with a duration, a "from" percentage and a "to" percentage. + * @param duration Specify the duration of the ProgressFromTo action. It's a value in seconds. + * @param fromPercentage Specify the source percentage. + * @param toPercentage Specify the destination percentage. + * @return If the creation sucess, return true; otherwise, return false. + */ bool initWithDuration(float duration, float fromPercentage, float toPercentage); protected: diff --git a/cocos/2d/CCActionTween.h b/cocos/2d/CCActionTween.h index 9b28d180ab..17bef18dc0 100644 --- a/cocos/2d/CCActionTween.h +++ b/cocos/2d/CCActionTween.h @@ -35,6 +35,15 @@ NS_CC_BEGIN * @{ */ +/** +@brief The delegate class for ActionTween. +@detail If you want to use ActionTween on a node. + You should implement the node follow these steps: + 1. The node should be inherit from ActionTweenDelegate. + 2. Override the virtual method updateTweenAction in the node. + + Then once you running ActionTween on the node, the method updateTweenAction will be incoked. +*/ class CC_DLL ActionTweenDelegate { public: @@ -43,6 +52,12 @@ public: * @lua NA */ virtual ~ActionTweenDelegate() {} + + /** + @brief The callback function when ActionTween is running. + @param value The new value of the specified key. + @param key The key of property which should be updated. + */ virtual void updateTweenAction(float value, const std::string& key) = 0; }; @@ -70,24 +85,29 @@ class CC_DLL ActionTween : public ActionInterval { public: /** - * creates an initializes the action with the property name (key), and the from and to parameters. - * @param duration in seconds + * @brief Create and initializes the action with the property name (key), and the from and to parameters. + * @param duration The duration of the ActionTween. It's a value in seconds. + * @param key The key of property which should be updated. + * @param from The value of the specified property when the action begin. + * @param to The value of the specified property when the action end. + * @return If the creation success, return a pointer of ActionTween; otherwise, return nil. */ static ActionTween* create(float duration, const std::string& key, float from, float to); // Overrides void startWithTarget(Node *target) override; - /** - * @param dt in seconds - */ void update(float dt) override; ActionTween* reverse() const override; ActionTween *clone() const override; CC_CONSTRUCTOR_ACCESS: /** - * initializes the action with the property name (key), and the from and to parameters. - * @param duration in seconds + * @brief Initializes the action with the property name (key), and the from and to parameters. + * @param duration The duration of the ActionTween. It's a value in seconds. + * @param key The key of property which should be updated. + * @param from The value of the specified property when the action begin. + * @param to The value of the specified property when the action end. + * @return If the initialization success, return true; otherwise, return false. */ bool initWithDuration(float duration, const std::string& key, float from, float to); diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 3c60b2dce6..27acb319fd 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -932,6 +932,8 @@ void Label::createSpriteWithFontDefinition() texture->initWithString(_originalUTF8String.c_str(),_fontDefinition); _textSprite = Sprite::createWithTexture(texture); + //set camera mask using label's camera mask, because _textSprite may be null when setting camera mask to label + _textSprite->setCameraMask(getCameraMask()); _textSprite->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); this->setContentSize(_textSprite->getContentSize()); texture->release(); @@ -1073,6 +1075,8 @@ void Label::drawTextSprite(Renderer *renderer, uint32_t parentFlags) { _shadowNode->setBlendFunc(_blendFunc); } + //set camera mask using label's mask. Because _shadowNode may be null when setting the label's camera mask + _shadowNode->setCameraMask(getCameraMask()); _shadowNode->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); _shadowNode->setColor(_shadowColor); _shadowNode->setOpacity(_shadowOpacity * _displayedOpacity); diff --git a/cocos/base/CCAutoreleasePool.h b/cocos/base/CCAutoreleasePool.h index 1408469edf..7c73f70b35 100644 --- a/cocos/base/CCAutoreleasePool.h +++ b/cocos/base/CCAutoreleasePool.h @@ -40,7 +40,7 @@ class CC_DLL AutoreleasePool { public: /** - * @warn Don't create an auto release pool in heap, create it in stack. + * @warn Don't create an autorelease pool in heap, create it in stack. * @js NA * @lua NA */ @@ -48,6 +48,11 @@ public: /** * Create an autorelease pool with specific name. This name is useful for debugging. + * @warn Don't create an autorelease pool in heap, create it in stack. + * @js NA + * @lua NA + * + * @param name The name of created autorelease pool. */ AutoreleasePool(const std::string &name); @@ -58,13 +63,13 @@ public: ~AutoreleasePool(); /** - * Add a given object to this pool. + * Add a given object to this autorelease pool. * - * The same object may be added several times to the same pool; When the - * pool is destructed, the object's Ref::release() method will be called - * for each time it was added. + * The same object may be added several times to an autorelease pool. When the + * pool is destructed, the object's `Ref::release()` method will be called + * the same times as it was added. * - * @param object The object to add to the pool. + * @param object The object to be added into the autorelease pool. * @js NA * @lua NA */ @@ -73,8 +78,8 @@ public: /** * Clear the autorelease pool. * - * Ref::release() will be called for each time the managed object is - * added to the pool. + * It will invoke each element's `release()` function. + * * @js NA * @lua NA */ @@ -82,22 +87,34 @@ public: #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) /** - * Whether the pool is doing `clear` operation. + * Whether the autorelease pool is doing `clear` operation. + * + * @return True if autorelase pool is clearning, false if not. + * + * @js NA + * @lua NA */ bool isClearing() const { return _isClearing; }; #endif /** - * Checks whether the pool contains the specified object. + * Checks whether the autorelease pool contains the specified object. + * + * @param object The object to be checked. + * @return True if the autorelease pool contains the object, false if not + * @js NA + * @lua NA */ bool contains(Ref* object) const; /** - * Dump the objects that are put into autorelease pool. It is used for debugging. + * Dump the objects that are put into the autorelease pool. It is used for debugging. * * The result will look like: * Object pointer address object id reference count * + * @js NA + * @lua NA */ void dump(); @@ -122,20 +139,16 @@ private: #endif }; +/** + * @cond + */ class CC_DLL PoolManager { public: - /** - * @js NA - * @lua NA - */ + CC_DEPRECATED_ATTRIBUTE static PoolManager* sharedPoolManager() { return getInstance(); } static PoolManager* getInstance(); - /** - * @js NA - * @lua NA - */ CC_DEPRECATED_ATTRIBUTE static void purgePoolManager() { destroyInstance(); } static void destroyInstance(); @@ -147,10 +160,7 @@ public: bool isObjectInPools(Ref* obj) const; - /** - * @js NA - * @lua NA - */ + friend class AutoreleasePool; private: @@ -164,6 +174,9 @@ private: std::vector _releasePoolStack; }; +/** + * @endcond + */ // end of base_nodes group /// @} diff --git a/cocos/base/CCData.h b/cocos/base/CCData.h index 435e51eac0..d9bf9c0b10 100644 --- a/cocos/base/CCData.h +++ b/cocos/base/CCData.h @@ -33,28 +33,58 @@ NS_CC_BEGIN +/** + * @lua NA + */ class CC_DLL Data { public: + /** + * This parameter is defined for convenient reference if a null Data object is needed. + */ static const Data Null; + /** + * Constructor of Data. + */ Data(); + + /** + * Copy constructor of Data. + */ Data(const Data& other); + + /** + * Copy constructor of Data. + */ Data(Data&& other); + + /** + * Destructor of Data. + */ ~Data(); - // Assignment operator + /** + * Overroads of operator=. + */ Data& operator= (const Data& other); + + /** + * Overroads of operator=. + */ Data& operator= (Data&& other); /** - * @js NA - * @lua NA + * Gets internal bytes of Data. It will retrun the pointer directly used in Data, so don't delete it. + * + * @return Pointer of bytes used internal in Data. */ unsigned char* getBytes() const; + /** - * @js NA - * @lua NA + * Gets the size of the bytes. + * + * @return The size of bytes of Data. */ ssize_t getSize() const; @@ -74,10 +104,16 @@ public: */ void fastSet(unsigned char* bytes, const ssize_t size); - /** Clears data, free buffer and reset data size */ + /** + * Clears data, free buffer and reset data size. + */ void clear(); - /** Check whether the data is null. */ + /** + * Check whether the data is null. + * + * @return True if the the Data is null, false if not. + */ bool isNull() const; private: diff --git a/cocos/base/CCDataVisitor.h b/cocos/base/CCDataVisitor.h index ee25ff980f..42c51736d7 100644 --- a/cocos/base/CCDataVisitor.h +++ b/cocos/base/CCDataVisitor.h @@ -41,8 +41,7 @@ class __Dictionary; class __Set; /** - * @addtogroup data_structures - * @{ + * @cond */ /** @@ -106,8 +105,9 @@ private: std::string _result; }; -// end of data_structure group -/// @} +/** + * @endcond + */ NS_CC_END diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index 88260589ab..6a08b27ae8 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -248,8 +248,6 @@ void Director::setGLDefaultValues() CCASSERT(_openGLView, "opengl view should not be null"); setAlphaBlending(true); - // FIXME: Fix me, should enable/disable depth test according the depth format as cocos2d-iphone did - // [self setDepthTest: view_.depthFormat]; setDepthTest(false); setProjection(_projection); } diff --git a/cocos/base/CCDirector.h b/cocos/base/CCDirector.h index aa097876c6..932909f001 100644 --- a/cocos/base/CCDirector.h +++ b/cocos/base/CCDirector.h @@ -62,67 +62,73 @@ class Camera; class Console; /** -@brief Class that creates and handles the main Window and manages how -and when to execute the Scenes. - - The Director is also responsible for: - - initializing the OpenGL context - - setting the OpenGL pixel format (default on is RGB565) - - setting the OpenGL buffer depth (default one is 0-bit) - - setting the projection (default one is 3D) - - setting the orientation (default one is Portrait) - - Since the Director is a singleton, the standard way to use it is by calling: - _ Director::getInstance()->methodName(); - - The Director also sets the default OpenGL context: - - GL_TEXTURE_2D is enabled - - GL_VERTEX_ARRAY is enabled - - GL_COLOR_ARRAY is enabled - - GL_TEXTURE_COORD_ARRAY is enabled -*/ + * @brief Matrix stack type. + */ enum class MATRIX_STACK_TYPE { + /// Model view matrix stack MATRIX_STACK_MODELVIEW, + + /// projection matrix stack MATRIX_STACK_PROJECTION, + + /// texture matrix stack MATRIX_STACK_TEXTURE }; +/** + @brief Class that creates and handles the main Window and manages how + and when to execute the Scenes. + + The Director is also responsible for: + - initializing the OpenGL context + - setting the OpenGL buffer depth (default one is 0-bit) + - setting the projection (default one is 3D) + + Since the Director is a singleton, the standard way to use it is by calling: + _ Director::getInstance()->methodName(); + */ class CC_DLL Director : public Ref { public: + /** Director will trigger an event when projection type is changed. */ static const char *EVENT_PROJECTION_CHANGED; + /** Director will trigger an event after Schedule::update() is invoked. */ static const char* EVENT_AFTER_UPDATE; + /** Director will trigger an event after Scene::render() is invoked. */ static const char* EVENT_AFTER_VISIT; + /** Director will trigger an event after a scene is drawn, the data is sent to GPU. */ static const char* EVENT_AFTER_DRAW; - /** @typedef ccDirectorProjection - Possible OpenGL projections used by director + /** + * @brief Possible OpenGL projections used by director */ enum class Projection { - /// sets a 2D projection (orthogonal projection) + /// Sets a 2D projection (orthogonal projection). _2D, - /// sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500. + /// Sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500. _3D, - /// it calls "updateProjection" on the projection delegate. + /// It calls "updateProjection" on the projection delegate. CUSTOM, - /// Default projection is 3D projection + /// Default projection is 3D projection. DEFAULT = _3D, }; - /** returns a shared instance of the director */ + /** Returns a shared instance of the director. */ static Director* getInstance(); - /** @deprecated Use getInstance() instead */ + /** @deprecated Use getInstance() instead. */ CC_DEPRECATED_ATTRIBUTE static Director* sharedDirector() { return Director::getInstance(); } + /** * @js ctor */ - Director(void); + Director(); + /** * @js NA * @lua NA @@ -132,105 +138,128 @@ public: // attribute - /** Get current running Scene. Director can only run one Scene at a time */ + /** Gets current running Scene. Director can only run one Scene at a time. */ inline Scene* getRunningScene() { return _runningScene; } - /** Get the FPS value */ + /** Gets the FPS value. */ inline double getAnimationInterval() { return _animationInterval; } - /** Set the FPS value. */ + /** Sets the FPS value. FPS = 1/internal. */ virtual void setAnimationInterval(double interval) = 0; - /** Whether or not to display the FPS on the bottom-left corner */ + /** Whether or not to display the FPS on the bottom-left corner. */ inline bool isDisplayStats() { return _displayStats; } - /** Display the FPS on the bottom-left corner */ + /** Display the FPS on the bottom-left corner. */ inline void setDisplayStats(bool displayStats) { _displayStats = displayStats; } - /** seconds per frame */ + /** Get seconds per frame. */ inline float getSecondsPerFrame() { return _secondsPerFrame; } - /** Get the GLView, where everything is rendered - * @js NA - * @lua NA - */ + /** + * Get the GLView. + + * @js NA + * @lua NA + */ inline GLView* getOpenGLView() { return _openGLView; } + /** + * Sets the GLView. + * + * @lua NA + * @js NA + */ void setOpenGLView(GLView *openGLView); + /** Gets singleton of TextureCache. */ TextureCache* getTextureCache() const; + /** Whether or not `_nextDeltaTimeZero` is set to 0. */ inline bool isNextDeltaTimeZero() { return _nextDeltaTimeZero; } + /** + * Sets the detal time between current frame and next frame is 0. + * This value will be used in Schedule, and will affect all functions that are using frame detal time, such as Actions. + * This value will take effect only one time. + */ void setNextDeltaTimeZero(bool nextDeltaTimeZero); - /** Whether or not the Director is paused */ + /** Whether or not the Director is paused. */ inline bool isPaused() { return _paused; } /** How many frames were called since the director started */ inline unsigned int getTotalFrames() { return _totalFrames; } - /** Sets an OpenGL projection + /** Gets an OpenGL projection. @since v0.8.2 * @js NA * @lua NA */ inline Projection getProjection() { return _projection; } + /** Sets OpenGL projection. */ void setProjection(Projection projection); - /** Sets the glViewport*/ + /** Sets the glViewport.*/ void setViewport(); /** How many frames were called since the director started */ /** Whether or not the replaced scene will receive the cleanup message. - If the new scene is pushed, then the old scene won't receive the "cleanup" message. - If the new scene replaces the old one, the it will receive the "cleanup" message. - @since v0.99.0 + * If the new scene is pushed, then the old scene won't receive the "cleanup" message. + * If the new scene replaces the old one, the it will receive the "cleanup" message. + * @since v0.99.0 */ inline bool isSendCleanupToScene() { return _sendCleanupToScene; } /** This object will be visited after the main scene is visited. - This object MUST implement the "visit" selector. - Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications) - @since v0.99.5 + * This object MUST implement the "visit" function. + * Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications) + * @since v0.99.5 */ Node* getNotificationNode() const { return _notificationNode; } + /** + * Sets the notification node. + * @see Director::getNotificationNode() + */ void setNotificationNode(Node *node); // window size - /** returns the size of the OpenGL view in points. - */ + /** Returns the size of the OpenGL view in points. */ const Size& getWinSize() const; - /** returns the size of the OpenGL view in pixels. - */ + /** Returns the size of the OpenGL view in pixels. */ Size getWinSizeInPixels() const; - /** returns visible size of the OpenGL view in points. - * the value is equal to getWinSize if don't invoke - * GLView::setDesignResolutionSize() + /** + * Returns visible size of the OpenGL view in points. + * The value is equal to `Director::getWinSize()` if don't invoke `GLView::setDesignResolutionSize()`. */ Size getVisibleSize() const; - /** returns visible origin of the OpenGL view in points. - */ + /** Returns visible origin coordinate of the OpenGL view in points. */ Vec2 getVisibleOrigin() const; - /** converts a UIKit coordinate to an OpenGL coordinate - Useful to convert (multi) touch coordinates to the current layout (portrait or landscape) + /** + * Converts a screen coordinate to an OpenGL coordinate. + * Useful to convert (multi) touch coordinates to the current layout (portrait or landscape). */ Vec2 convertToGL(const Vec2& point); - /** converts an OpenGL coordinate to a UIKit coordinate - Useful to convert node points to window points for calls such as glScissor + /** + * Converts an OpenGL coordinate to a screen coordinate. + * Useful to convert node points to window points for calls such as glScissor. */ Vec2 convertToUI(const Vec2& point); - /// FIXME: missing description + /** + * Gets the distance between camera and near clipping frane. + * It is correct for default camera that near clipping frane is the same as screen. + */ float getZEye() const; // Scene Management - /** Enters the Director's main loop with the given Scene. + /** + * Enters the Director's main loop with the given Scene. * Call it to run only your FIRST scene. * Don't call it if there is already a running scene. * @@ -238,23 +267,26 @@ public: */ void runWithScene(Scene *scene); - /** Suspends the execution of the running scene, pushing it on the stack of suspended scenes. + /** + * Suspends the execution of the running scene, pushing it on the stack of suspended scenes. * The new scene will be executed. * Try to avoid big stacks of pushed scenes to reduce memory allocation. * ONLY call it if there is a running scene. */ void pushScene(Scene *scene); - /** Pops out a scene from the stack. + /** + * Pops out a scene from the stack. * This scene will replace the running one. * The running scene will be deleted. If there are no more scenes in the stack the execution is terminated. * ONLY call it if there is a running scene. */ void popScene(); - /** Pops out all scenes from the stack until the root scene in the queue. + /** + * Pops out all scenes from the stack until the root scene in the queue. * This scene will replace the running one. - * Internally it will call `popToSceneStackLevel(1)` + * Internally it will call `popToSceneStackLevel(1)`. */ void popToRootScene(); @@ -271,132 +303,153 @@ public: void replaceScene(Scene *scene); /** Ends the execution, releases the running scene. - It doesn't remove the OpenGL view from its parent. You have to do it manually. * @lua endToLua */ void end(); /** Pauses the running scene. - The running scene will be _drawed_ but all scheduled timers will be paused - While paused, the draw rate will be 4 FPS to reduce CPU consumption + * The running scene will be _drawed_ but all scheduled timers will be paused. + * While paused, the draw rate will be 4 FPS to reduce CPU consumption. */ void pause(); - /** Resumes the paused scene - The scheduled timers will be activated again. - The "delta time" will be 0 (as if the game wasn't paused) + /** Resumes the paused scene. + * The scheduled timers will be activated again. + * The "delta time" will be 0 (as if the game wasn't paused). */ void resume(); - /** Restart the director - */ + /** Restart the director. */ void restart(); /** Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore. - If you don't want to pause your animation call [pause] instead. + * If you don't want to pause your animation call [pause] instead. */ virtual void stopAnimation() = 0; /** The main loop is triggered again. - Call this function only if [stopAnimation] was called earlier - @warning Don't call this function to start the main loop. To run the main loop call runWithScene + * Call this function only if [stopAnimation] was called earlier. + * @warning Don't call this function to start the main loop. To run the main loop call runWithScene. */ virtual void startAnimation() = 0; /** Draw the scene. - This method is called every frame. Don't call it manually. - */ + * This method is called every frame. Don't call it manually. + */ void drawScene(); // Memory Helper /** Removes all cocos2d cached data. - It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache - @since v0.99.3 + * It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache + * @since v0.99.3 */ void purgeCachedData(); - /** sets the default values based on the Configuration info */ + /** Sets the default values based on the Configuration info. */ void setDefaultValues(); // OpenGL Helper - /** sets the OpenGL default values */ + /** Sets the OpenGL default values. + * It will enable alpha blending, disable depth test. + */ void setGLDefaultValues(); - /** enables/disables OpenGL alpha blending */ + /** Enables/disables OpenGL alpha blending. */ void setAlphaBlending(bool on); - /** set clear values for the color buffers, value range of each element is [0.0, 1.0] */ + /** Sets clear values for the color buffers, value range of each element is [0.0, 1.0]. */ void setClearColor(const Color4F& clearColor); - /** enables/disables OpenGL depth test */ + /** Enables/disables OpenGL depth test. */ void setDepthTest(bool on); virtual void mainLoop() = 0; /** The size in pixels of the surface. It could be different than the screen size. - High-res devices might have a higher surface size than the screen size. - Only available when compiled using SDK >= 4.0. - @since v0.99.4 + * High-res devices might have a higher surface size than the screen size. + * Only available when compiled using SDK >= 4.0. + * @since v0.99.4 */ void setContentScaleFactor(float scaleFactor); + /** + * Gets content scale factor. + * @see Director::setContentScaleFactor() + */ float getContentScaleFactor() const { return _contentScaleFactor; } - /** Gets the Scheduler associated with this director - @since v2.0 + /** Gets the Scheduler associated with this director. + * @since v2.0 */ Scheduler* getScheduler() const { return _scheduler; } - /** Sets the Scheduler associated with this director - @since v2.0 + /** Sets the Scheduler associated with this director. + * @since v2.0 */ void setScheduler(Scheduler* scheduler); - /** Gets the ActionManager associated with this director - @since v2.0 + /** Gets the ActionManager associated with this director. + * @since v2.0 */ ActionManager* getActionManager() const { return _actionManager; } - /** Sets the ActionManager associated with this director - @since v2.0 + /** Sets the ActionManager associated with this director. + * @since v2.0 */ void setActionManager(ActionManager* actionManager); - /** Gets the EventDispatcher associated with this director - @since v3.0 + /** Gets the EventDispatcher associated with this director. + * @since v3.0 */ EventDispatcher* getEventDispatcher() const { return _eventDispatcher; } - /** Sets the EventDispatcher associated with this director - @since v3.0 + /** Sets the EventDispatcher associated with this director. + * @since v3.0 */ void setEventDispatcher(EventDispatcher* dispatcher); - /** Returns the Renderer - @since v3.0 + /** Returns the Renderer associated with this director. + * @since v3.0 */ Renderer* getRenderer() const { return _renderer; } - /** Returns the Console - @since v3.0 + /** Returns the Console associated with this director. + * @since v3.0 */ Console* getConsole() const { return _console; } - /* Gets delta time since last tick to main loop */ + /* Gets delta time since last tick to main loop. */ float getDeltaTime() const; /** - * get Frame Rate + * Gets Frame Rate. */ float getFrameRate() const { return _frameRate; } + /** Clones a specified type matrix and put it to the top of specified type of matrix stack. */ void pushMatrix(MATRIX_STACK_TYPE type); + /** Pops the top matrix of the specified type of matrix stack. */ void popMatrix(MATRIX_STACK_TYPE type); + /** Adds an identity matrix to the top of specified type of matrxi stack. */ void loadIdentityMatrix(MATRIX_STACK_TYPE type); + /** + * Adds a matrix to the top of specified type of matrix stack. + * + * @param type Matrix type. + * @param mat The matrix that to be added. + */ void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat); + /** + * Multipies a matrix to the top of specified type of matrix stack. + * + * @param type Matrix type. + * @param mat The matrix that to be multipied. + */ void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat); + /** Gets the top matrix of specified type of matrix stack. */ const Mat4& getMatrix(MATRIX_STACK_TYPE type); + /** Cleras all types of matrix stack, and add indentity matrix to these matrix stacks. */ void resetMatrixStack(); protected: diff --git a/cocos/cocos2d.cpp b/cocos/cocos2d.cpp index 8f2e6483ff..6732f6baf6 100644 --- a/cocos/cocos2d.cpp +++ b/cocos/cocos2d.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN CC_DLL const char* cocos2dVersion() { - return "cocos2d-x 3.5rc0"; + return "cocos2d-x 3.5"; } NS_CC_END diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp index e2c0e0fd0c..df59439683 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp @@ -1276,7 +1276,10 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod readername.append("Reader"); NodeReaderProtocol* reader = dynamic_cast(ObjectFactory::getInstance()->createObject(readername)); - node = reader->createNodeWithFlatBuffers(options->data()); + if (reader) + { + node = reader->createNodeWithFlatBuffers(options->data()); + } Widget* widget = dynamic_cast(node); if (widget) diff --git a/cocos/platform/CCCommon.h b/cocos/platform/CCCommon.h index a81fcb6280..b2707d2e8b 100644 --- a/cocos/platform/CCCommon.h +++ b/cocos/platform/CCCommon.h @@ -67,7 +67,8 @@ enum class LanguageType POLISH, TURKISH, UKRAINIAN, - ROMANIAN + ROMANIAN, + BULGARIAN }; // END of platform group diff --git a/cocos/platform/android/CCApplication-android.cpp b/cocos/platform/android/CCApplication-android.cpp index fb55ae001c..dacc0a33b1 100644 --- a/cocos/platform/android/CCApplication-android.cpp +++ b/cocos/platform/android/CCApplication-android.cpp @@ -188,6 +188,10 @@ LanguageType Application::getCurrentLanguage() { ret = LanguageType::ROMANIAN; } + else if (0 == strcmp("bg", pLanguageName)) + { + ret = LanguageType::BULGARIAN; + } return ret; } diff --git a/cocos/platform/ios/CCApplication-ios.mm b/cocos/platform/ios/CCApplication-ios.mm index 8563079159..0d515a575f 100644 --- a/cocos/platform/ios/CCApplication-ios.mm +++ b/cocos/platform/ios/CCApplication-ios.mm @@ -161,6 +161,9 @@ LanguageType Application::getCurrentLanguage() else if ([languageCode isEqualToString:@"ro"]){ ret = LanguageType::ROMANIAN; } + else if ([languageCode isEqualToString:@"bg"]){ + ret = LanguageType::BULGARIAN; + } return ret; } diff --git a/cocos/platform/linux/CCApplication-linux.cpp b/cocos/platform/linux/CCApplication-linux.cpp index 3302759c67..e88d064cf6 100644 --- a/cocos/platform/linux/CCApplication-linux.cpp +++ b/cocos/platform/linux/CCApplication-linux.cpp @@ -257,6 +257,10 @@ LanguageType Application::getCurrentLanguage() { ret = LanguageType::ROMANIAN; } + else if (0 == strcmp("bg", pLanguageName)) + { + ret = LanguageType::BULGARIAN; + } return ret; } diff --git a/cocos/platform/mac/CCApplication-mac.mm b/cocos/platform/mac/CCApplication-mac.mm index b9a7c64e9f..8593d58b7e 100644 --- a/cocos/platform/mac/CCApplication-mac.mm +++ b/cocos/platform/mac/CCApplication-mac.mm @@ -215,6 +215,9 @@ LanguageType Application::getCurrentLanguage() else if ([languageCode isEqualToString:@"ro"]){ ret = LanguageType::ROMANIAN; } + else if ([languageCode isEqualToString:@"bg"]){ + ret = LanguageType::BULGARIAN; + } return ret; } diff --git a/cocos/platform/win32/CCApplication-win32.cpp b/cocos/platform/win32/CCApplication-win32.cpp index 4d16d4f93f..6e2579b0b6 100644 --- a/cocos/platform/win32/CCApplication-win32.cpp +++ b/cocos/platform/win32/CCApplication-win32.cpp @@ -194,6 +194,9 @@ LanguageType Application::getCurrentLanguage() case LANG_ROMANIAN: ret = LanguageType::ROMANIAN; break; + case LANG_BULGARIAN: + ret = LanguageType::BULGARIAN; + break; } return ret; diff --git a/cocos/platform/winrt/CCApplication.cpp b/cocos/platform/winrt/CCApplication.cpp index d7d2410c95..8f1bf87280 100644 --- a/cocos/platform/winrt/CCApplication.cpp +++ b/cocos/platform/winrt/CCApplication.cpp @@ -205,6 +205,10 @@ LanguageType Application::getCurrentLanguage() { ret = LanguageType::ROMANIAN; } + else if (strncmp(code, "bg", 2) == 0) + { + ret = LanguageType::BULGARIAN; + } return ret; } diff --git a/cocos/renderer/CCVertexIndexBuffer.h b/cocos/renderer/CCVertexIndexBuffer.h index 4ee7070d87..0a615dc991 100644 --- a/cocos/renderer/CCVertexIndexBuffer.h +++ b/cocos/renderer/CCVertexIndexBuffer.h @@ -33,85 +33,218 @@ NS_CC_BEGIN class EventListenerCustom; +/** +VertexBuffer is an abstraction of low level openGL Vertex Buffer Object. +It is used to save an array of vertices. +*/ class CC_DLL VertexBuffer : public Ref { public: + /** + Create an instance of VertexBuffer. + @param sizePerVertex Size in bytes of one vertex. + @param vertexNumber The number of vertex. + @param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it. + */ static VertexBuffer* create(int sizePerVertex, int vertexNumber, GLenum usage = GL_STATIC_DRAW); - + /**Get the size in bytes of one vertex.*/ int getSizePerVertex() const; + /**Get the number of vertices.*/ int getVertexNumber() const; + /** + Update all or part of vertice data, if the range specified exceeds the vertex buffer, it will be clipped. + @param verts The pointer of the vertex data. + @param count The number of vertices to update. + @param begin The first vertex to update. + */ bool updateVertices(const void* verts, int count, int begin); + /** + Get the size of the vertex array in bytes, equals getSizePerVertex() * getVertexNumber(). + */ int getSize() const; - + /** + Get the internal openGL handle. + */ GLuint getVBO() const; protected: + /** + Constructor. + */ VertexBuffer(); + /** + Destructor. + */ virtual ~VertexBuffer(); - + /** + Init the storage of vertex buffer. + @param sizePerVertex Size in bytes of one vertex. + @param vertexNumber The number of vertex. + @param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it. + */ bool init(int sizePerVertex, int vertexNumber, GLenum usage = GL_STATIC_DRAW); protected: - //event listener for foreground + /** + Event handler for foreground. + */ void recreateVBO() const; + /** + Event listener for foreground. + */ EventListenerCustom* _recreateVBOEventListener; protected: + /** + Internal handle for openGL. + */ mutable GLuint _vbo; + /** + Size in bytes for one vertex. + */ int _sizePerVertex; + /** + Number of vertices. + */ int _vertexNumber; - //buffer used for shadow copy + /** + Buffer used for shadow copy. + */ std::vector _shadowCopy; + /** + Hint for optimisation in GL. + */ GLenum _usage; protected: + /** + Static member to indicate that use _shadowCopy or not. + */ static bool _enableShadowCopy; public: + /** + Static getter for shadowCopy. + */ static bool isShadowCopyEnabled() { return _enableShadowCopy; } + /** + Static setter for shadowCopy. + */ static void enableShadowCopy(bool enabled) { _enableShadowCopy = enabled; } }; +/** +IndexBuffer is an abstraction of low level openGL Buffer Object. +It used to save an array of indices. +*/ class CC_DLL IndexBuffer : public Ref { public: + /** + Enum for the type of index, short indices and int indices could be used. + */ enum class IndexType { + /**Short index will be used.*/ INDEX_TYPE_SHORT_16, + /**Int index will be used.*/ INDEX_TYPE_UINT_32 }; public: + /** + Create an instance of IndexBuffer. + @param type type of index. + @param number The number of indices. + @param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it. + */ static IndexBuffer* create(IndexType type, int number, GLenum usage = GL_STATIC_DRAW); - + /** + Getter for type of indices. + */ IndexType getType() const; + /** + Get the size in bytes for one index, will be 2 for INDEX_TYPE_SHORT_16 and 4 for INDEX_TYPE_UINT_32. + */ int getSizePerIndex() const; + /** + Get the number of indices. + */ int getIndexNumber() const; + /** + Update all or part of indices data, if the range specified exceeds the vertex buffer, it will be clipped. + @param indices The pointer of the index data. + @param count The number of indices to update. + @param begin The start index to update. + */ bool updateIndices(const void* indices, int count, int begin); - + /** + Get the size in bytes of the array of indices. + */ int getSize() const; - + /** + Get the openGL handle for index buffer. + */ GLuint getVBO() const; protected: + /** + Constructor. + */ IndexBuffer(); + /** + Destructor. + */ virtual ~IndexBuffer(); - + /** + Init the storageof IndexBuffer. + @param type type of index. + @param number The number of indices. + @param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it. + */ bool init(IndexType type, int number, GLenum usage = GL_STATIC_DRAW); protected: + /** + Handle for openGL. + */ mutable GLuint _vbo; + /** + Type for index. + */ IndexType _type; + /** + Number of indices. + */ int _indexNumber; protected: - //event listener for foreground + /** + Event handler for foreground. + */ void recreateVBO() const; + /** + Event listener for foreground. + */ EventListenerCustom* _recreateVBOEventListener; - //buffer used for shadow copy + /** + Buffer used for shadow copy. + */ std::vector _shadowCopy; + /** + Hint for optimisation in GL. + */ GLenum _usage; protected: + /** + Static member to indicate that use _shadowCopy or not. + */ static bool _enableShadowCopy; public: + /** + Static getter for shadowCopy. + */ static bool isShadowCopyEnabled() { return _enableShadowCopy; } + /** + Static setter for shadowCopy. + */ static void enableShadowCopy(bool enabled) { _enableShadowCopy = enabled; } }; diff --git a/cocos/renderer/CCVertexIndexData.h b/cocos/renderer/CCVertexIndexData.h index 78499c5cd3..94f77320d4 100644 --- a/cocos/renderer/CCVertexIndexData.h +++ b/cocos/renderer/CCVertexIndexData.h @@ -31,55 +31,144 @@ NS_CC_BEGIN class VertexBuffer; +/** +VertexStreamAttribute is used to specify the vertex attribute for drawing, which is correspondent to +glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr). + _semantic -> index + _size -> size + _type -> type + _normalize -> normalized + _offset is used to compute the start offset in a interleaved array, take a V3F_C4B_T2F array, + offset of vertex will be 0, offset of color would be 0 + sizeof(float) * 3 = 12, + offset of texture coord would be 12 + sizeof(char) * 4 = 16. +*/ struct CC_DLL VertexStreamAttribute { + /** + Constructor. + */ VertexStreamAttribute() : _normalize(false),_offset(0),_semantic(0),_type(0),_size(0) { } - + /** + Constructor + @param offset The offset of the attribute. + @param semantic The semantic (Position, Texcoord, Color etc) of attribute. + @param type The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. + @param size Describe how many elements of type in the attribute. + */ VertexStreamAttribute(int offset, int semantic, int type, int size) : _normalize(false),_offset(offset),_semantic(semantic),_type(type),_size(size) { } - + /** + Constructor + @param offset The offset of the attribute. + @param semantic The semantic (Position, Texcoord, Color etc) of attribute. + @param type The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. + @param size Describe how many elements of type in the attribute. + @param normalize If true, the data will be normalized by deviding 255. + */ VertexStreamAttribute(int offset, int semantic, int type, int size, bool normalize) : _normalize(normalize),_offset(offset),_semantic(semantic),_type(type),_size(size) { } - + /** + Whether the attribute should be normalized or not. + */ bool _normalize; + /** + The offset of the attribute in the buffer. + */ int _offset; + /** + Describe that the attribute usage, could be Position, Color etc. + */ int _semantic; + /** + Describe the type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. + */ int _type; + /** + Describe how many elements of type in the attribute. + */ int _size; }; +/** +VertexData is a class used for specify input streams for GPU rendering pipeline, +a VertexData will be composed by several streams, every stream will contain a VertexStreamAttribute +and the binding VertexBuffer. Streams will be identified by semantic. +*/ + class CC_DLL VertexData : public Ref { public: + /** + Create function, used to create a instance of VertexData. + */ static VertexData* create(); + /** + Get the number of streams in the VertexData. + */ size_t getVertexStreamCount() const; + /** + Set a stream to VertexData,given that stream is identified by semantic, so if the semantic is not + specified before, it will add a stream, or it will override the old one. + @param buffer The binding buffer of the stream. + @param stream The binding vertex attribute, its member semantic will be used as the identifier. + */ bool setStream(VertexBuffer* buffer, const VertexStreamAttribute& stream); + /** + Remove the given streams. + @param semantic The semantic of the stream. + */ void removeStream(int semantic); + /** + Get the attribute of stream, const version. + @param semantic The semantic of the stream. + */ const VertexStreamAttribute* getStreamAttribute(int semantic) const; + /** + Get the attribute of stream. + @param semantic The semantic of the stream. + */ VertexStreamAttribute* getStreamAttribute(int semantic); - + /** + Get the binded buffer of the stream. + @param semantic The semantic of the stream. + */ VertexBuffer* getStreamBuffer(int semantic) const; + /** + Called for rendering, it will bind the state of vertex data to current rendering pipeline. + */ void use(); protected: + /** + Constructor. + */ VertexData(); + /** + Destructor. + */ virtual ~VertexData(); protected: + /** + Simple struct to bundle buffer and attribute. + */ struct BufferAttribute { VertexBuffer* _buffer; VertexStreamAttribute _stream; }; + /** + Streams in the VertexData. + */ std::map _vertexStreams; }; diff --git a/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua b/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua index 688394d901..9c8b443cf8 100644 --- a/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua +++ b/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua @@ -67,6 +67,14 @@ -- @param #cc.Node stencil -- @return ClippingNode#ClippingNode ret (return value: cc.ClippingNode) +-------------------------------- +-- +-- @function [parent=#ClippingNode] setCameraMask +-- @param self +-- @param #unsigned short mask +-- @param #bool applyChildren +-- @return ClippingNode#ClippingNode self (return value: cc.ClippingNode) + -------------------------------- -- -- @function [parent=#ClippingNode] visit diff --git a/cocos/scripting/lua-bindings/auto/api/Label.lua b/cocos/scripting/lua-bindings/auto/api/Label.lua index 4d389c0c55..dad4b8b300 100644 --- a/cocos/scripting/lua-bindings/auto/api/Label.lua +++ b/cocos/scripting/lua-bindings/auto/api/Label.lua @@ -478,4 +478,12 @@ -- @param #color3b_table parentColor -- @return Label#Label self (return value: cc.Label) +-------------------------------- +-- +-- @function [parent=#Label] setCameraMask +-- @param self +-- @param #unsigned short mask +-- @param #bool applyChildren +-- @return Label#Label self (return value: cc.Label) + return nil