mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4375 from dumganhar/constructors_are_protected
issue #3258: Merge PR #4351: Constructors are protected
This commit is contained in:
commit
999b7ccd07
|
@ -46,15 +46,6 @@ class CC_DLL Action : public Object, public Clonable
|
|||
public:
|
||||
/// Default tag used for all the actions
|
||||
static const int INVALID_TAG = -1;
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Action();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Action();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
@ -108,6 +99,9 @@ public:
|
|||
inline void setTag(int tag) { _tag = tag; }
|
||||
|
||||
protected:
|
||||
Action();
|
||||
virtual ~Action();
|
||||
|
||||
Node *_originalTarget;
|
||||
/** The "target".
|
||||
The target will be set with the 'startWithTarget' method.
|
||||
|
@ -117,6 +111,9 @@ protected:
|
|||
Node *_target;
|
||||
/** The action tag. An identifier of the action */
|
||||
int _tag;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Action);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -131,17 +128,6 @@ protected:
|
|||
class CC_DLL FiniteTimeAction : public Action
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
FiniteTimeAction()
|
||||
: _duration(0)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~FiniteTimeAction(){}
|
||||
//! get duration in seconds of the action
|
||||
inline float getDuration() const { return _duration; }
|
||||
//! set duration in seconds of the action
|
||||
|
@ -154,8 +140,16 @@ public:
|
|||
virtual FiniteTimeAction* clone() const override = 0;
|
||||
|
||||
protected:
|
||||
FiniteTimeAction()
|
||||
: _duration(0)
|
||||
{}
|
||||
virtual ~FiniteTimeAction(){}
|
||||
|
||||
//! duration in seconds
|
||||
float _duration;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FiniteTimeAction);
|
||||
};
|
||||
|
||||
class ActionInterval;
|
||||
|
@ -172,22 +166,11 @@ class CC_DLL Speed : public Action
|
|||
public:
|
||||
/** create the action */
|
||||
static Speed* create(ActionInterval* action, float speed);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Speed();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Speed(void);
|
||||
|
||||
inline float getSpeed(void) const { return _speed; }
|
||||
/** alter the speed of the inner function in runtime */
|
||||
inline void setSpeed(float speed) { _speed = speed; }
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action, float speed);
|
||||
|
||||
void setInnerAction(ActionInterval *action);
|
||||
|
||||
|
@ -204,8 +187,16 @@ public:
|
|||
virtual bool isDone() const override;
|
||||
|
||||
protected:
|
||||
Speed();
|
||||
virtual ~Speed(void);
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action, float speed);
|
||||
|
||||
float _speed;
|
||||
ActionInterval *_innerAction;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Speed);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -230,38 +221,11 @@ public:
|
|||
* with no boundary.
|
||||
*/
|
||||
static Follow* create(Node *followedNode, const Rect& rect = Rect::ZERO);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Follow()
|
||||
: _followedNode(nullptr)
|
||||
, _boundarySet(false)
|
||||
, _boundaryFullyCovered(false)
|
||||
, _leftBoundary(0.0)
|
||||
, _rightBoundary(0.0)
|
||||
, _topBoundary(0.0)
|
||||
, _bottomBoundary(0.0)
|
||||
, _worldRect(Rect::ZERO)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Follow();
|
||||
|
||||
|
||||
inline bool isBoundarySet() const { return _boundarySet; }
|
||||
/** alter behavior - turn on/off boundary */
|
||||
inline void setBoudarySet(bool value) { _boundarySet = value; }
|
||||
|
||||
/**
|
||||
* Initializes the action with a set boundary or with no boundary.
|
||||
*
|
||||
* @param followedNode The node to be followed.
|
||||
* @param rect The boundary. If \p rect is equal to Rect::ZERO, it'll work
|
||||
* with no boundary.
|
||||
*/
|
||||
bool initWithTarget(Node *followedNode, const Rect& rect = Rect::ZERO);
|
||||
|
||||
//
|
||||
// Override
|
||||
//
|
||||
|
@ -272,6 +236,33 @@ public:
|
|||
virtual void stop() override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Follow()
|
||||
: _followedNode(nullptr)
|
||||
, _boundarySet(false)
|
||||
, _boundaryFullyCovered(false)
|
||||
, _leftBoundary(0.0)
|
||||
, _rightBoundary(0.0)
|
||||
, _topBoundary(0.0)
|
||||
, _bottomBoundary(0.0)
|
||||
, _worldRect(Rect::ZERO)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Follow();
|
||||
/**
|
||||
* Initializes the action with a set boundary or with no boundary.
|
||||
*
|
||||
* @param followedNode The node to be followed.
|
||||
* @param rect The boundary. If \p rect is equal to Rect::ZERO, it'll work
|
||||
* with no boundary.
|
||||
*/
|
||||
bool initWithTarget(Node *followedNode, const Rect& rect = Rect::ZERO);
|
||||
|
||||
// node to follow
|
||||
Node *_followedNode;
|
||||
|
||||
|
@ -292,6 +283,8 @@ protected:
|
|||
float _bottomBoundary;
|
||||
Rect _worldRect;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Follow);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -44,14 +44,6 @@ class Object;
|
|||
class CC_DLL ActionEase : public ActionInterval
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ActionEase(void);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action);
|
||||
|
||||
virtual ActionInterval* getInnerAction();
|
||||
|
||||
|
@ -65,8 +57,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ActionEase() {}
|
||||
virtual ~ActionEase();
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action);
|
||||
|
||||
/** The inner action */
|
||||
ActionInterval *_inner;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ActionEase);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -76,15 +76,6 @@ protected:
|
|||
class CC_DLL EaseRateAction : public ActionEase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~EaseRateAction();
|
||||
|
||||
/** Initializes the action with the inner action and the rate parameter */
|
||||
bool initWithAction(ActionInterval *pAction, float fRate);
|
||||
|
||||
/** set rate value for the actions */
|
||||
inline void setRate(float rate) { _rate = rate; }
|
||||
/** get rate value for the actions */
|
||||
|
@ -97,7 +88,15 @@ public:
|
|||
virtual EaseRateAction* reverse() const override = 0;
|
||||
|
||||
protected:
|
||||
EaseRateAction() {}
|
||||
virtual ~EaseRateAction();
|
||||
/** Initializes the action with the inner action and the rate parameter */
|
||||
bool initWithAction(ActionInterval *pAction, float fRate);
|
||||
|
||||
float _rate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseRateAction);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -114,6 +113,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseIn* clone() const override;
|
||||
virtual EaseIn* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseIn() {}
|
||||
virtual ~EaseIn() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseIn);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -130,6 +136,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseOut* clone() const override;
|
||||
virtual EaseOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseOut() {}
|
||||
virtual ~EaseOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -146,6 +159,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseInOut* clone() const override;
|
||||
virtual EaseInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseInOut() {}
|
||||
virtual ~EaseInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseInOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -162,6 +182,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseExponentialIn* clone() const override;
|
||||
virtual ActionEase* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseExponentialIn() {}
|
||||
virtual ~EaseExponentialIn() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseExponentialIn);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -178,6 +205,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseExponentialOut* clone() const override;
|
||||
virtual ActionEase* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseExponentialOut() {}
|
||||
virtual ~EaseExponentialOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseExponentialOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -194,6 +228,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseExponentialInOut* clone() const override;
|
||||
virtual EaseExponentialInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseExponentialInOut() {}
|
||||
virtual ~EaseExponentialInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseExponentialInOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -210,6 +251,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseSineIn* clone() const override;
|
||||
virtual ActionEase* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseSineIn() {}
|
||||
virtual ~EaseSineIn() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseSineIn);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -226,6 +274,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseSineOut* clone() const override;
|
||||
virtual ActionEase* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseSineOut() {}
|
||||
virtual ~EaseSineOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseSineOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -242,6 +297,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseSineInOut* clone() const override;
|
||||
virtual EaseSineInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseSineInOut() {}
|
||||
virtual ~EaseSineInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseSineInOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -252,8 +314,6 @@ public:
|
|||
class CC_DLL EaseElastic : public ActionEase
|
||||
{
|
||||
public:
|
||||
/** Initializes the action with the inner action and the period in radians (default is 0.3) */
|
||||
bool initWithAction(ActionInterval *action, float period = 0.3f);
|
||||
|
||||
/** get period of the wave in radians. default is 0.3 */
|
||||
inline float getPeriod() const { return _period; }
|
||||
|
@ -267,7 +327,16 @@ public:
|
|||
virtual EaseElastic* reverse() const override = 0;
|
||||
|
||||
protected:
|
||||
EaseElastic() {}
|
||||
virtual ~EaseElastic() {}
|
||||
/** Initializes the action with the inner action and the period in radians (default is 0.3) */
|
||||
bool initWithAction(ActionInterval *action, float period = 0.3f);
|
||||
|
||||
float _period;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseElastic);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -287,6 +356,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseElasticIn* clone() const override;
|
||||
virtual EaseElastic* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseElasticIn() {}
|
||||
virtual ~EaseElasticIn() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseElasticIn);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -306,6 +382,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseElasticOut* clone() const override;
|
||||
virtual EaseElastic* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseElasticOut() {}
|
||||
virtual ~EaseElasticOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseElasticOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -325,6 +408,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseElasticInOut* clone() const override;
|
||||
virtual EaseElasticInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseElasticInOut() {}
|
||||
virtual ~EaseElasticInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseElasticInOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -340,6 +430,13 @@ public:
|
|||
// Overrides
|
||||
virtual EaseBounce* clone() const override = 0;
|
||||
virtual EaseBounce* reverse() const override = 0;
|
||||
|
||||
protected:
|
||||
EaseBounce() {}
|
||||
virtual ~EaseBounce() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounce);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -358,6 +455,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseBounceIn* clone() const override;
|
||||
virtual EaseBounce* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseBounceIn() {}
|
||||
virtual ~EaseBounceIn() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounceIn);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -376,6 +480,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseBounceOut* clone() const override;
|
||||
virtual EaseBounce* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseBounceOut() {}
|
||||
virtual ~EaseBounceOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounceOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -394,6 +505,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseBounceInOut* clone() const override;
|
||||
virtual EaseBounceInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseBounceInOut() {}
|
||||
virtual ~EaseBounceInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounceInOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -412,6 +530,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseBackIn* clone() const override;
|
||||
virtual ActionEase* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseBackIn() {}
|
||||
virtual ~EaseBackIn() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBackIn);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -430,6 +555,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseBackOut* clone() const override;
|
||||
virtual ActionEase* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseBackOut() {}
|
||||
virtual ~EaseBackOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBackOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -448,6 +580,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseBackInOut* clone() const override;
|
||||
virtual EaseBackInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseBackInOut() {}
|
||||
virtual ~EaseBackInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBackInOut);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -41,8 +41,6 @@ class GridBase;
|
|||
class CC_DLL GridAction : public ActionInterval
|
||||
{
|
||||
public:
|
||||
/** initializes the action with size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize);
|
||||
|
||||
/** returns the grid */
|
||||
virtual GridBase* getGrid();
|
||||
|
@ -53,7 +51,15 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
GridAction() {}
|
||||
virtual ~GridAction() {}
|
||||
/** initializes the action with size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize);
|
||||
|
||||
Size _gridSize;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(GridAction);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -153,18 +159,6 @@ class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static AccelDeccelAmplitude* create(Action *action, float duration);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~AccelDeccelAmplitude();
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *pAction, float duration);
|
||||
|
||||
/** returns a new clone of the action */
|
||||
virtual AccelDeccelAmplitude* clone() const;
|
||||
/** returns a new reversed action */
|
||||
virtual AccelDeccelAmplitude* reverse() const;
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) const { return _rate; }
|
||||
|
@ -174,10 +168,20 @@ public:
|
|||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
virtual AccelDeccelAmplitude* clone() const override;
|
||||
virtual AccelDeccelAmplitude* reverse() const override;
|
||||
|
||||
protected:
|
||||
AccelDeccelAmplitude() {}
|
||||
virtual ~AccelDeccelAmplitude();
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *pAction, float duration);
|
||||
|
||||
float _rate;
|
||||
ActionInterval *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
||||
};
|
||||
|
||||
/** @brief AccelAmplitude action */
|
||||
|
@ -186,14 +190,6 @@ class CC_DLL AccelAmplitude : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static AccelAmplitude* create(Action *action, float duration);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~AccelAmplitude();
|
||||
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *action, float duration);
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate() const { return _rate; }
|
||||
|
@ -207,8 +203,15 @@ public:
|
|||
virtual AccelAmplitude* reverse() const override;
|
||||
|
||||
protected:
|
||||
AccelAmplitude() {}
|
||||
virtual ~AccelAmplitude();
|
||||
bool initWithAction(Action *action, float duration);
|
||||
|
||||
float _rate;
|
||||
ActionInterval *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
||||
};
|
||||
|
||||
/** @brief DeccelAmplitude action */
|
||||
|
@ -217,13 +220,6 @@ class CC_DLL DeccelAmplitude : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
static DeccelAmplitude* create(Action *action, float duration);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~DeccelAmplitude();
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *action, float duration);
|
||||
|
||||
/** get amplitude rate */
|
||||
inline float getRate(void) const { return _rate; }
|
||||
|
@ -233,12 +229,20 @@ public:
|
|||
// overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
virtual DeccelAmplitude* clone() const;
|
||||
virtual DeccelAmplitude* reverse() const;
|
||||
virtual DeccelAmplitude* clone() const override;
|
||||
virtual DeccelAmplitude* reverse() const override;
|
||||
|
||||
protected:
|
||||
DeccelAmplitude() {}
|
||||
virtual ~DeccelAmplitude();
|
||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||
bool initWithAction(Action *action, float duration);
|
||||
|
||||
float _rate;
|
||||
ActionInterval *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
|
||||
};
|
||||
|
||||
/** @brief StopGrid action.
|
||||
|
@ -256,6 +260,13 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
virtual StopGrid* clone() const override;
|
||||
virtual StopGrid* reverse() const override;
|
||||
|
||||
protected:
|
||||
StopGrid() {}
|
||||
virtual ~StopGrid() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
||||
};
|
||||
|
||||
/** @brief ReuseGrid action */
|
||||
|
@ -265,16 +276,21 @@ public:
|
|||
/** creates an action with the number of times that the current grid will be reused */
|
||||
static ReuseGrid* create(int times);
|
||||
|
||||
/** initializes an action with the number of times that the current grid will be reused */
|
||||
bool initWithTimes(int times);
|
||||
|
||||
// Override
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual ReuseGrid* clone() const override;
|
||||
virtual ReuseGrid* reverse() const override;
|
||||
|
||||
protected:
|
||||
ReuseGrid() {}
|
||||
virtual ~ReuseGrid() {}
|
||||
/** initializes an action with the number of times that the current grid will be reused */
|
||||
bool initWithTimes(int times);
|
||||
|
||||
int _times;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -53,17 +53,22 @@ public:
|
|||
/** sets the ampliture rate */
|
||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||
|
||||
/** initializes an action with duration, grid size, waves and amplitude */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
// Overrides
|
||||
virtual Waves3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
Waves3D() {}
|
||||
virtual ~Waves3D() {}
|
||||
/** initializes an action with duration, grid size, waves and amplitude */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Waves3D);
|
||||
};
|
||||
|
||||
/** @brief FlipX3D action */
|
||||
|
@ -73,25 +78,36 @@ public:
|
|||
/** creates the action with duration */
|
||||
static FlipX3D* create(float duration);
|
||||
|
||||
// Override
|
||||
virtual FlipX3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
FlipX3D() {}
|
||||
virtual ~FlipX3D() {}
|
||||
/** initializes the action with duration */
|
||||
bool initWithDuration(float duration);
|
||||
virtual bool initWithSize(const Size& gridSize, float duration);
|
||||
|
||||
// Override
|
||||
virtual FlipX3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
|
||||
};
|
||||
|
||||
/** @brief FlipY3D action */
|
||||
class CC_DLL FlipY3D : public FlipX3D
|
||||
{
|
||||
public:
|
||||
FlipY3D() {}
|
||||
virtual ~FlipY3D() {}
|
||||
/** creates the action with duration */
|
||||
static FlipY3D* create(float duration);
|
||||
|
||||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual FlipY3D* clone() const override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
|
||||
};
|
||||
|
||||
/** @brief Lens3D action */
|
||||
|
@ -111,14 +127,16 @@ public:
|
|||
inline const Point& getPosition() const { return _position; }
|
||||
void setPosition(const Point& position);
|
||||
|
||||
/** initializes the action with center position, radius, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius);
|
||||
|
||||
// Overrides
|
||||
virtual Lens3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
Lens3D() {}
|
||||
virtual ~Lens3D() {}
|
||||
/** initializes the action with center position, radius, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius);
|
||||
|
||||
/* lens center position */
|
||||
Point _position;
|
||||
float _radius;
|
||||
|
@ -128,6 +146,9 @@ protected:
|
|||
bool _concave;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Lens3D);
|
||||
};
|
||||
|
||||
/** @brief Ripple3D action */
|
||||
|
@ -148,45 +169,57 @@ public:
|
|||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
||||
|
||||
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
||||
|
||||
// Override
|
||||
virtual Ripple3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
Ripple3D() {}
|
||||
virtual ~Ripple3D() {}
|
||||
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
||||
|
||||
/* center position */
|
||||
Point _position;
|
||||
float _radius;
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
|
||||
};
|
||||
|
||||
/** @brief Shaky3D action */
|
||||
class CC_DLL Shaky3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Shaky3D() {}
|
||||
virtual ~Shaky3D() {}
|
||||
/** 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);
|
||||
|
||||
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ);
|
||||
|
||||
// Overrides
|
||||
virtual Shaky3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ);
|
||||
|
||||
int _randrange;
|
||||
bool _shakeZ;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
|
||||
};
|
||||
|
||||
/** @brief Liquid action */
|
||||
class CC_DLL Liquid : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Liquid() {}
|
||||
virtual ~Liquid() {}
|
||||
/** creates the action with amplitude, a grid and duration */
|
||||
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
|
@ -196,23 +229,28 @@ public:
|
|||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||
|
||||
/** initializes the action with amplitude, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
// Overrides
|
||||
virtual Liquid* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
/** initializes the action with amplitude, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Liquid);
|
||||
};
|
||||
|
||||
/** @brief Waves action */
|
||||
class CC_DLL Waves : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Waves() {}
|
||||
virtual ~Waves() {}
|
||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||
|
||||
|
@ -222,25 +260,30 @@ public:
|
|||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||
|
||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||
|
||||
// Overrides
|
||||
virtual Waves* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
bool _vertical;
|
||||
bool _horizontal;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Waves);
|
||||
};
|
||||
|
||||
/** @brief Twirl action */
|
||||
class CC_DLL Twirl : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Twirl() {}
|
||||
virtual ~Twirl() {}
|
||||
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||
|
||||
|
@ -255,19 +298,23 @@ public:
|
|||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||
|
||||
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||
|
||||
// Overrides
|
||||
virtual Twirl* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||
|
||||
/* twirl center */
|
||||
Point _position;
|
||||
unsigned int _twirls;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Twirl);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -65,7 +65,6 @@ public:
|
|||
/** Allocates and initializes the action */
|
||||
static Show * create();
|
||||
|
||||
Show(){}
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -73,6 +72,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual ActionInstant* reverse() const override;
|
||||
virtual Show* clone() const override;
|
||||
|
||||
protected:
|
||||
Show(){}
|
||||
virtual ~Show(){}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Show);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -84,14 +90,19 @@ public:
|
|||
/** Allocates and initializes the action */
|
||||
static Hide * create();
|
||||
|
||||
Hide(){}
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void update(float time) override;
|
||||
virtual ActionInstant* reverse() const override;
|
||||
virtual Hide* clone() const override;
|
||||
|
||||
protected:
|
||||
Hide(){}
|
||||
virtual ~Hide(){}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Hide);
|
||||
};
|
||||
|
||||
/** @brief Toggles the visibility of a node
|
||||
|
@ -102,14 +113,19 @@ public:
|
|||
/** Allocates and initializes the action */
|
||||
static ToggleVisibility * create();
|
||||
|
||||
ToggleVisibility(){}
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void update(float time) override;
|
||||
virtual ToggleVisibility* reverse() const override;
|
||||
virtual ToggleVisibility* clone() const override;
|
||||
|
||||
protected:
|
||||
ToggleVisibility(){}
|
||||
virtual ~ToggleVisibility(){}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ToggleVisibility);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -121,12 +137,6 @@ public:
|
|||
/** create the action */
|
||||
static RemoveSelf * create(bool isNeedCleanUp = true);
|
||||
|
||||
RemoveSelf():_isNeedCleanUp(true)
|
||||
{}
|
||||
|
||||
/** init the action */
|
||||
bool init(bool isNeedCleanUp);
|
||||
|
||||
//
|
||||
// Override
|
||||
//
|
||||
|
@ -135,7 +145,15 @@ public:
|
|||
virtual RemoveSelf* reverse() const override;
|
||||
|
||||
protected:
|
||||
RemoveSelf() : _isNeedCleanUp(true){}
|
||||
virtual ~RemoveSelf(){}
|
||||
/** init the action */
|
||||
bool init(bool isNeedCleanUp);
|
||||
|
||||
bool _isNeedCleanUp;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RemoveSelf);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -148,13 +166,6 @@ public:
|
|||
/** create the action */
|
||||
static FlipX * create(bool x);
|
||||
|
||||
FlipX()
|
||||
:_flipX(false)
|
||||
{}
|
||||
|
||||
/** init the action */
|
||||
bool initWithFlipX(bool x);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -163,7 +174,15 @@ public:
|
|||
virtual FlipX* clone() const override;
|
||||
|
||||
protected:
|
||||
FlipX() :_flipX(false) {}
|
||||
virtual ~FlipX() {}
|
||||
/** init the action */
|
||||
bool initWithFlipX(bool x);
|
||||
|
||||
bool _flipX;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipX);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -176,13 +195,6 @@ public:
|
|||
/** create the action */
|
||||
static FlipY * create(bool y);
|
||||
|
||||
FlipY()
|
||||
:_flipY(false)
|
||||
{}
|
||||
|
||||
/** init the action */
|
||||
bool initWithFlipY(bool y);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -191,7 +203,15 @@ public:
|
|||
virtual FlipY* clone() const override;
|
||||
|
||||
protected:
|
||||
FlipY() :_flipY(false) {}
|
||||
virtual ~FlipY() {}
|
||||
/** init the action */
|
||||
bool initWithFlipY(bool y);
|
||||
|
||||
bool _flipY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipY);
|
||||
};
|
||||
|
||||
/** @brief Places the node in a certain position
|
||||
|
@ -199,12 +219,9 @@ protected:
|
|||
class CC_DLL Place : public ActionInstant //<NSCopying>
|
||||
{
|
||||
public:
|
||||
Place(){}
|
||||
|
||||
/** creates a Place action with a position */
|
||||
static Place * create(const Point& pos);
|
||||
/** Initializes a Place action with a position */
|
||||
bool initWithPosition(const Point& pos);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -214,7 +231,15 @@ public:
|
|||
virtual Place* clone() const override;
|
||||
|
||||
protected:
|
||||
Place(){}
|
||||
virtual ~Place(){}
|
||||
/** Initializes a Place action with a position */
|
||||
bool initWithPosition(const Point& pos);
|
||||
|
||||
Point _position;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Place);
|
||||
};
|
||||
|
||||
|
||||
|
@ -241,33 +266,6 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE static CallFunc * create(Object* target, SEL_CallFunc selector);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
CallFunc()
|
||||
: _selectorTarget(NULL)
|
||||
, _callFunc(NULL)
|
||||
, _function(nullptr)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~CallFunc();
|
||||
|
||||
/** initializes the action with the callback
|
||||
typedef void (Object::*SEL_CallFunc)();
|
||||
@deprecated Use the std::function API instead.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target);
|
||||
|
||||
/** initializes the action with the std::function<void()>
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithFunction(const std::function<void()>& func);
|
||||
|
||||
/** executes the callback */
|
||||
virtual void execute();
|
||||
|
||||
|
@ -293,6 +291,26 @@ public:
|
|||
virtual CallFunc* clone() const override;
|
||||
|
||||
protected:
|
||||
CallFunc()
|
||||
: _selectorTarget(NULL)
|
||||
, _callFunc(NULL)
|
||||
, _function(nullptr)
|
||||
{
|
||||
}
|
||||
virtual ~CallFunc();
|
||||
|
||||
/** initializes the action with the callback
|
||||
typedef void (Object::*SEL_CallFunc)();
|
||||
@deprecated Use the std::function API instead.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target);
|
||||
|
||||
/** initializes the action with the std::function<void()>
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithFunction(const std::function<void()>& func);
|
||||
|
||||
/** Target that will be called */
|
||||
Object* _selectorTarget;
|
||||
|
||||
|
@ -304,6 +322,9 @@ protected:
|
|||
|
||||
/** function that will be called */
|
||||
std::function<void()> _function;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(CallFunc);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -324,19 +345,6 @@ public:
|
|||
@deprecated Use the std::function API instead.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static CallFuncN * create(Object* target, SEL_CallFuncN selector);
|
||||
public:
|
||||
CallFuncN():_functionN(nullptr){}
|
||||
|
||||
/** initializes the action with the std::function<void(Node*)>
|
||||
*/
|
||||
bool initWithFunction(const std::function<void(Node*)>& func);
|
||||
|
||||
/** initializes the action with the callback
|
||||
|
||||
typedef void (Object::*SEL_CallFuncN)(Node*);
|
||||
@deprecated Use the std::function API instead.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_CallFuncN selector);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -345,8 +353,24 @@ public:
|
|||
virtual void execute() override;
|
||||
|
||||
protected:
|
||||
CallFuncN():_functionN(nullptr){}
|
||||
virtual ~CallFuncN(){}
|
||||
/** initializes the action with the std::function<void(Node*)> */
|
||||
bool initWithFunction(const std::function<void(Node*)>& func);
|
||||
|
||||
/** initializes the action with the callback
|
||||
|
||||
typedef void (Object::*SEL_CallFuncN)(Node*);
|
||||
@deprecated Use the std::function API instead.
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_CallFuncN selector);
|
||||
|
||||
|
||||
/** function that will be called with the "sender" as the 1st argument */
|
||||
std::function<void(Node*)> _functionN;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(CallFuncN);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -361,11 +385,6 @@ public:
|
|||
/** creates the action with the callback and the data to pass as an argument */
|
||||
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncND * create(Object* target, SEL_CallFuncND selector, void* d);
|
||||
|
||||
protected:
|
||||
/** initializes the action with the callback and the data to pass as an argument */
|
||||
bool initWithTarget(Object* target, SEL_CallFuncND selector, void* d);
|
||||
|
||||
public:
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -373,8 +392,17 @@ public:
|
|||
virtual void execute() override;
|
||||
|
||||
protected:
|
||||
__CCCallFuncND() {}
|
||||
virtual ~__CCCallFuncND() {}
|
||||
|
||||
/** initializes the action with the callback and the data to pass as an argument */
|
||||
bool initWithTarget(Object* target, SEL_CallFuncND selector, void* d);
|
||||
|
||||
SEL_CallFuncND _callFuncND;
|
||||
void* _data;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(__CCCallFuncND);
|
||||
};
|
||||
|
||||
|
||||
|
@ -393,24 +421,6 @@ public:
|
|||
typedef void (Object::*SEL_CallFuncO)(Object*);
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncO * create(Object* target, SEL_CallFuncO selector, Object* object);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
__CCCallFuncO();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~__CCCallFuncO();
|
||||
|
||||
protected:
|
||||
/** initializes the action with the callback
|
||||
|
||||
typedef void (Object::*SEL_CallFuncO)(Object*);
|
||||
*/
|
||||
bool initWithTarget(Object* target, SEL_CallFuncO selector, Object* object);
|
||||
|
||||
public:
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -421,9 +431,21 @@ public:
|
|||
void setObject(Object* obj);
|
||||
|
||||
protected:
|
||||
__CCCallFuncO();
|
||||
virtual ~__CCCallFuncO();
|
||||
/** initializes the action with the callback
|
||||
|
||||
typedef void (Object::*SEL_CallFuncO)(Object*);
|
||||
*/
|
||||
bool initWithTarget(Object* target, SEL_CallFuncO selector, Object* object);
|
||||
|
||||
|
||||
/** object to be passed as argument */
|
||||
Object* _object;
|
||||
SEL_CallFuncO _callFuncO;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(__CCCallFuncO);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -149,13 +149,13 @@ void ActionInterval::startWithTarget(Node *target)
|
|||
// Sequence
|
||||
//
|
||||
|
||||
Sequence* Sequence::createWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo)
|
||||
Sequence* Sequence::createWithTwoActions(FiniteTimeAction *actionOne, FiniteTimeAction *actionTwo)
|
||||
{
|
||||
Sequence *pSequence = new Sequence();
|
||||
pSequence->initWithTwoActions(pActionOne, pActionTwo);
|
||||
pSequence->autorelease();
|
||||
Sequence *sequence = new Sequence();
|
||||
sequence->initWithTwoActions(actionOne, actionTwo);
|
||||
sequence->autorelease();
|
||||
|
||||
return pSequence;
|
||||
return sequence;
|
||||
}
|
||||
|
||||
Sequence* Sequence::create(FiniteTimeAction *pAction1, ...)
|
||||
|
@ -597,13 +597,13 @@ Spawn* Spawn::create(Array *arrayOfActions)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
Spawn* Spawn::createWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2)
|
||||
Spawn* Spawn::createWithTwoActions(FiniteTimeAction *action1, FiniteTimeAction *action2)
|
||||
{
|
||||
Spawn *pSpawn = new Spawn();
|
||||
pSpawn->initWithTwoActions(pAction1, pAction2);
|
||||
pSpawn->autorelease();
|
||||
Spawn *spawn = new Spawn();
|
||||
spawn->initWithTwoActions(action1, action2);
|
||||
spawn->autorelease();
|
||||
|
||||
return pSpawn;
|
||||
return spawn;
|
||||
}
|
||||
|
||||
bool Spawn:: initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2)
|
||||
|
|
|
@ -64,9 +64,6 @@ public:
|
|||
/** how many seconds had elapsed since the actions started to run. */
|
||||
inline float getElapsed(void) { return _elapsed; }
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float d);
|
||||
|
||||
//extension in GridAction
|
||||
void setAmplitudeRate(float amp);
|
||||
float getAmplitudeRate(void);
|
||||
|
@ -80,8 +77,10 @@ public:
|
|||
virtual ActionInterval* reverse() const override = 0;
|
||||
virtual ActionInterval *clone() const override = 0;
|
||||
|
||||
|
||||
protected:
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float d);
|
||||
|
||||
float _elapsed;
|
||||
bool _firstTick;
|
||||
};
|
||||
|
@ -105,14 +104,6 @@ public:
|
|||
static Sequence* createWithVariableList(FiniteTimeAction *pAction1, va_list args);
|
||||
/** creates the action */
|
||||
static Sequence* createWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Sequence(void);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -124,9 +115,17 @@ public:
|
|||
virtual void update(float t) override;
|
||||
|
||||
protected:
|
||||
Sequence() {}
|
||||
virtual ~Sequence(void);
|
||||
/** initializes the action */
|
||||
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||
|
||||
FiniteTimeAction *_actions[2];
|
||||
float _split;
|
||||
int _last;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Sequence);
|
||||
};
|
||||
|
||||
/** @brief Repeats an action a number of times.
|
||||
|
@ -137,14 +136,6 @@ class CC_DLL Repeat : public ActionInterval
|
|||
public:
|
||||
/** creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
||||
static Repeat* create(FiniteTimeAction *pAction, unsigned int times);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Repeat(void);
|
||||
|
||||
/** initializes a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
||||
bool initWithAction(FiniteTimeAction *pAction, unsigned int times);
|
||||
|
||||
inline void setInnerAction(FiniteTimeAction *pAction)
|
||||
{
|
||||
|
@ -172,12 +163,20 @@ public:
|
|||
virtual bool isDone(void) const override;
|
||||
|
||||
protected:
|
||||
Repeat() {}
|
||||
virtual ~Repeat();
|
||||
/** initializes a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
||||
bool initWithAction(FiniteTimeAction *pAction, unsigned int times);
|
||||
|
||||
unsigned int _times;
|
||||
unsigned int _total;
|
||||
float _nextDt;
|
||||
bool _actionInstant;
|
||||
/** Inner action */
|
||||
FiniteTimeAction *_innerAction;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Repeat);
|
||||
};
|
||||
|
||||
/** @brief Repeats an action for ever.
|
||||
|
@ -189,20 +188,6 @@ class CC_DLL RepeatForever : public ActionInterval
|
|||
public:
|
||||
/** creates the action */
|
||||
static RepeatForever* create(ActionInterval *pAction);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
RepeatForever()
|
||||
: _innerAction(NULL)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~RepeatForever();
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *pAction);
|
||||
|
||||
inline void setInnerAction(ActionInterval *pAction)
|
||||
{
|
||||
|
@ -229,8 +214,18 @@ public:
|
|||
virtual bool isDone(void) const override;
|
||||
|
||||
protected:
|
||||
RepeatForever()
|
||||
: _innerAction(nullptr)
|
||||
{}
|
||||
virtual ~RepeatForever();
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *pAction);
|
||||
|
||||
/** Inner action */
|
||||
ActionInterval *_innerAction;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
||||
};
|
||||
|
||||
/** @brief Spawn a new action immediately
|
||||
|
@ -255,14 +250,6 @@ public:
|
|||
|
||||
/** creates the Spawn action */
|
||||
static Spawn* createWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Spawn(void);
|
||||
|
||||
/** initializes the Spawn action with the 2 actions to spawn */
|
||||
bool initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -274,8 +261,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
Spawn() {}
|
||||
virtual ~Spawn();
|
||||
/** initializes the Spawn action with the 2 actions to spawn */
|
||||
bool initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
||||
|
||||
FiniteTimeAction *_one;
|
||||
FiniteTimeAction *_two;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Spawn);
|
||||
};
|
||||
|
||||
/** @brief Rotates a Node object to a certain angle by modifying it's
|
||||
|
@ -290,10 +285,6 @@ public:
|
|||
|
||||
/** creates the action */
|
||||
static RotateTo* create(float fDuration, float fDeltaAngle);
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||
|
||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -304,6 +295,12 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
RotateTo() {}
|
||||
virtual ~RotateTo() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
float _dstAngleX;
|
||||
float _startAngleX;
|
||||
float _diffAngleX;
|
||||
|
@ -311,6 +308,9 @@ protected:
|
|||
float _dstAngleY;
|
||||
float _startAngleY;
|
||||
float _diffAngleY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateTo);
|
||||
};
|
||||
|
||||
/** @brief Rotates a Node object clockwise a number of degrees by modifying it's rotation attribute.
|
||||
|
@ -320,12 +320,7 @@ class CC_DLL RotateBy : public ActionInterval
|
|||
public:
|
||||
/** creates the action */
|
||||
static RotateBy* create(float fDuration, float fDeltaAngle);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||
|
||||
static RotateBy* create(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
//
|
||||
// Override
|
||||
|
@ -336,10 +331,19 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
RotateBy() {}
|
||||
virtual ~RotateBy() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
float _angleX;
|
||||
float _startAngleX;
|
||||
float _angleY;
|
||||
float _startAngleY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
||||
};
|
||||
|
||||
/** Moves a Node object x,y pixels by modifying it's position attribute.
|
||||
|
@ -354,9 +358,6 @@ public:
|
|||
/** creates the action */
|
||||
static MoveBy* create(float duration, const Point& deltaPosition);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& deltaPosition);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -366,9 +367,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
MoveBy() {}
|
||||
virtual ~MoveBy() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& deltaPosition);
|
||||
|
||||
Point _positionDelta;
|
||||
Point _startPosition;
|
||||
Point _previousPosition;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MoveBy);
|
||||
};
|
||||
|
||||
/** Moves a Node object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
|
||||
|
@ -382,9 +391,6 @@ public:
|
|||
/** creates the action */
|
||||
static MoveTo* create(float duration, const Point& position);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& position);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -392,7 +398,15 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
MoveTo() {}
|
||||
virtual ~MoveTo() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& position);
|
||||
|
||||
Point _endPosition;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MoveTo);
|
||||
};
|
||||
|
||||
/** Skews a Node object to given angles by modifying it's skewX and skewY attributes
|
||||
|
@ -404,9 +418,6 @@ public:
|
|||
/** creates the action */
|
||||
static SkewTo* create(float t, float sx, float sy);
|
||||
|
||||
SkewTo();
|
||||
bool initWithDuration(float t, float sx, float sy);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -416,6 +427,10 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
SkewTo();
|
||||
virtual ~SkewTo() {}
|
||||
bool initWithDuration(float t, float sx, float sy);
|
||||
|
||||
float _skewX;
|
||||
float _skewY;
|
||||
float _startSkewX;
|
||||
|
@ -424,6 +439,9 @@ protected:
|
|||
float _endSkewY;
|
||||
float _deltaX;
|
||||
float _deltaY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(SkewTo);
|
||||
};
|
||||
|
||||
/** Skews a Node object by skewX and skewY degrees
|
||||
|
@ -435,14 +453,20 @@ public:
|
|||
/** creates the action */
|
||||
static SkewBy* create(float t, float deltaSkewX, float deltaSkewY);
|
||||
|
||||
bool initWithDuration(float t, float sx, float sy);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual SkewBy* clone() const override;
|
||||
virtual SkewBy* reverse(void) const override;
|
||||
|
||||
protected:
|
||||
SkewBy() {}
|
||||
virtual ~SkewBy() {}
|
||||
bool initWithDuration(float t, float sx, float sy);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(SkewBy);
|
||||
};
|
||||
|
||||
/** @brief Moves a Node object simulating a parabolic jump movement by modifying it's position attribute.
|
||||
|
@ -453,9 +477,6 @@ public:
|
|||
/** creates the action */
|
||||
static JumpBy* create(float duration, const Point& position, float height, int jumps);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& position, float height, int jumps);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -465,11 +486,19 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
JumpBy() {}
|
||||
virtual ~JumpBy() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& position, float height, int jumps);
|
||||
|
||||
Point _startPosition;
|
||||
Point _delta;
|
||||
float _height;
|
||||
int _jumps;
|
||||
Point _previousPos;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpBy);
|
||||
};
|
||||
|
||||
/** @brief Moves a Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
|
||||
|
@ -486,6 +515,11 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
virtual JumpTo* clone() const override;
|
||||
virtual JumpTo* reverse(void) const override;
|
||||
|
||||
private:
|
||||
JumpTo() {}
|
||||
virtual ~JumpTo() {}
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
|
||||
};
|
||||
|
||||
/** Bezier configuration structure
|
||||
|
@ -513,9 +547,6 @@ public:
|
|||
*/
|
||||
static BezierBy* create(float t, const ccBezierConfig& c);
|
||||
|
||||
/** initializes the action with a duration and a bezier configuration */
|
||||
bool initWithDuration(float t, const ccBezierConfig& c);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -525,9 +556,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
BezierBy() {}
|
||||
virtual ~BezierBy() {}
|
||||
/** initializes the action with a duration and a bezier configuration */
|
||||
bool initWithDuration(float t, const ccBezierConfig& c);
|
||||
|
||||
ccBezierConfig _config;
|
||||
Point _startPosition;
|
||||
Point _previousPosition;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(BezierBy);
|
||||
};
|
||||
|
||||
/** @brief An action that moves the target with a cubic Bezier curve to a destination point.
|
||||
|
@ -544,7 +583,6 @@ public:
|
|||
* @endcode
|
||||
*/
|
||||
static BezierTo* create(float t, const ccBezierConfig& c);
|
||||
bool initWithDuration(float t, const ccBezierConfig &c);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -554,7 +592,14 @@ public:
|
|||
virtual BezierTo* reverse(void) const override;
|
||||
|
||||
protected:
|
||||
BezierTo() {}
|
||||
virtual ~BezierTo() {}
|
||||
bool initWithDuration(float t, const ccBezierConfig &c);
|
||||
|
||||
ccBezierConfig _toConfig;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(BezierTo);
|
||||
};
|
||||
|
||||
/** @brief Scales a Node object to a zoom factor by modifying it's scale attribute.
|
||||
|
@ -569,12 +614,6 @@ public:
|
|||
/** creates the action with and X factor and a Y factor */
|
||||
static ScaleTo* create(float duration, float sx, float sy);
|
||||
|
||||
/** initializes the action with the same scale factor for X and Y */
|
||||
bool initWithDuration(float duration, float s);
|
||||
|
||||
/** initializes the action with and X factor and a Y factor */
|
||||
bool initWithDuration(float duration, float sx, float sy);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -584,6 +623,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ScaleTo() {}
|
||||
virtual ~ScaleTo() {}
|
||||
/** initializes the action with the same scale factor for X and Y */
|
||||
bool initWithDuration(float duration, float s);
|
||||
/** initializes the action with and X factor and a Y factor */
|
||||
bool initWithDuration(float duration, float sx, float sy);
|
||||
|
||||
float _scaleX;
|
||||
float _scaleY;
|
||||
float _startScaleX;
|
||||
|
@ -592,6 +638,9 @@ protected:
|
|||
float _endScaleY;
|
||||
float _deltaX;
|
||||
float _deltaY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
||||
};
|
||||
|
||||
/** @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
||||
|
@ -611,6 +660,13 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
virtual ScaleBy* clone() const override;
|
||||
virtual ScaleBy* reverse(void) const override;
|
||||
|
||||
protected:
|
||||
ScaleBy() {}
|
||||
virtual ~ScaleBy() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ScaleBy);
|
||||
};
|
||||
|
||||
/** @brief Blinks a Node object by modifying it's visible attribute
|
||||
|
@ -621,9 +677,6 @@ public:
|
|||
/** creates the action */
|
||||
static Blink* create(float duration, int blinks);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, int blinks);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -634,8 +687,16 @@ public:
|
|||
virtual void stop() override;
|
||||
|
||||
protected:
|
||||
Blink() {}
|
||||
virtual ~Blink() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, int blinks);
|
||||
|
||||
int _times;
|
||||
bool _originalState;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Blink);
|
||||
};
|
||||
|
||||
/** @brief Fades In an object that implements the RGBAProtocol protocol. It modifies the opacity from 0 to 255.
|
||||
|
@ -653,6 +714,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual FadeIn* clone() const override;
|
||||
virtual ActionInterval* reverse(void) const override;
|
||||
|
||||
protected:
|
||||
FadeIn() {}
|
||||
virtual ~FadeIn() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeIn);
|
||||
};
|
||||
|
||||
/** @brief Fades Out an object that implements the RGBAProtocol protocol. It modifies the opacity from 255 to 0.
|
||||
|
@ -670,6 +738,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual FadeOut* clone() const override;
|
||||
virtual ActionInterval* reverse(void) const override;
|
||||
|
||||
protected:
|
||||
FadeOut() {}
|
||||
virtual ~FadeOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOut);
|
||||
};
|
||||
|
||||
/** @brief Fades an object that implements the RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
|
||||
|
@ -681,9 +756,6 @@ public:
|
|||
/** creates an action with duration and opacity */
|
||||
static FadeTo* create(float duration, GLubyte opacity);
|
||||
|
||||
/** initializes the action with duration and opacity */
|
||||
bool initWithDuration(float duration, GLubyte opacity);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -693,8 +765,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
FadeTo() {}
|
||||
virtual ~FadeTo() {}
|
||||
/** initializes the action with duration and opacity */
|
||||
bool initWithDuration(float duration, GLubyte opacity);
|
||||
|
||||
GLubyte _toOpacity;
|
||||
GLubyte _fromOpacity;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeTo);
|
||||
};
|
||||
|
||||
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
||||
|
@ -707,9 +787,6 @@ public:
|
|||
/** creates an action with duration and color */
|
||||
static TintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||
|
||||
/** initializes the action with duration and color */
|
||||
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -719,8 +796,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
TintTo() {}
|
||||
virtual ~TintTo() {}
|
||||
/** initializes the action with duration and color */
|
||||
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||
|
||||
Color3B _to;
|
||||
Color3B _from;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TintTo);
|
||||
};
|
||||
|
||||
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
||||
|
@ -732,9 +817,6 @@ public:
|
|||
/** creates an action with duration and color */
|
||||
static TintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||
|
||||
/** initializes the action with duration and color */
|
||||
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -744,6 +826,11 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
TintBy() {}
|
||||
virtual ~TintBy() {}
|
||||
/** initializes the action with duration and color */
|
||||
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||
|
||||
GLshort _deltaR;
|
||||
GLshort _deltaG;
|
||||
GLshort _deltaB;
|
||||
|
@ -751,6 +838,9 @@ protected:
|
|||
GLshort _fromR;
|
||||
GLshort _fromG;
|
||||
GLshort _fromB;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TintBy);
|
||||
};
|
||||
|
||||
/** @brief Delays the action a certain amount of seconds
|
||||
|
@ -767,6 +857,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual DelayTime* reverse() const override;
|
||||
virtual DelayTime* clone() const override;
|
||||
|
||||
protected:
|
||||
DelayTime() {}
|
||||
virtual ~DelayTime() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(DelayTime);
|
||||
};
|
||||
|
||||
/** @brief Executes an action in reverse order, from time=duration to time=0
|
||||
|
@ -781,18 +878,6 @@ class CC_DLL ReverseTime : public ActionInterval
|
|||
public:
|
||||
/** creates the action */
|
||||
static ReverseTime* create(FiniteTimeAction *pAction);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ReverseTime(void);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ReverseTime();
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithAction(FiniteTimeAction *pAction);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -804,7 +889,15 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ReverseTime();
|
||||
virtual ~ReverseTime(void);
|
||||
/** initializes the action */
|
||||
bool initWithAction(FiniteTimeAction *pAction);
|
||||
|
||||
FiniteTimeAction *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
|
||||
};
|
||||
|
||||
class Texture2D;
|
||||
|
@ -814,18 +907,6 @@ class CC_DLL Animate : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an Animation and will restore the original frame when the animation is over */
|
||||
static Animate* create(Animation *pAnimation);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Animate();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Animate();
|
||||
|
||||
/** initializes the action with an Animation and will restore the original frame when the animation is over */
|
||||
bool initWithAnimation(Animation *pAnimation);
|
||||
|
||||
/** sets the Animation object to be animated */
|
||||
void setAnimation( Animation* animation );
|
||||
|
@ -843,11 +924,19 @@ public:
|
|||
virtual void update(float t) override;
|
||||
|
||||
protected:
|
||||
Animate();
|
||||
virtual ~Animate();
|
||||
/** initializes the action with an Animation and will restore the original frame when the animation is over */
|
||||
bool initWithAnimation(Animation *pAnimation);
|
||||
|
||||
std::vector<float>* _splitTimes;
|
||||
int _nextFrame;
|
||||
SpriteFrame* _origFrame;
|
||||
unsigned int _executedLoops;
|
||||
Animation* _animation;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Animate);
|
||||
};
|
||||
|
||||
/** Overrides the target of an action so that it always runs on the target
|
||||
|
@ -856,22 +945,9 @@ protected:
|
|||
class CC_DLL TargetedAction : public ActionInterval
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TargetedAction();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TargetedAction();
|
||||
|
||||
/** Create an action with the specified action and forced target */
|
||||
static TargetedAction* create(Node* target, FiniteTimeAction* pAction);
|
||||
|
||||
/** Init an action with the specified action and forced target */
|
||||
bool initWithTarget(Node* target, FiniteTimeAction* pAction);
|
||||
|
||||
/** Sets the target that the action will be forced to run with */
|
||||
void setForcedTarget(Node* forcedTarget);
|
||||
/** returns the target that the action is forced to run with */
|
||||
|
@ -887,9 +963,17 @@ public:
|
|||
virtual void stop(void) override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
TargetedAction();
|
||||
virtual ~TargetedAction();
|
||||
/** Init an action with the specified action and forced target */
|
||||
bool initWithTarget(Node* target, FiniteTimeAction* pAction);
|
||||
|
||||
FiniteTimeAction* _action;
|
||||
Node* _forcedTarget;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -44,9 +44,6 @@ public:
|
|||
/** Creates and initializes with a duration and a percent */
|
||||
static ProgressTo* create(float duration, float fPercent);
|
||||
|
||||
/** Initializes with a duration and a percent */
|
||||
bool initWithDuration(float duration, float fPercent);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -56,8 +53,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ProgressTo() {}
|
||||
virtual ~ProgressTo() {}
|
||||
/** Initializes with a duration and a percent */
|
||||
bool initWithDuration(float duration, float fPercent);
|
||||
|
||||
float _to;
|
||||
float _from;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTo);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -70,9 +75,6 @@ public:
|
|||
/** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage */
|
||||
static ProgressFromTo* create(float duration, float fFromPercentage, float fToPercentage);
|
||||
|
||||
/** Initializes the action with a duration, a "from" percentage and a "to" percentage */
|
||||
bool initWithDuration(float duration, float fFromPercentage, float fToPercentage);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -82,8 +84,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ProgressFromTo() {}
|
||||
virtual ~ProgressFromTo() {}
|
||||
/** Initializes the action with a duration, a "from" percentage and a "to" percentage */
|
||||
bool initWithDuration(float duration, float fFromPercentage, float fToPercentage);
|
||||
|
||||
float _to;
|
||||
float _from;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressFromTo);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -41,16 +41,21 @@ public:
|
|||
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||
static ShakyTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||
|
||||
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||
|
||||
// Override
|
||||
virtual ShakyTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ShakyTiles3D() {}
|
||||
virtual ~ShakyTiles3D() {}
|
||||
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||
|
||||
int _randrange;
|
||||
bool _shakeZ;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ShakyTiles3D);
|
||||
};
|
||||
|
||||
/** @brief ShatteredTiles3D action */
|
||||
|
@ -60,17 +65,22 @@ public:
|
|||
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
|
||||
static ShatteredTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||
|
||||
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||
|
||||
// Override
|
||||
virtual ShatteredTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ShatteredTiles3D() {}
|
||||
virtual ~ShatteredTiles3D() {}
|
||||
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||
|
||||
int _randrange;
|
||||
bool _once;
|
||||
bool _shatterZ;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ShatteredTiles3D);
|
||||
};
|
||||
|
||||
struct Tile;
|
||||
|
@ -82,13 +92,6 @@ class CC_DLL ShuffleTiles : public TiledGrid3DAction
|
|||
public:
|
||||
/** creates the action with a random seed, the grid size and the duration */
|
||||
static ShuffleTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ShuffleTiles(void);
|
||||
/** initializes the action with a random seed, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||
|
||||
void shuffle(unsigned int *array, unsigned int nLen);
|
||||
Size getDelta(const Size& pos) const;
|
||||
|
@ -100,10 +103,18 @@ public:
|
|||
virtual ShuffleTiles* clone() const override;
|
||||
|
||||
protected:
|
||||
ShuffleTiles() {}
|
||||
virtual ~ShuffleTiles();
|
||||
/** initializes the action with a random seed, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||
|
||||
unsigned int _seed;
|
||||
unsigned int _tilesCount;
|
||||
unsigned int* _tilesOrder;
|
||||
Tile* _tiles;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ShuffleTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutTRTiles action
|
||||
|
@ -123,6 +134,13 @@ public:
|
|||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual FadeOutTRTiles* clone() const override;
|
||||
|
||||
protected:
|
||||
FadeOutTRTiles() {}
|
||||
virtual ~FadeOutTRTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutTRTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutBLTiles action.
|
||||
|
@ -137,6 +155,13 @@ public:
|
|||
// Overrides
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
virtual FadeOutBLTiles* clone() const override;
|
||||
|
||||
protected:
|
||||
FadeOutBLTiles() {}
|
||||
virtual ~FadeOutBLTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutBLTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutUpTiles action.
|
||||
|
@ -153,6 +178,13 @@ public:
|
|||
// Overrides
|
||||
virtual FadeOutUpTiles* clone() const override;
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
|
||||
protected:
|
||||
FadeOutUpTiles() {}
|
||||
virtual ~FadeOutUpTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutUpTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutDownTiles action.
|
||||
|
@ -167,6 +199,13 @@ public:
|
|||
// Overrides
|
||||
virtual FadeOutDownTiles* clone() const override;
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
|
||||
protected:
|
||||
FadeOutDownTiles() {}
|
||||
virtual ~FadeOutDownTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutDownTiles);
|
||||
};
|
||||
|
||||
/** @brief TurnOffTiles action.
|
||||
|
@ -179,13 +218,6 @@ public:
|
|||
static TurnOffTiles* create(float duration, const Size& gridSize);
|
||||
/** creates the action with a random seed, the grid size and the duration */
|
||||
static TurnOffTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~TurnOffTiles(void);
|
||||
/** initializes the action with a random seed, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||
|
||||
void shuffle(unsigned int *pArray, unsigned int nLen);
|
||||
void turnOnTile(const Point& pos);
|
||||
|
@ -197,9 +229,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
TurnOffTiles() {}
|
||||
virtual ~TurnOffTiles();
|
||||
/** initializes the action with a random seed, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||
|
||||
unsigned int _seed;
|
||||
unsigned int _tilesCount;
|
||||
unsigned int* _tilesOrder;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TurnOffTiles);
|
||||
};
|
||||
|
||||
/** @brief WavesTiles3D action. */
|
||||
|
@ -209,9 +249,6 @@ public:
|
|||
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
static WavesTiles3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
/** waves amplitude */
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
@ -225,9 +262,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
WavesTiles3D() {}
|
||||
virtual ~WavesTiles3D() {}
|
||||
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(WavesTiles3D);
|
||||
};
|
||||
|
||||
/** @brief JumpTiles3D action.
|
||||
|
@ -239,9 +284,6 @@ public:
|
|||
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
static JumpTiles3D* create(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
|
||||
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
|
||||
/** amplitude of the sin*/
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
@ -255,9 +297,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
JumpTiles3D() {}
|
||||
virtual ~JumpTiles3D() {}
|
||||
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||
|
||||
unsigned int _jumps;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpTiles3D);
|
||||
};
|
||||
|
||||
/** @brief SplitRows action */
|
||||
|
@ -267,17 +317,22 @@ public :
|
|||
/** creates the action with the number of rows to split and the duration */
|
||||
static SplitRows* create(float duration, unsigned int nRows);
|
||||
|
||||
/** initializes the action with the number of rows to split and the duration */
|
||||
bool initWithDuration(float duration, unsigned int nRows);
|
||||
|
||||
// Overrides
|
||||
virtual SplitRows* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
SplitRows() {}
|
||||
virtual ~SplitRows() {}
|
||||
/** initializes the action with the number of rows to split and the duration */
|
||||
bool initWithDuration(float duration, unsigned int nRows);
|
||||
|
||||
unsigned int _rows;
|
||||
Size _winSize;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(SplitRows);
|
||||
};
|
||||
|
||||
/** @brief SplitCols action */
|
||||
|
@ -287,17 +342,22 @@ public:
|
|||
/** creates the action with the number of columns to split and the duration */
|
||||
static SplitCols* create(float duration, unsigned int nCols);
|
||||
|
||||
/** initializes the action with the number of columns to split and the duration */
|
||||
bool initWithDuration(float duration, unsigned int nCols);
|
||||
|
||||
// Overrides
|
||||
virtual SplitCols* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
SplitCols() {}
|
||||
virtual ~SplitCols() {}
|
||||
/** initializes the action with the number of columns to split and the duration */
|
||||
bool initWithDuration(float duration, unsigned int nCols);
|
||||
|
||||
unsigned int _cols;
|
||||
Size _winSize;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(SplitCols);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
ActionTween* ActionTween::create(float aDuration, const char* key, float from, float to)
|
||||
ActionTween* ActionTween::create(float aDuration, const std::string& key, float from, float to)
|
||||
{
|
||||
ActionTween* pRet = new ActionTween();
|
||||
if (pRet && pRet->initWithDuration(aDuration, key, from, to))
|
||||
|
@ -41,7 +41,7 @@ ActionTween* ActionTween::create(float aDuration, const char* key, float from, f
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ActionTween::initWithDuration(float aDuration, const char* key, float from, float to)
|
||||
bool ActionTween::initWithDuration(float aDuration, const std::string& key, float from, float to)
|
||||
{
|
||||
if (ActionInterval::initWithDuration(aDuration))
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual ~ActionTweenDelegate() {}
|
||||
virtual void updateTweenAction(float value, const char* key) = 0;
|
||||
virtual void updateTweenAction(float value, const std::string& key) = 0;
|
||||
};
|
||||
|
||||
/** ActionTween
|
||||
|
@ -69,9 +69,9 @@ class CC_DLL ActionTween : public ActionInterval
|
|||
{
|
||||
public:
|
||||
/** creates an initializes the action with the property name (key), and the from and to parameters. */
|
||||
static ActionTween* create(float duration, const char* key, float from, float to);
|
||||
static ActionTween* create(float duration, const std::string& key, float from, float to);
|
||||
/** initializes the action with the property name (key), and the from and to parameters. */
|
||||
bool initWithDuration(float duration, const char* key, float from, float to);
|
||||
bool initWithDuration(float duration, const std::string& key, float from, float to);
|
||||
|
||||
// Overrides
|
||||
void startWithTarget(Node *target) override;
|
||||
|
|
|
@ -175,7 +175,7 @@ void Animation::addSpriteFrame(SpriteFrame *pFrame)
|
|||
_totalDelayUnits++;
|
||||
}
|
||||
|
||||
void Animation::addSpriteFrameWithFile(const char *filename)
|
||||
void Animation::addSpriteFrameWithFile(const std::string& filename)
|
||||
{
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||
Rect rect = Rect::ZERO;
|
||||
|
|
|
@ -173,11 +173,11 @@ public:
|
|||
The frame will be added with one "delay unit".
|
||||
Added to facilitate the migration from v0.8 to v0.9.
|
||||
*/
|
||||
void addSpriteFrameWithFile(const char *filename);
|
||||
void addSpriteFrameWithFile(const std::string& filename);
|
||||
/**
|
||||
@deprecated. Use addSpriteFrameWithFile() instead
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE void addSpriteFrameWithFileName(const char *filename){ addSpriteFrameWithFile(filename);}
|
||||
CC_DEPRECATED_ATTRIBUTE void addSpriteFrameWithFileName(const std::string& filename){ addSpriteFrameWithFile(filename);}
|
||||
|
||||
/** Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.
|
||||
The frame will be added with one "delay unit".
|
||||
|
|
|
@ -53,22 +53,7 @@ class CC_DLL AtlasNode : public NodeRGBA, public TextureProtocol
|
|||
public:
|
||||
/** creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||
static AtlasNode * create(const std::string& filename, long tileWidth, long tileHeight, long itemsToRender);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
AtlasNode();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~AtlasNode();
|
||||
|
||||
/** initializes an AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||
bool initWithTileFile(const std::string& tile, long tileWidth, long tileHeight, long itemsToRender);
|
||||
|
||||
/** initializes an AtlasNode with a texture the width and height of each item measured in points and the quantity of items to render*/
|
||||
bool initWithTexture(Texture2D* texture, long tileWidth, long tileHeight, long itemsToRender);
|
||||
|
||||
/** updates the Atlas (indexed vertex array).
|
||||
* Shall be overridden in subclasses
|
||||
*/
|
||||
|
@ -104,15 +89,24 @@ public:
|
|||
*/
|
||||
virtual const BlendFunc& getBlendFunc() const override;
|
||||
|
||||
private :
|
||||
|
||||
protected:
|
||||
AtlasNode();
|
||||
virtual ~AtlasNode();
|
||||
|
||||
/** initializes an AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||
bool initWithTileFile(const std::string& tile, long tileWidth, long tileHeight, long itemsToRender);
|
||||
|
||||
/** initializes an AtlasNode with a texture the width and height of each item measured in points and the quantity of items to render*/
|
||||
bool initWithTexture(Texture2D* texture, long tileWidth, long tileHeight, long itemsToRender);
|
||||
|
||||
void calculateMaxItems();
|
||||
void updateBlendFunc();
|
||||
void updateOpacityModifyRGB();
|
||||
|
||||
|
||||
friend class Director;
|
||||
void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor);
|
||||
|
||||
protected:
|
||||
//! chars per row
|
||||
long _itemsPerRow;
|
||||
//! chars per column
|
||||
|
@ -136,6 +130,10 @@ protected:
|
|||
GLint _uniformColor;
|
||||
// This varible is only used for LabelAtlas FPS display. So plz don't modify its value.
|
||||
bool _ignoreContentScaleFactor;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(AtlasNode);
|
||||
|
||||
};
|
||||
|
||||
// end of base_node group
|
||||
|
|
|
@ -49,21 +49,7 @@ public:
|
|||
The stencil node will be retained.
|
||||
*/
|
||||
static ClippingNode* create(Node *pStencil);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ClippingNode();
|
||||
|
||||
/** Initializes a clipping node without a stencil.
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
/** Initializes a clipping node with an other node as its stencil.
|
||||
The stencil node will be retained, and its parent will be set to this clipping node.
|
||||
*/
|
||||
virtual bool init(Node *pStencil);
|
||||
|
||||
|
||||
/** The Node to use as a stencil to do the clipping.
|
||||
The stencil node will be retained.
|
||||
This default to nil.
|
||||
|
@ -109,18 +95,34 @@ public:
|
|||
virtual void onExit() override;
|
||||
virtual void visit() override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
ClippingNode();
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ClippingNode();
|
||||
|
||||
/** Initializes a clipping node without a stencil.
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
/** Initializes a clipping node with an other node as its stencil.
|
||||
The stencil node will be retained, and its parent will be set to this clipping node.
|
||||
*/
|
||||
virtual bool init(Node *pStencil);
|
||||
|
||||
/**draw fullscreen quad to clear stencil bits
|
||||
*/
|
||||
void drawFullScreenQuadClearStencil();
|
||||
|
||||
protected:
|
||||
ClippingNode();
|
||||
|
||||
protected:
|
||||
Node* _stencil;
|
||||
GLfloat _alphaThreshold;
|
||||
bool _inverted;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ClippingNode);
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -46,17 +46,6 @@ class CC_DLL DrawNode : public Node
|
|||
public:
|
||||
/** creates and initialize a DrawNode node */
|
||||
static DrawNode* create();
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
DrawNode();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~DrawNode();
|
||||
|
||||
virtual bool init();
|
||||
|
||||
/** draw a dot at a position, with a given radius and color */
|
||||
void drawDot(const Point &pos, float radius, const Color4F &color);
|
||||
|
@ -99,6 +88,10 @@ public:
|
|||
virtual void draw() override;
|
||||
|
||||
protected:
|
||||
DrawNode();
|
||||
virtual ~DrawNode();
|
||||
virtual bool init();
|
||||
|
||||
void ensureCapacity(long count);
|
||||
void render();
|
||||
|
||||
|
@ -112,6 +105,9 @@ protected:
|
|||
BlendFunc _blendFunc;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -251,7 +251,7 @@ private:
|
|||
GLint _uniforms[UNIFORM_MAX];
|
||||
struct _hashUniformEntry* _hashForUniforms;
|
||||
|
||||
struct flag_struct {
|
||||
struct flag_struct {
|
||||
unsigned int usesTime:1;
|
||||
unsigned int usesMVP:1;
|
||||
unsigned int usesMV:1;
|
||||
|
|
|
@ -119,16 +119,16 @@ Label::~Label()
|
|||
if (_fontAtlas)
|
||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||
|
||||
delete _reusedLetter;
|
||||
_reusedLetter->release();
|
||||
}
|
||||
|
||||
bool Label::init()
|
||||
{
|
||||
if(_fontAtlas)
|
||||
{
|
||||
_reusedLetter = new Sprite;
|
||||
_reusedLetter->initWithTexture(&_fontAtlas->getTexture(0));
|
||||
_reusedLetter = Sprite::createWithTexture(&_fontAtlas->getTexture(0));
|
||||
_reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||
_reusedLetter->retain();
|
||||
return SpriteBatchNode::initWithTexture(&_fontAtlas->getTexture(0), 30);
|
||||
}
|
||||
|
||||
|
@ -437,15 +437,13 @@ Sprite * Label::getLetter(int ID)
|
|||
uvRect.origin.x = _lettersInfo[ID].def.U;
|
||||
uvRect.origin.y = _lettersInfo[ID].def.V;
|
||||
|
||||
sp = new Sprite();
|
||||
sp->initWithTexture(&_fontAtlas->getTexture(_lettersInfo[ID].def.textureID),uvRect);
|
||||
sp = Sprite::createWithTexture(&_fontAtlas->getTexture(_lettersInfo[ID].def.textureID), uvRect);
|
||||
sp->setBatchNode(this);
|
||||
sp->setAnchorPoint(Point(_lettersInfo[ID].def.anchorX, _lettersInfo[ID].def.anchorY));
|
||||
sp->setPosition(_lettersInfo[ID].position);
|
||||
sp->setOpacity(_realOpacity);
|
||||
|
||||
this->addSpriteWithoutQuad(sp, ID, ID);
|
||||
sp->release();
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
|
|
|
@ -511,8 +511,8 @@ bool LabelBMFont::initWithString(const std::string& theString, const std::string
|
|||
|
||||
_imageOffset = imageOffset;
|
||||
|
||||
_reusedChar = new Sprite();
|
||||
_reusedChar->initWithTexture(_textureAtlas->getTexture(), Rect(0, 0, 0, 0), false);
|
||||
_reusedChar = Sprite::createWithTexture(_textureAtlas->getTexture(), Rect(0, 0, 0, 0));
|
||||
_reusedChar->retain();
|
||||
_reusedChar->setBatchNode(this);
|
||||
|
||||
this->setString(theString, true);
|
||||
|
@ -663,10 +663,8 @@ void LabelBMFont::createFontChars()
|
|||
}
|
||||
else
|
||||
{
|
||||
fontChar = new Sprite();
|
||||
fontChar->initWithTexture(_textureAtlas->getTexture(), rect);
|
||||
fontChar = Sprite::createWithTexture(_textureAtlas->getTexture(), rect);
|
||||
addChild(fontChar, i, i);
|
||||
fontChar->release();
|
||||
}
|
||||
|
||||
// Apply label properties
|
||||
|
@ -1199,9 +1197,9 @@ float LabelBMFont::getLetterPosXRight( Sprite* sp )
|
|||
}
|
||||
|
||||
// LabelBMFont - FntFile
|
||||
void LabelBMFont::setFntFile(const char* fntFile)
|
||||
void LabelBMFont::setFntFile(const std::string& fntFile)
|
||||
{
|
||||
if (fntFile != NULL && strcmp(fntFile, _fntFile.c_str()) != 0 )
|
||||
if (_fntFile.compare(fntFile) != 0)
|
||||
{
|
||||
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFile);
|
||||
|
||||
|
@ -1218,9 +1216,9 @@ void LabelBMFont::setFntFile(const char* fntFile)
|
|||
}
|
||||
}
|
||||
|
||||
const char* LabelBMFont::getFntFile()
|
||||
const std::string& LabelBMFont::getFntFile() const
|
||||
{
|
||||
return _fntFile.c_str();
|
||||
return _fntFile;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -258,8 +258,8 @@ public:
|
|||
virtual bool isCascadeColorEnabled() const;
|
||||
virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
|
||||
|
||||
void setFntFile(const char* fntFile);
|
||||
const char* getFntFile();
|
||||
void setFntFile(const std::string& fntFile);
|
||||
const std::string& getFntFile() const;
|
||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||
virtual void draw();
|
||||
#endif // CC_LABELBMFONT_DEBUG_DRAW
|
||||
|
|
|
@ -63,18 +63,8 @@ class CC_DLL Layer : public Node
|
|||
{
|
||||
public:
|
||||
/** creates a fullscreen black layer */
|
||||
static Layer *create(void);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Layer();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Layer();
|
||||
virtual bool init();
|
||||
|
||||
static Layer *create();
|
||||
|
||||
// Deprecated touch callbacks.
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) final {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent); return false;};
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchMoved(Touch *pTouch, Event *pEvent) final {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
|
||||
|
@ -169,18 +159,30 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE virtual void keyMenuClicked() final {};
|
||||
|
||||
protected:
|
||||
Layer();
|
||||
virtual ~Layer();
|
||||
virtual bool init();
|
||||
|
||||
//add the api for avoid use deprecated api
|
||||
void _addTouchListener();
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE void addTouchListener() { _addTouchListener();};
|
||||
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch);
|
||||
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches);
|
||||
|
||||
bool _touchEnabled;
|
||||
bool _accelerometerEnabled;
|
||||
bool _keyboardEnabled;
|
||||
EventListener* _touchListener;
|
||||
EventListenerKeyboard* _keyboardListener;
|
||||
EventListenerAcceleration* _accelerationListener;
|
||||
private:
|
||||
|
||||
Touch::DispatchMode _touchMode;
|
||||
bool _swallowsTouches;
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch);
|
||||
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches);
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Layer);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -195,17 +197,7 @@ class CC_DLL LayerRGBA : public Layer, public RGBAProtocol
|
|||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerRGBA);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
LayerRGBA();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~LayerRGBA();
|
||||
|
||||
virtual bool init();
|
||||
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -226,10 +218,18 @@ public:
|
|||
|
||||
virtual void setOpacityModifyRGB(bool bValue) override {CC_UNUSED_PARAM(bValue);}
|
||||
virtual bool isOpacityModifyRGB() const override { return false; }
|
||||
|
||||
protected:
|
||||
LayerRGBA();
|
||||
virtual ~LayerRGBA();
|
||||
virtual bool init();
|
||||
|
||||
GLubyte _displayedOpacity, _realOpacity;
|
||||
Color3B _displayedColor, _realColor;
|
||||
bool _cascadeOpacityEnabled, _cascadeColorEnabled;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerRGBA);
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -253,27 +253,6 @@ public:
|
|||
static LayerColor * create(const Color4B& color, GLfloat width, GLfloat height);
|
||||
/** creates a Layer with color. Width and height are the window size. */
|
||||
static LayerColor * create(const Color4B& color);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
LayerColor();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~LayerColor();
|
||||
|
||||
virtual bool init();
|
||||
/** initializes a Layer with color, width and height in Points
|
||||
* @js init
|
||||
* @lua init
|
||||
*/
|
||||
bool initWithColor(const Color4B& color, GLfloat width, GLfloat height);
|
||||
/** initializes a Layer with color. Width and height are the window size.
|
||||
* @js init
|
||||
* @lua init
|
||||
*/
|
||||
bool initWithColor(const Color4B& color);
|
||||
|
||||
/** change width in Points*/
|
||||
void changeWidth(GLfloat w);
|
||||
|
@ -307,11 +286,21 @@ public:
|
|||
virtual void setBlendFunc(const BlendFunc& blendFunc) override;
|
||||
|
||||
protected:
|
||||
LayerColor();
|
||||
virtual ~LayerColor();
|
||||
virtual bool init();
|
||||
bool initWithColor(const Color4B& color, GLfloat width, GLfloat height);
|
||||
bool initWithColor(const Color4B& color);
|
||||
|
||||
virtual void updateColor();
|
||||
|
||||
BlendFunc _blendFunc;
|
||||
Vertex2F _squareVertices[4];
|
||||
Color4F _squareColors[4];
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
@ -73,17 +73,6 @@ public:
|
|||
|
||||
/** creates a Menu with MenuItem objects */
|
||||
static Menu* createWithItems(MenuItem *firstItem, va_list args);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Menu() : _selectedItem(NULL) {}
|
||||
virtual ~Menu();
|
||||
|
||||
/** initializes an empty Menu */
|
||||
bool init();
|
||||
|
||||
/** initializes a Menu with a NSArray of MenuItem objects */
|
||||
bool initWithArray(Array* pArrayOfItems);
|
||||
|
||||
/** align items vertically */
|
||||
void alignItemsVertically();
|
||||
|
@ -130,12 +119,27 @@ public:
|
|||
virtual bool isOpacityModifyRGB(void) const override { return false;}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Menu() : _selectedItem(NULL) {}
|
||||
virtual ~Menu();
|
||||
|
||||
/** initializes an empty Menu */
|
||||
bool init();
|
||||
|
||||
/** initializes a Menu with a NSArray of MenuItem objects */
|
||||
bool initWithArray(Array* pArrayOfItems);
|
||||
|
||||
/** whether or not the menu will receive events */
|
||||
bool _enabled;
|
||||
|
||||
MenuItem* itemForTouch(Touch * touch);
|
||||
State _state;
|
||||
MenuItem *_selectedItem;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Menu);
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
|
|
|
@ -65,31 +65,6 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE static MenuItem* create(Object *rec, SEL_MenuHandler selector);
|
||||
/** Creates a MenuItem with a target/selector */
|
||||
static MenuItem* create(const ccMenuCallback& callback);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItem()
|
||||
: _selected(false)
|
||||
, _enabled(false)
|
||||
, _callback(nullptr)
|
||||
, _target(NULL)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItem();
|
||||
|
||||
/** Initializes a MenuItem with a target/selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithCallback(const ccMenuCallback& callback);
|
||||
/** Initializes a MenuItem with a target/selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget( Object *rec, SEL_MenuHandler selector);
|
||||
|
||||
/** Returns the outside box */
|
||||
Rect rect() const;
|
||||
|
@ -120,12 +95,41 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItem()
|
||||
: _selected(false)
|
||||
, _enabled(false)
|
||||
, _callback(nullptr)
|
||||
, _target(NULL)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItem();
|
||||
|
||||
/** Initializes a MenuItem with a target/selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithCallback(const ccMenuCallback& callback);
|
||||
/** Initializes a MenuItem with a target/selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget( Object *rec, SEL_MenuHandler selector);
|
||||
|
||||
bool _selected;
|
||||
bool _enabled;
|
||||
// callback
|
||||
ccMenuCallback _callback;
|
||||
// If using the old API, the _target needs to be retained / released
|
||||
Object *_target;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItem);
|
||||
};
|
||||
|
||||
/** @brief An abstract class for "label" MenuItemLabel items
|
||||
|
@ -146,24 +150,6 @@ public:
|
|||
|
||||
/** creates a MenuItemLabel with a Label. Target and selector will be nil */
|
||||
static MenuItemLabel* create(Node *label);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItemLabel()
|
||||
: _originalScale(0.0)
|
||||
, _label(NULL)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItemLabel();
|
||||
|
||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||
bool initWithLabel(Node* label, const ccMenuCallback& callback);
|
||||
|
||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithLabel(Node* label, Object* target, SEL_MenuHandler selector);
|
||||
|
||||
/** sets a new string to the inner label */
|
||||
void setString(const std::string& label);
|
||||
|
@ -187,6 +173,25 @@ public:
|
|||
virtual void setEnabled(bool enabled) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItemLabel()
|
||||
: _originalScale(0.0)
|
||||
, _label(NULL)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItemLabel();
|
||||
|
||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||
bool initWithLabel(Node* label, const ccMenuCallback& callback);
|
||||
|
||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithLabel(Node* label, Object* target, SEL_MenuHandler selector);
|
||||
|
||||
Color3B _colorBackup;
|
||||
float _originalScale;
|
||||
|
||||
|
@ -194,6 +199,9 @@ protected:
|
|||
Color3B _disabledColor;
|
||||
/** Label that is rendered. It can be any Node that implements the LabelProtocol */
|
||||
Node* _label;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemLabel);
|
||||
};
|
||||
|
||||
|
||||
|
@ -209,6 +217,8 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE static MenuItemAtlasFont* create(const char* value, const char* charMapFile, long itemWidth, long itemHeight, char startCharMap, Object* target, SEL_MenuHandler selector);
|
||||
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
|
||||
static MenuItemAtlasFont* create(const std::string& value, const std::string& charMapFile, long itemWidth, long itemHeight, char startCharMap, const ccMenuCallback& callback);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -223,6 +233,9 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, const char *charMapFile, long itemWidth, long itemHeight, char startCharMap, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string and atlas with a target/selector */
|
||||
bool initWithString(const std::string& value, const std::string& charMapFile, long itemWidth, long itemHeight, char startCharMap, const ccMenuCallback& callback);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemAtlasFont);
|
||||
};
|
||||
|
||||
|
||||
|
@ -233,25 +246,11 @@ class CC_DLL MenuItemFont : public MenuItemLabel
|
|||
{
|
||||
public:
|
||||
/** creates a menu item from a string without target/selector. To be used with MenuItemToggle */
|
||||
static MenuItemFont * create(const std::string& value);
|
||||
static MenuItemFont * create(const std::string& value = "");
|
||||
/** creates a menu item from a string with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemFont * create(const char *value, Object* target, SEL_MenuHandler selector);
|
||||
/** creates a menu item from a string with a target/selector */
|
||||
static MenuItemFont * create(const std::string& value, const ccMenuCallback& callback);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItemFont();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItemFont();
|
||||
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
bool initWithString(const std::string& value, const ccMenuCallback& callback);
|
||||
|
||||
/** set default font size */
|
||||
static void setFontSize(long size);
|
||||
|
@ -293,10 +292,28 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE const std::string& fontNameObj() const { return getFontNameObj(); }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItemFont();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItemFont();
|
||||
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item from a string with a target/selector */
|
||||
bool initWithString(const std::string& value, const ccMenuCallback& callback);
|
||||
|
||||
void recreateLabel();
|
||||
|
||||
long _fontSize;
|
||||
std::string _fontName;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemFont);
|
||||
};
|
||||
|
||||
|
||||
|
@ -322,17 +339,6 @@ public:
|
|||
/** creates a menu item with a normal,selected and disabled image with target/selector */
|
||||
static MenuItemSprite * create(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
||||
|
||||
MenuItemSprite()
|
||||
:_normalImage(NULL)
|
||||
,_selectedImage(NULL)
|
||||
,_disabledImage(NULL)
|
||||
{}
|
||||
|
||||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
||||
bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
||||
|
||||
/** Gets the image used when the item is not selected */
|
||||
inline Node* getNormalImage() const { return _normalImage; };
|
||||
|
||||
|
@ -359,6 +365,17 @@ public:
|
|||
virtual void setEnabled(bool bEnabled);
|
||||
|
||||
protected:
|
||||
MenuItemSprite()
|
||||
:_normalImage(NULL)
|
||||
,_selectedImage(NULL)
|
||||
,_disabledImage(NULL)
|
||||
{}
|
||||
|
||||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Object* target, SEL_MenuHandler selector);
|
||||
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
||||
bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
||||
|
||||
virtual void updateImagesVisibility();
|
||||
|
||||
/** the image used when the item is not selected */
|
||||
|
@ -367,6 +384,9 @@ protected:
|
|||
Node* _selectedImage;
|
||||
/** the image used when the item is disabled */
|
||||
Node* _disabledImage;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemSprite);
|
||||
};
|
||||
|
||||
|
||||
|
@ -396,6 +416,15 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE static MenuItemImage* create(const char *normalImage, const char *selectedImage, const char *disabledImage, Object* target, SEL_MenuHandler selector);
|
||||
/** creates a menu item with a normal,selected and disabled image with a callable object */
|
||||
static MenuItemImage* create(const std::string&normalImage, const std::string&selectedImage, const std::string&disabledImage, const ccMenuCallback& callback);
|
||||
|
||||
/** sets the sprite frame for the normal image */
|
||||
void setNormalSpriteFrame(SpriteFrame* frame);
|
||||
/** sets the sprite frame for the selected image */
|
||||
void setSelectedSpriteFrame(SpriteFrame* frame);
|
||||
/** sets the sprite frame for the disabled image */
|
||||
void setDisabledSpriteFrame(SpriteFrame* frame);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -412,12 +441,8 @@ public:
|
|||
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
||||
bool initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, const ccMenuCallback& callback);
|
||||
|
||||
/** sets the sprite frame for the normal image */
|
||||
void setNormalSpriteFrame(SpriteFrame* frame);
|
||||
/** sets the sprite frame for the selected image */
|
||||
void setSelectedSpriteFrame(SpriteFrame* frame);
|
||||
/** sets the sprite frame for the disabled image */
|
||||
void setDisabledSpriteFrame(SpriteFrame* frame);
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemImage);
|
||||
};
|
||||
|
||||
|
||||
|
@ -436,39 +461,6 @@ public:
|
|||
static MenuItemToggle* create();
|
||||
/** creates a menu item with a item */
|
||||
static MenuItemToggle* create(MenuItem *item);
|
||||
/** creates a menu item from a Array with a target selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle * createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems);
|
||||
/** creates a menu item from a list of items with a target/selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...)CC_REQUIRES_NULL_TERMINATION;
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItemToggle()
|
||||
: _selectedIndex(0)
|
||||
, _subItems(NULL)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItemToggle();
|
||||
|
||||
/** initializes a menu item from a list of items with a target selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, va_list args);
|
||||
/** initializes a menu item from a list of items with a callable object */
|
||||
bool initWithCallback(const ccMenuCallback& callback, MenuItem* item, va_list args);
|
||||
|
||||
/** initializes a menu item with a item */
|
||||
bool initWithItem(MenuItem *item);
|
||||
/** add more menu item */
|
||||
void addSubItem(MenuItem *item);
|
||||
|
||||
|
@ -506,6 +498,40 @@ public:
|
|||
virtual void setEnabled(bool var) override;
|
||||
|
||||
protected:
|
||||
/** creates a menu item from a Array with a target selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle * createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems);
|
||||
/** creates a menu item from a list of items with a target/selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...)CC_REQUIRES_NULL_TERMINATION;
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MenuItemToggle()
|
||||
: _selectedIndex(0)
|
||||
, _subItems(NULL)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MenuItemToggle();
|
||||
|
||||
/** initializes a menu item from a list of items with a target selector
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, va_list args);
|
||||
/** initializes a menu item from a list of items with a callable object */
|
||||
bool initWithCallback(const ccMenuCallback& callback, MenuItem* item, va_list args);
|
||||
|
||||
/** initializes a menu item with a item */
|
||||
bool initWithItem(MenuItem *item);
|
||||
|
||||
/** returns the selected item */
|
||||
unsigned int _selectedIndex;
|
||||
/** Array that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.
|
||||
|
@ -513,6 +539,9 @@ protected:
|
|||
*/
|
||||
Array* _subItems;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemToggle);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -53,20 +53,6 @@ public:
|
|||
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
||||
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */
|
||||
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MotionStreak();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MotionStreak();
|
||||
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
|
||||
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
|
||||
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
||||
|
||||
/** color used for the tint */
|
||||
void tintWithColor(const Color3B& colors);
|
||||
|
@ -114,9 +100,24 @@ public:
|
|||
virtual bool isOpacityModifyRGB() const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MotionStreak();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~MotionStreak();
|
||||
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
|
||||
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
|
||||
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
||||
|
||||
bool _fastMode;
|
||||
bool _startingPositionInitialized;
|
||||
private:
|
||||
|
||||
/** texture used for the motion streak */
|
||||
Texture2D* _texture;
|
||||
BlendFunc _blendFunc;
|
||||
|
@ -138,6 +139,9 @@ private:
|
|||
Vertex2F* _vertices;
|
||||
GLubyte* _colorPointer;
|
||||
Tex2F* _texCoords;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MotionStreak);
|
||||
};
|
||||
|
||||
// end of misc_nodes group
|
||||
|
|
|
@ -152,25 +152,6 @@ public:
|
|||
*/
|
||||
static Node * create(void);
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @js ctor
|
||||
*/
|
||||
Node(void);
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Node(void);
|
||||
|
||||
/**
|
||||
* Initializes the instance of Node
|
||||
* @return Whether the initialization was successful.
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
/**
|
||||
* Gets the description string. It makes debugging easier.
|
||||
* @return A string terminated with '\0'
|
||||
|
@ -1411,7 +1392,11 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// Nodes should be created using create();
|
||||
Node();
|
||||
virtual ~Node();
|
||||
virtual bool init();
|
||||
|
||||
/// lazy allocs
|
||||
void childrenAlloc(void);
|
||||
|
||||
|
@ -1494,6 +1479,9 @@ protected:
|
|||
#ifdef CC_USE_PHYSICS
|
||||
PhysicsBody* _physicsBody; ///< the physicsBody the node have
|
||||
#endif
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
||||
};
|
||||
|
||||
//#pragma mark - NodeRGBA
|
||||
|
@ -1510,18 +1498,6 @@ protected:
|
|||
class CC_DLL NodeRGBA : public Node, public RGBAProtocol
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
NodeRGBA();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~NodeRGBA();
|
||||
|
||||
virtual bool init();
|
||||
|
||||
// overrides
|
||||
virtual GLubyte getOpacity() const override;
|
||||
virtual GLubyte getDisplayedOpacity() const override;
|
||||
|
@ -1541,12 +1517,19 @@ public:
|
|||
virtual bool isOpacityModifyRGB() const override { return false; };
|
||||
|
||||
protected:
|
||||
NodeRGBA();
|
||||
virtual ~NodeRGBA();
|
||||
virtual bool init();
|
||||
|
||||
GLubyte _displayedOpacity;
|
||||
GLubyte _realOpacity;
|
||||
Color3B _displayedColor;
|
||||
Color3B _realColor;
|
||||
bool _cascadeColorEnabled;
|
||||
bool _cascadeOpacityEnabled;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(NodeRGBA);
|
||||
};
|
||||
|
||||
// end of base_node group
|
||||
|
|
|
@ -48,18 +48,6 @@ class CC_DLL ParallaxNode : public Node
|
|||
public:
|
||||
// Create a Parallax node
|
||||
static ParallaxNode * create();
|
||||
|
||||
/** Adds a child to the container with a z-order, a parallax ratio and a position offset
|
||||
It returns self, so you can chain several addChilds.
|
||||
@since v0.8
|
||||
* @js ctor
|
||||
*/
|
||||
ParallaxNode();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ParallaxNode();
|
||||
|
||||
// prevents compiler warning: "Included function hides overloaded virtual functions"
|
||||
using Node::addChild;
|
||||
|
@ -81,10 +69,25 @@ public:
|
|||
virtual void visit(void) override;
|
||||
|
||||
protected:
|
||||
/** Adds a child to the container with a z-order, a parallax ratio and a position offset
|
||||
It returns self, so you can chain several addChilds.
|
||||
@since v0.8
|
||||
* @js ctor
|
||||
*/
|
||||
ParallaxNode();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ParallaxNode();
|
||||
|
||||
Point absolutePosition();
|
||||
|
||||
Point _lastPosition;
|
||||
struct _ccArray* _parallaxArray;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParallaxNode);
|
||||
};
|
||||
|
||||
// end of tilemap_parallax_nodes group
|
||||
|
|
|
@ -59,7 +59,7 @@ ParticleBatchNode::~ParticleBatchNode()
|
|||
* creation with Texture2D
|
||||
*/
|
||||
|
||||
ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, unsigned int capacity/* = kParticleDefaultCapacity*/)
|
||||
ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, int capacity/* = kParticleDefaultCapacity*/)
|
||||
{
|
||||
ParticleBatchNode * p = new ParticleBatchNode();
|
||||
if( p && p->initWithTexture(tex, capacity))
|
||||
|
@ -75,7 +75,7 @@ ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, unsigned
|
|||
* creation with File Image
|
||||
*/
|
||||
|
||||
ParticleBatchNode* ParticleBatchNode::create(const char* imageFile, unsigned int capacity/* = kParticleDefaultCapacity*/)
|
||||
ParticleBatchNode* ParticleBatchNode::create(const std::string& imageFile, int capacity/* = kParticleDefaultCapacity*/)
|
||||
{
|
||||
ParticleBatchNode * p = new ParticleBatchNode();
|
||||
if( p && p->initWithFile(imageFile, capacity))
|
||||
|
@ -90,7 +90,7 @@ ParticleBatchNode* ParticleBatchNode::create(const char* imageFile, unsigned int
|
|||
/*
|
||||
* init with Texture2D
|
||||
*/
|
||||
bool ParticleBatchNode::initWithTexture(Texture2D *tex, unsigned int capacity)
|
||||
bool ParticleBatchNode::initWithTexture(Texture2D *tex, int capacity)
|
||||
{
|
||||
_textureAtlas = new TextureAtlas();
|
||||
_textureAtlas->initWithTexture(tex, capacity);
|
||||
|
@ -109,7 +109,7 @@ bool ParticleBatchNode::initWithTexture(Texture2D *tex, unsigned int capacity)
|
|||
/*
|
||||
* init with FileImage
|
||||
*/
|
||||
bool ParticleBatchNode::initWithFile(const char* fileImage, unsigned int capacity)
|
||||
bool ParticleBatchNode::initWithFile(const std::string& fileImage, int capacity)
|
||||
{
|
||||
Texture2D *tex = Director::getInstance()->getTextureCache()->addImage(fileImage);
|
||||
return initWithTexture(tex, capacity);
|
||||
|
|
|
@ -68,10 +68,10 @@ class CC_DLL ParticleBatchNode : public Node, public TextureProtocol
|
|||
{
|
||||
public:
|
||||
/** initializes the particle system with Texture2D, a capacity of particles, which particle system to use */
|
||||
static ParticleBatchNode* createWithTexture(Texture2D *tex, unsigned int capacity = kParticleDefaultCapacity);
|
||||
static ParticleBatchNode* createWithTexture(Texture2D *tex, int capacity = kParticleDefaultCapacity);
|
||||
|
||||
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
||||
static ParticleBatchNode* create(const char* fileImage, unsigned int capacity = kParticleDefaultCapacity);
|
||||
static ParticleBatchNode* create(const std::string& fileImage, int capacity = kParticleDefaultCapacity);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -83,10 +83,10 @@ public:
|
|||
virtual ~ParticleBatchNode();
|
||||
|
||||
/** initializes the particle system with Texture2D, a capacity of particles */
|
||||
bool initWithTexture(Texture2D *tex, unsigned int capacity);
|
||||
bool initWithTexture(Texture2D *tex, int capacity);
|
||||
|
||||
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
||||
bool initWithFile(const std::string& fileImage, int capacity);
|
||||
|
||||
/** Inserts a child into the ParticleBatchNode */
|
||||
void insertChild(ParticleSystem* system, int index);
|
||||
|
|
|
@ -72,7 +72,7 @@ ParticleFire* ParticleFire::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleFire* ParticleFire::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleFire* ParticleFire::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleFire* pRet = new ParticleFire();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -86,7 +86,7 @@ ParticleFire* ParticleFire::createWithTotalParticles(unsigned int numberOfPartic
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleFire::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleFire::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ ParticleFireworks* ParticleFireworks::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleFireworks* ParticleFireworks::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleFireworks* ParticleFireworks::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleFireworks* pRet = new ParticleFireworks();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -191,7 +191,7 @@ ParticleFireworks* ParticleFireworks::createWithTotalParticles(unsigned int numb
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleFireworks::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleFireworks::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -278,7 +278,7 @@ ParticleSun* ParticleSun::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSun* ParticleSun::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSun* ParticleSun::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSun* pRet = new ParticleSun();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -292,7 +292,7 @@ ParticleSun* ParticleSun::createWithTotalParticles(unsigned int numberOfParticle
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSun::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSun::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ ParticleGalaxy* ParticleGalaxy::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleGalaxy* pRet = new ParticleGalaxy();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -399,7 +399,7 @@ ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleGalaxy::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ ParticleFlower* ParticleFlower::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleFlower* ParticleFlower::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleFlower* ParticleFlower::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleFlower* pRet = new ParticleFlower();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -508,7 +508,7 @@ ParticleFlower* ParticleFlower::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleFlower::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleFlower::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -602,7 +602,7 @@ ParticleMeteor * ParticleMeteor::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleMeteor* ParticleMeteor::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleMeteor* ParticleMeteor::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleMeteor* pRet = new ParticleMeteor();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -616,7 +616,7 @@ ParticleMeteor* ParticleMeteor::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleMeteor::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -711,7 +711,7 @@ ParticleSpiral* ParticleSpiral::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSpiral* ParticleSpiral::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSpiral* ParticleSpiral::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSpiral* pRet = new ParticleSpiral();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -725,7 +725,7 @@ ParticleSpiral* ParticleSpiral::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSpiral::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -820,7 +820,7 @@ ParticleExplosion* ParticleExplosion::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleExplosion* ParticleExplosion::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleExplosion* ParticleExplosion::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleExplosion* pRet = new ParticleExplosion();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -834,7 +834,7 @@ ParticleExplosion* ParticleExplosion::createWithTotalParticles(unsigned int numb
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleExplosion::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -928,7 +928,7 @@ ParticleSmoke* ParticleSmoke::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSmoke* ParticleSmoke::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSmoke* ParticleSmoke::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSmoke* pRet = new ParticleSmoke();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -942,7 +942,7 @@ ParticleSmoke* ParticleSmoke::createWithTotalParticles(unsigned int numberOfPart
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSmoke::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSmoke::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -1033,7 +1033,7 @@ ParticleSnow* ParticleSnow::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSnow* ParticleSnow::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSnow* ParticleSnow::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSnow* pRet = new ParticleSnow();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -1047,7 +1047,7 @@ ParticleSnow* ParticleSnow::createWithTotalParticles(unsigned int numberOfPartic
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSnow::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSnow::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -1141,7 +1141,7 @@ ParticleRain* ParticleRain::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleRain* ParticleRain::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleRain* ParticleRain::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleRain* pRet = new ParticleRain();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -1155,7 +1155,7 @@ ParticleRain* ParticleRain::createWithTotalParticles(unsigned int numberOfPartic
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleRain::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleRain::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
|
|
@ -39,6 +39,10 @@ NS_CC_BEGIN
|
|||
class CC_DLL ParticleFire : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleFire* create();
|
||||
static ParticleFire* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -49,16 +53,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleFire(){}
|
||||
bool init(){ return initWithTotalParticles(250); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleFire* create();
|
||||
static ParticleFire* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
|
||||
};
|
||||
|
||||
//! @brief A fireworks particle system
|
||||
class CC_DLL ParticleFireworks : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleFireworks* create();
|
||||
static ParticleFireworks* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -69,16 +77,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleFireworks(){}
|
||||
bool init(){ return initWithTotalParticles(1500); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleFireworks* create();
|
||||
static ParticleFireworks* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
|
||||
|
||||
};
|
||||
|
||||
//! @brief A sun particle system
|
||||
class CC_DLL ParticleSun : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSun* create();
|
||||
static ParticleSun* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -89,16 +102,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSun(){}
|
||||
bool init(){ return initWithTotalParticles(350); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSun* create();
|
||||
static ParticleSun* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
|
||||
|
||||
};
|
||||
|
||||
//! @brief A galaxy particle system
|
||||
class CC_DLL ParticleGalaxy : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleGalaxy* create();
|
||||
static ParticleGalaxy* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -109,16 +127,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleGalaxy(){}
|
||||
bool init(){ return initWithTotalParticles(200); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleGalaxy* create();
|
||||
static ParticleGalaxy* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
|
||||
|
||||
};
|
||||
|
||||
//! @brief A flower particle system
|
||||
class CC_DLL ParticleFlower : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleFlower* create();
|
||||
static ParticleFlower* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -129,16 +152,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleFlower(){}
|
||||
bool init(){ return initWithTotalParticles(250); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleFlower* create();
|
||||
static ParticleFlower* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
|
||||
};
|
||||
|
||||
//! @brief A meteor particle system
|
||||
class CC_DLL ParticleMeteor : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleMeteor * create();
|
||||
static ParticleMeteor* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -149,16 +176,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleMeteor(){}
|
||||
bool init(){ return initWithTotalParticles(150); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
static ParticleMeteor * create();
|
||||
static ParticleMeteor* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
|
||||
};
|
||||
|
||||
//! @brief An spiral particle system
|
||||
class CC_DLL ParticleSpiral : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSpiral* create();
|
||||
static ParticleSpiral* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -169,16 +200,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSpiral(){}
|
||||
bool init(){ return initWithTotalParticles(500); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSpiral* create();
|
||||
static ParticleSpiral* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
|
||||
|
||||
};
|
||||
|
||||
//! @brief An explosion particle system
|
||||
class CC_DLL ParticleExplosion : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleExplosion* create();
|
||||
static ParticleExplosion* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -189,16 +225,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleExplosion(){}
|
||||
bool init(){ return initWithTotalParticles(700); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleExplosion* create();
|
||||
static ParticleExplosion* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
|
||||
};
|
||||
|
||||
//! @brief An smoke particle system
|
||||
class CC_DLL ParticleSmoke : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSmoke* create();
|
||||
static ParticleSmoke* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -209,16 +249,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSmoke(){}
|
||||
bool init(){ return initWithTotalParticles(200); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSmoke* create();
|
||||
static ParticleSmoke* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
|
||||
};
|
||||
|
||||
//! @brief An snow particle system
|
||||
class CC_DLL ParticleSnow : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSnow* create();
|
||||
static ParticleSnow* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -229,16 +273,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSnow(){}
|
||||
bool init(){ return initWithTotalParticles(700); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSnow* create();
|
||||
static ParticleSnow* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
|
||||
};
|
||||
|
||||
//! @brief A rain particle system
|
||||
class CC_DLL ParticleRain : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleRain* create();
|
||||
static ParticleRain* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -249,10 +297,10 @@ public:
|
|||
*/
|
||||
virtual ~ParticleRain(){}
|
||||
bool init(){ return initWithTotalParticles(1000); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleRain* create();
|
||||
static ParticleRain* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleRain);
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -148,7 +148,7 @@ ParticleSystem * ParticleSystem::create(const std::string& plistFile)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSystem* ParticleSystem::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSystem* ParticleSystem::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSystem *pRet = new ParticleSystem();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -425,7 +425,7 @@ bool ParticleSystem::initWithDictionary(Dictionary *dictionary, const std::strin
|
|||
return bRet;
|
||||
}
|
||||
|
||||
bool ParticleSystem::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSystem::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
_totalParticles = numberOfParticles;
|
||||
|
||||
|
|
|
@ -170,38 +170,7 @@ public:
|
|||
static ParticleSystem * create(const std::string& plistFile);
|
||||
|
||||
//! create a system with a fixed number of particles
|
||||
static ParticleSystem* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ParticleSystem();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ParticleSystem();
|
||||
|
||||
/** initializes a ParticleSystem*/
|
||||
bool init();
|
||||
/** initializes a ParticleSystem from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
http://particledesigner.71squared.com/
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithFile(const std::string& plistFile);
|
||||
|
||||
/** initializes a QuadParticleSystem from a Dictionary.
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary);
|
||||
|
||||
/** initializes a particle system from a NSDictionary and the path from where to load the png
|
||||
@since v2.1
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary, const std::string& dirname);
|
||||
|
||||
//! Initializes a system with a fixed number of particles
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
static ParticleSystem* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
//! Add a particle to the emitter
|
||||
bool addParticle();
|
||||
|
@ -393,10 +362,42 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual const BlendFunc &getBlendFunc() const override;
|
||||
protected:
|
||||
virtual void updateBlendFunc();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ParticleSystem();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ParticleSystem();
|
||||
|
||||
/** initializes a ParticleSystem*/
|
||||
bool init();
|
||||
/** initializes a ParticleSystem from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
http://particledesigner.71squared.com/
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithFile(const std::string& plistFile);
|
||||
|
||||
/** initializes a QuadParticleSystem from a Dictionary.
|
||||
@since v0.99.3
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary);
|
||||
|
||||
/** initializes a particle system from a NSDictionary and the path from where to load the png
|
||||
@since v2.1
|
||||
*/
|
||||
bool initWithDictionary(Dictionary *dictionary, const std::string& dirname);
|
||||
|
||||
//! Initializes a system with a fixed number of particles
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
virtual void updateBlendFunc();
|
||||
|
||||
/** whether or not the particles are using blend additive.
|
||||
If enabled, the following blending function will be used.
|
||||
@code
|
||||
|
@ -551,6 +552,9 @@ protected:
|
|||
@since v0.8
|
||||
*/
|
||||
PositionType _positionType;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystem);
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -46,7 +46,7 @@ NS_CC_BEGIN
|
|||
|
||||
//implementation ParticleSystemQuad
|
||||
// overriding the init method
|
||||
bool ParticleSystemQuad::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
// base initialization
|
||||
if( ParticleSystem::initWithTotalParticles(numberOfParticles) )
|
||||
|
@ -111,27 +111,27 @@ ParticleSystemQuad::~ParticleSystemQuad()
|
|||
|
||||
// implementation ParticleSystemQuad
|
||||
|
||||
ParticleSystemQuad * ParticleSystemQuad::create(const char *plistFile)
|
||||
ParticleSystemQuad * ParticleSystemQuad::create(const std::string& filename)
|
||||
{
|
||||
ParticleSystemQuad *pRet = new ParticleSystemQuad();
|
||||
if (pRet && pRet->initWithFile(plistFile))
|
||||
ParticleSystemQuad *ret = new ParticleSystemQuad();
|
||||
if (ret && ret->initWithFile(filename))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return pRet;
|
||||
CC_SAFE_DELETE(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ParticleSystemQuad * ParticleSystemQuad::createWithTotalParticles(unsigned int numberOfParticles) {
|
||||
ParticleSystemQuad *pRet = new ParticleSystemQuad();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
ParticleSystemQuad * ParticleSystemQuad::createWithTotalParticles(int numberOfParticles) {
|
||||
ParticleSystemQuad *ret = new ParticleSystemQuad();
|
||||
if (ret && ret->initWithTotalParticles(numberOfParticles))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return pRet;
|
||||
CC_SAFE_DELETE(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,26 +57,11 @@ public:
|
|||
/** creates a Particle Emitter */
|
||||
static ParticleSystemQuad * create();
|
||||
/** creates a Particle Emitter with a number of particles */
|
||||
static ParticleSystemQuad * createWithTotalParticles(unsigned int numberOfParticles);
|
||||
static ParticleSystemQuad * createWithTotalParticles(int numberOfParticles);
|
||||
/** creates an initializes a ParticleSystemQuad from a plist file.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
*/
|
||||
static ParticleSystemQuad * create(const char *plistFile);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ParticleSystemQuad();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ParticleSystemQuad();
|
||||
|
||||
/** initializes the indices for the vertices*/
|
||||
void initIndices();
|
||||
|
||||
/** initializes the texture with a rectangle measured Points */
|
||||
void initTexCoordsWithRect(const Rect& rect);
|
||||
static ParticleSystemQuad * create(const std::string& filename);
|
||||
|
||||
/** Sets a new SpriteFrame as particle.
|
||||
WARNING: this method is experimental. Use setTextureWithRect instead.
|
||||
|
@ -102,7 +87,7 @@ public:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles) override;
|
||||
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
@ -134,18 +119,36 @@ public:
|
|||
*/
|
||||
virtual void setTotalParticles(int tp) override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ParticleSystemQuad();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ParticleSystemQuad();
|
||||
|
||||
/** initializes the indices for the vertices*/
|
||||
void initIndices();
|
||||
|
||||
/** initializes the texture with a rectangle measured Points */
|
||||
void initTexCoordsWithRect(const Rect& rect);
|
||||
|
||||
void setupVBOandVAO();
|
||||
void setupVBO();
|
||||
bool allocMemory();
|
||||
|
||||
protected:
|
||||
|
||||
V3F_C4B_T2F_Quad *_quads; // quads to be rendered
|
||||
GLushort *_indices; // indices
|
||||
|
||||
GLuint _VAOname;
|
||||
|
||||
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -62,18 +62,6 @@ public:
|
|||
|
||||
/** Creates a progress timer with the sprite as the shape the timer goes through */
|
||||
static ProgressTimer* create(Sprite* sp);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ProgressTimer();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ProgressTimer();
|
||||
|
||||
/** Initializes a progress timer with the sprite as the shape the timer goes through */
|
||||
bool initWithSprite(Sprite* sp);
|
||||
|
||||
/** Change the percentage to change progress. */
|
||||
inline Type getType() const { return _type; }
|
||||
|
@ -129,6 +117,19 @@ public:
|
|||
virtual void setOpacity(GLubyte opacity) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ProgressTimer();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ProgressTimer();
|
||||
|
||||
/** Initializes a progress timer with the sprite as the shape the timer goes through */
|
||||
bool initWithSprite(Sprite* sp);
|
||||
|
||||
Tex2F textureCoordFromAlphaPoint(Point alpha);
|
||||
Vertex2F vertexFromAlphaPoint(Point alpha);
|
||||
void updateProgress(void);
|
||||
|
@ -146,6 +147,9 @@ protected:
|
|||
V2F_C4B_T2F *_vertexData;
|
||||
|
||||
bool _reverseDirection;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTimer);
|
||||
};
|
||||
|
||||
// end of misc_nodes group
|
||||
|
|
|
@ -543,20 +543,20 @@ void RenderTexture::draw()
|
|||
}
|
||||
}
|
||||
|
||||
bool RenderTexture::saveToFile(const char *szFilePath)
|
||||
bool RenderTexture::saveToFile(const std::string& filename)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
Image *image = newImage(true);
|
||||
if (image)
|
||||
{
|
||||
ret = image->saveToFile(szFilePath);
|
||||
ret = image->saveToFile(filename);
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(image);
|
||||
return ret;
|
||||
}
|
||||
bool RenderTexture::saveToFile(const char *fileName, Image::Format format)
|
||||
bool RenderTexture::saveToFile(const std::string& fileName, Image::Format format)
|
||||
{
|
||||
bool bRet = false;
|
||||
CCASSERT(format == Image::Format::JPG || format == Image::Format::PNG,
|
||||
|
|
|
@ -58,21 +58,6 @@ public:
|
|||
|
||||
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
|
||||
static RenderTexture * create(int w, int h);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
RenderTexture();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~RenderTexture();
|
||||
|
||||
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
|
||||
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat);
|
||||
|
||||
/** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
|
||||
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat, GLuint uDepthStencilFormat);
|
||||
|
||||
/** starts grabbing */
|
||||
void begin();
|
||||
|
@ -114,12 +99,12 @@ public:
|
|||
/** saves the texture into a file using JPEG format. The file will be saved in the Documents folder.
|
||||
Returns true if the operation is successful.
|
||||
*/
|
||||
bool saveToFile(const char *szFilePath);
|
||||
bool saveToFile(const std::string& filename);
|
||||
|
||||
/** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder.
|
||||
Returns true if the operation is successful.
|
||||
*/
|
||||
bool saveToFile(const char *name, Image::Format format);
|
||||
bool saveToFile(const std::string& filename, Image::Format format);
|
||||
|
||||
/** Listen "come to background" message, and save render texture.
|
||||
It only has effect on Android.
|
||||
|
@ -167,10 +152,20 @@ public:
|
|||
virtual void visit() override;
|
||||
virtual void draw() override;
|
||||
|
||||
private:
|
||||
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
|
||||
public:
|
||||
// XXX should be procted.
|
||||
// but due to a bug in PowerVR + Android,
|
||||
// the constructor is public again
|
||||
RenderTexture();
|
||||
virtual ~RenderTexture();
|
||||
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
|
||||
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat);
|
||||
/** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
|
||||
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat, GLuint uDepthStencilFormat);
|
||||
|
||||
protected:
|
||||
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
|
||||
|
||||
GLuint _FBO;
|
||||
GLuint _depthRenderBufffer;
|
||||
GLint _oldFBO;
|
||||
|
@ -192,6 +187,10 @@ protected:
|
|||
- [[renderTexture sprite] setBlendFunc:(BlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
||||
*/
|
||||
Sprite* _sprite;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RenderTexture);
|
||||
|
||||
};
|
||||
|
||||
// end of textures group
|
||||
|
|
|
@ -56,18 +56,9 @@ public:
|
|||
static Scene *createWithPhysics();
|
||||
#endif
|
||||
|
||||
Scene();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Scene();
|
||||
|
||||
bool init();
|
||||
|
||||
|
||||
#ifdef CC_USE_PHYSICS
|
||||
public:
|
||||
bool initWithPhysics();
|
||||
|
||||
inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; }
|
||||
|
||||
|
@ -77,14 +68,23 @@ public:
|
|||
virtual void update(float delta) override;
|
||||
|
||||
protected:
|
||||
virtual void addChildToPhysicsWorld(Node* child);
|
||||
|
||||
protected:
|
||||
bool initWithPhysics();
|
||||
void addChildToPhysicsWorld(Node* child);
|
||||
|
||||
PhysicsWorld* _physicsWorld;
|
||||
#endif // CC_USE_PHYSICS
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
Scene();
|
||||
virtual ~Scene();
|
||||
bool init();
|
||||
|
||||
friend class Node;
|
||||
friend class SpriteBatchNode;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Scene);
|
||||
};
|
||||
|
||||
// end of scene group
|
||||
|
|
|
@ -70,10 +70,10 @@ Sprite* Sprite::createWithTexture(Texture2D *texture)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Sprite* Sprite::createWithTexture(Texture2D *texture, const Rect& rect)
|
||||
Sprite* Sprite::createWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
||||
{
|
||||
Sprite *sprite = new Sprite();
|
||||
if (sprite && sprite->initWithTexture(texture, rect))
|
||||
if (sprite && sprite->initWithTexture(texture, rect, rotated))
|
||||
{
|
||||
sprite->autorelease();
|
||||
return sprite;
|
||||
|
@ -145,7 +145,74 @@ Sprite* Sprite::create()
|
|||
|
||||
bool Sprite::init(void)
|
||||
{
|
||||
return initWithTexture(NULL, Rect::ZERO);
|
||||
return initWithTexture(NULL, Rect::ZERO );
|
||||
}
|
||||
|
||||
bool Sprite::initWithTexture(Texture2D *texture)
|
||||
{
|
||||
CCASSERT(texture != NULL, "Invalid texture for sprite");
|
||||
|
||||
Rect rect = Rect::ZERO;
|
||||
rect.size = texture->getContentSize();
|
||||
|
||||
return initWithTexture(texture, rect);
|
||||
}
|
||||
|
||||
bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect)
|
||||
{
|
||||
return initWithTexture(texture, rect, false);
|
||||
}
|
||||
|
||||
bool Sprite::initWithFile(const std::string& filename)
|
||||
{
|
||||
CCASSERT(filename.size()>0, "Invalid filename for sprite");
|
||||
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||
if (texture)
|
||||
{
|
||||
Rect rect = Rect::ZERO;
|
||||
rect.size = texture->getContentSize();
|
||||
return initWithTexture(texture, rect);
|
||||
}
|
||||
|
||||
// don't release here.
|
||||
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
||||
// this->release();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Sprite::initWithFile(const std::string &filename, const Rect& rect)
|
||||
{
|
||||
CCASSERT(filename.size()>0, "Invalid filename");
|
||||
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||
if (texture)
|
||||
{
|
||||
return initWithTexture(texture, rect);
|
||||
}
|
||||
|
||||
// don't release here.
|
||||
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
||||
// this->release();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Sprite::initWithSpriteFrameName(const std::string& spriteFrameName)
|
||||
{
|
||||
CCASSERT(spriteFrameName.size() > 0, "Invalid spriteFrameName");
|
||||
|
||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
return initWithSpriteFrame(frame);
|
||||
}
|
||||
|
||||
bool Sprite::initWithSpriteFrame(SpriteFrame *spriteFrame)
|
||||
{
|
||||
CCASSERT(spriteFrame != NULL, "");
|
||||
|
||||
bool bRet = initWithTexture(spriteFrame->getTexture(), spriteFrame->getRect());
|
||||
setSpriteFrame(spriteFrame);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// designated initializer
|
||||
|
@ -200,73 +267,6 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
|||
}
|
||||
}
|
||||
|
||||
bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect)
|
||||
{
|
||||
return initWithTexture(texture, rect, false);
|
||||
}
|
||||
|
||||
bool Sprite::initWithTexture(Texture2D *texture)
|
||||
{
|
||||
CCASSERT(texture != NULL, "Invalid texture for sprite");
|
||||
|
||||
Rect rect = Rect::ZERO;
|
||||
rect.size = texture->getContentSize();
|
||||
|
||||
return initWithTexture(texture, rect);
|
||||
}
|
||||
|
||||
bool Sprite::initWithFile(const std::string& filename)
|
||||
{
|
||||
CCASSERT(filename.size()>0, "Invalid filename for sprite");
|
||||
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||
if (texture)
|
||||
{
|
||||
Rect rect = Rect::ZERO;
|
||||
rect.size = texture->getContentSize();
|
||||
return initWithTexture(texture, rect);
|
||||
}
|
||||
|
||||
// don't release here.
|
||||
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
||||
// this->release();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Sprite::initWithFile(const std::string &filename, const Rect& rect)
|
||||
{
|
||||
CCASSERT(filename.size()>0, "Invalid filename");
|
||||
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||
if (texture)
|
||||
{
|
||||
return initWithTexture(texture, rect);
|
||||
}
|
||||
|
||||
// don't release here.
|
||||
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
||||
// this->release();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Sprite::initWithSpriteFrame(SpriteFrame *spriteFrame)
|
||||
{
|
||||
CCASSERT(spriteFrame != NULL, "");
|
||||
|
||||
bool bRet = initWithTexture(spriteFrame->getTexture(), spriteFrame->getRect());
|
||||
setDisplayFrame(spriteFrame);
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool Sprite::initWithSpriteFrameName(const std::string& spriteFrameName)
|
||||
{
|
||||
CCASSERT(spriteFrameName.size() > 0, "Invalid spriteFrameName");
|
||||
|
||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||
return initWithSpriteFrame(frame);
|
||||
}
|
||||
|
||||
// XXX: deprecated
|
||||
/*
|
||||
Sprite* Sprite::initWithCGImage(CGImageRef pImage)
|
||||
|
@ -304,12 +304,83 @@ Sprite::~Sprite(void)
|
|||
CC_SAFE_RELEASE(_texture);
|
||||
}
|
||||
|
||||
/*
|
||||
* Texture methods
|
||||
*/
|
||||
|
||||
/*
|
||||
* This array is the data of a white image with 2 by 2 dimension.
|
||||
* It's used for creating a default texture when sprite's texture is set to NULL.
|
||||
* Supposing codes as follows:
|
||||
*
|
||||
* auto sp = new Sprite();
|
||||
* sp->init(); // Texture was set to NULL, in order to make opacity and color to work correctly, we need to create a 2x2 white texture.
|
||||
*
|
||||
* The test is in "TestCpp/SpriteTest/Sprite without texture".
|
||||
*/
|
||||
static unsigned char cc_2x2_white_image[] = {
|
||||
// RGBA8888
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
#define CC_2x2_WHITE_IMAGE_KEY "/cc_2x2_white_image"
|
||||
|
||||
void Sprite::setTexture(const std::string &filename)
|
||||
{
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||
setTexture(texture);
|
||||
|
||||
Rect rect = Rect::ZERO;
|
||||
rect.size = texture->getContentSize();
|
||||
setTextureRect(rect);
|
||||
}
|
||||
|
||||
void Sprite::setTexture(Texture2D *texture)
|
||||
{
|
||||
// If batchnode, then texture id should be the same
|
||||
CCASSERT(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode");
|
||||
// accept texture==nil as argument
|
||||
CCASSERT( !texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument");
|
||||
|
||||
if (texture == nullptr)
|
||||
{
|
||||
// Gets the texture by key firstly.
|
||||
texture = Director::getInstance()->getTextureCache()->getTextureForKey(CC_2x2_WHITE_IMAGE_KEY);
|
||||
|
||||
// If texture wasn't in cache, create it from RAW data.
|
||||
if (texture == nullptr)
|
||||
{
|
||||
Image* image = new Image();
|
||||
bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
|
||||
CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully.");
|
||||
|
||||
texture = Director::getInstance()->getTextureCache()->addImage(image, CC_2x2_WHITE_IMAGE_KEY);
|
||||
CC_SAFE_RELEASE(image);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_batchNode && _texture != texture)
|
||||
{
|
||||
CC_SAFE_RETAIN(texture);
|
||||
CC_SAFE_RELEASE(_texture);
|
||||
_texture = texture;
|
||||
updateBlendFunc();
|
||||
}
|
||||
}
|
||||
|
||||
Texture2D* Sprite::getTexture() const
|
||||
{
|
||||
return _texture;
|
||||
}
|
||||
|
||||
void Sprite::setTextureRect(const Rect& rect)
|
||||
{
|
||||
setTextureRect(rect, false, rect.size);
|
||||
}
|
||||
|
||||
|
||||
void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimmedSize)
|
||||
{
|
||||
_rectRotated = rotated;
|
||||
|
@ -982,20 +1053,30 @@ void Sprite::updateDisplayedOpacity(GLubyte opacity)
|
|||
|
||||
// Frames
|
||||
|
||||
void Sprite::setDisplayFrame(SpriteFrame *pNewFrame)
|
||||
void Sprite::setSpriteFrame(const std::string &spriteFrameName)
|
||||
{
|
||||
_unflippedOffsetPositionFromCenter = pNewFrame->getOffset();
|
||||
SpriteFrameCache *cache = SpriteFrameCache::getInstance();
|
||||
SpriteFrame *spriteFrame = cache->getSpriteFrameByName(spriteFrameName);
|
||||
|
||||
Texture2D *pNewTexture = pNewFrame->getTexture();
|
||||
CCASSERT(spriteFrame, "Invalid spriteFrameName");
|
||||
|
||||
setSpriteFrame(spriteFrame);
|
||||
}
|
||||
|
||||
void Sprite::setSpriteFrame(SpriteFrame *spriteFrame)
|
||||
{
|
||||
_unflippedOffsetPositionFromCenter = spriteFrame->getOffset();
|
||||
|
||||
Texture2D *texture = spriteFrame->getTexture();
|
||||
// update texture before updating texture rect
|
||||
if (pNewTexture != _texture)
|
||||
if (texture != _texture)
|
||||
{
|
||||
setTexture(pNewTexture);
|
||||
setTexture(texture);
|
||||
}
|
||||
|
||||
// update rect
|
||||
_rectRotated = pNewFrame->isRotated();
|
||||
setTextureRect(pNewFrame->getRect(), _rectRotated, pNewFrame->getOriginalSize());
|
||||
_rectRotated = spriteFrame->isRotated();
|
||||
setTextureRect(spriteFrame->getRect(), _rectRotated, spriteFrame->getOriginalSize());
|
||||
}
|
||||
|
||||
void Sprite::setDisplayFrameWithAnimationName(const std::string& animationName, int frameIndex)
|
||||
|
@ -1010,7 +1091,7 @@ void Sprite::setDisplayFrameWithAnimationName(const std::string& animationName,
|
|||
|
||||
CCASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");
|
||||
|
||||
setDisplayFrame(frame->getSpriteFrame());
|
||||
setSpriteFrame(frame->getSpriteFrame());
|
||||
}
|
||||
|
||||
bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
||||
|
@ -1022,7 +1103,7 @@ bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
|||
frame->getOffset().equals(_unflippedOffsetPositionFromCenter));
|
||||
}
|
||||
|
||||
SpriteFrame* Sprite::getDisplayFrame()
|
||||
SpriteFrame* Sprite::getSpriteFrame() const
|
||||
{
|
||||
return SpriteFrame::createWithTexture(_texture,
|
||||
CC_RECT_POINTS_TO_PIXELS(_rect),
|
||||
|
@ -1083,62 +1164,4 @@ void Sprite::updateBlendFunc(void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This array is the data of a white image with 2 by 2 dimension.
|
||||
* It's used for creating a default texture when sprite's texture is set to NULL.
|
||||
* Supposing codes as follows:
|
||||
*
|
||||
* auto sp = new Sprite();
|
||||
* sp->init(); // Texture was set to NULL, in order to make opacity and color to work correctly, we need to create a 2x2 white texture.
|
||||
*
|
||||
* The test is in "TestCpp/SpriteTest/Sprite without texture".
|
||||
*/
|
||||
static unsigned char cc_2x2_white_image[] = {
|
||||
// RGBA8888
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
#define CC_2x2_WHITE_IMAGE_KEY "/cc_2x2_white_image"
|
||||
|
||||
void Sprite::setTexture(Texture2D *texture)
|
||||
{
|
||||
// If batchnode, then texture id should be the same
|
||||
CCASSERT(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode");
|
||||
// accept texture==nil as argument
|
||||
CCASSERT( !texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument");
|
||||
|
||||
if (NULL == texture)
|
||||
{
|
||||
// Gets the texture by key firstly.
|
||||
texture = Director::getInstance()->getTextureCache()->getTextureForKey(CC_2x2_WHITE_IMAGE_KEY);
|
||||
|
||||
// If texture wasn't in cache, create it from RAW data.
|
||||
if (NULL == texture)
|
||||
{
|
||||
Image* image = new Image();
|
||||
bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
|
||||
CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully.");
|
||||
|
||||
texture = Director::getInstance()->getTextureCache()->addImage(image, CC_2x2_WHITE_IMAGE_KEY);
|
||||
CC_SAFE_RELEASE(image);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_batchNode && _texture != texture)
|
||||
{
|
||||
CC_SAFE_RETAIN(texture);
|
||||
CC_SAFE_RELEASE(_texture);
|
||||
_texture = texture;
|
||||
updateBlendFunc();
|
||||
}
|
||||
}
|
||||
|
||||
Texture2D* Sprite::getTexture(void) const
|
||||
{
|
||||
return _texture;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -133,9 +133,10 @@ public:
|
|||
* @param texture A pointer to an existing Texture2D object.
|
||||
* You can use a Texture2D object for many sprites.
|
||||
* @param rect Only the contents inside the rect of this texture will be applied for this sprite.
|
||||
* @param rotated Whether or not the rect is rotated
|
||||
* @return A valid sprite object that is marked as autoreleased.
|
||||
*/
|
||||
static Sprite* createWithTexture(Texture2D *texture, const Rect& rect);
|
||||
static Sprite* createWithTexture(Texture2D *texture, const Rect& rect, bool rotated=false);
|
||||
|
||||
/**
|
||||
* Creates a sprite with an sprite frame.
|
||||
|
@ -159,113 +160,6 @@ public:
|
|||
/// @} end of creators group
|
||||
|
||||
|
||||
/// @{
|
||||
/// @name Initializers
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @js ctor
|
||||
*/
|
||||
Sprite(void);
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Sprite(void);
|
||||
|
||||
/**
|
||||
* Initializes an empty sprite with nothing init.
|
||||
*/
|
||||
virtual bool init(void);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with a texture.
|
||||
*
|
||||
* After initialization, the rect used will be the size of the texture, and the offset will be (0,0).
|
||||
*
|
||||
* @param texture A pointer to an existing Texture2D object.
|
||||
* You can use a Texture2D object for many sprites.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with a texture and a rect.
|
||||
*
|
||||
* After initialization, the offset will be (0,0).
|
||||
*
|
||||
* @param texture A pointer to an exisiting Texture2D object.
|
||||
* You can use a Texture2D object for many sprites.
|
||||
* @param rect Only the contents inside rect of this texture will be applied for this sprite.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with a texture and a rect in points, optionally rotated.
|
||||
*
|
||||
* After initialization, the offset will be (0,0).
|
||||
* @note This is the designated initializer.
|
||||
*
|
||||
* @param texture A Texture2D object whose texture will be applied to this sprite.
|
||||
* @param rect A rectangle assigned the contents of texture.
|
||||
* @param rotated Whether or not the texture rectangle is rotated.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect, bool rotated);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an SpriteFrame. The texture and rect in SpriteFrame will be applied on this sprite
|
||||
*
|
||||
* @param pSpriteFrame A SpriteFrame object. It should includes a valid texture and a rect
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithSpriteFrame(SpriteFrame *pSpriteFrame);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an sprite frame name.
|
||||
*
|
||||
* A SpriteFrame will be fetched from the SpriteFrameCache by name.
|
||||
* If the SpriteFrame doesn't exist it will raise an exception.
|
||||
*
|
||||
* @param spriteFrameName A key string that can fected a volid SpriteFrame from SpriteFrameCache
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an image filename.
|
||||
*
|
||||
* This method will find filename from local file system, load its content to Texture2D,
|
||||
* then use Texture2D to create a sprite.
|
||||
* After initialization, the rect used will be the size of the image. The offset will be (0,0).
|
||||
*
|
||||
* @param filename The path to an image file in local file system
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @js init
|
||||
* @lua init
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& filename);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an image filename, and a rect.
|
||||
*
|
||||
* This method will find filename from local file system, load its content to Texture2D,
|
||||
* then use Texture2D to create a sprite.
|
||||
* After initialization, the offset will be (0,0).
|
||||
*
|
||||
* @param filename The path to an image file in local file system.
|
||||
* @param rect The rectangle assigned the content area from texture.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @js init
|
||||
* @lua init
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& filename, const Rect& rect);
|
||||
|
||||
/// @} end of initializers
|
||||
|
||||
/// @{
|
||||
/// @name BatchNode methods
|
||||
|
||||
|
@ -298,7 +192,21 @@ public:
|
|||
|
||||
|
||||
/// @{
|
||||
/// @name Texture methods
|
||||
/// @name Texture / Frame methods
|
||||
|
||||
/** Sets a new texture (from a filename) to the sprite.
|
||||
It will call `setTextureRect()` with the texture's content size.
|
||||
TODO: The whole Sprite API needs to be reviewed.
|
||||
*/
|
||||
virtual void setTexture(const std::string &filename );
|
||||
|
||||
/** Sets a new texture to the sprite.
|
||||
The Texture's rect is not changed.
|
||||
*/
|
||||
virtual void setTexture(Texture2D *texture) override;
|
||||
|
||||
/** returns the Texture2D object used by the sprite */
|
||||
virtual Texture2D* getTexture() const override;
|
||||
|
||||
/**
|
||||
* Updates the texture rect of the Sprite in points.
|
||||
|
@ -320,30 +228,28 @@ public:
|
|||
*/
|
||||
virtual void setVertexRect(const Rect& rect);
|
||||
|
||||
/// @} end of texture methods
|
||||
|
||||
|
||||
|
||||
/// @{
|
||||
/// @name Frames methods
|
||||
|
||||
/**
|
||||
* Sets a new display frame to the Sprite.
|
||||
* Sets a new SpriteFrame to the Sprite.
|
||||
*/
|
||||
virtual void setDisplayFrame(SpriteFrame *pNewFrame);
|
||||
virtual void setSpriteFrame(SpriteFrame* newFrame);
|
||||
virtual void setSpriteFrame(const std::string &spriteFrameName);
|
||||
|
||||
/** @deprecated Use `setSpriteFrame()` instead. */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setDisplayFrame(SpriteFrame *newFrame) { setSpriteFrame(newFrame); }
|
||||
|
||||
/**
|
||||
* Returns whether or not a SpriteFrame is being displayed
|
||||
*/
|
||||
virtual bool isFrameDisplayed(SpriteFrame *pFrame) const;
|
||||
|
||||
/** @deprecated Use getDisplayFrame() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* displayFrame() { return getDisplayFrame(); };
|
||||
|
||||
/**
|
||||
* Returns the current displayed frame.
|
||||
*/
|
||||
virtual SpriteFrame* getDisplayFrame();
|
||||
virtual SpriteFrame* getSpriteFrame() const;
|
||||
/** @deprecated Use `getSpriteFrame()` instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* getDisplayFrame() const { return getSpriteFrame(); }
|
||||
/** @deprecated Use `getSpriteFrame()` instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* displayFrame() const { return getSpriteFrame(); };
|
||||
|
||||
/// @} End of frames methods
|
||||
|
||||
|
@ -473,8 +379,6 @@ public:
|
|||
//
|
||||
/// @{
|
||||
/// @name Functions inherited from TextureProtocol
|
||||
virtual void setTexture(Texture2D *texture) override;
|
||||
virtual Texture2D* getTexture() const override;
|
||||
/**
|
||||
*@code
|
||||
*When this function bound into js or lua,the parameter will be changed
|
||||
|
@ -531,6 +435,97 @@ public:
|
|||
/// @}
|
||||
|
||||
protected:
|
||||
|
||||
Sprite(void);
|
||||
virtual ~Sprite(void);
|
||||
|
||||
/* Initializes an empty sprite with nothing init. */
|
||||
virtual bool init(void);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with a texture.
|
||||
*
|
||||
* After initialization, the rect used will be the size of the texture, and the offset will be (0,0).
|
||||
*
|
||||
* @param texture A pointer to an existing Texture2D object.
|
||||
* You can use a Texture2D object for many sprites.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with a texture and a rect.
|
||||
*
|
||||
* After initialization, the offset will be (0,0).
|
||||
*
|
||||
* @param texture A pointer to an exisiting Texture2D object.
|
||||
* You can use a Texture2D object for many sprites.
|
||||
* @param rect Only the contents inside rect of this texture will be applied for this sprite.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with a texture and a rect in points, optionally rotated.
|
||||
*
|
||||
* After initialization, the offset will be (0,0).
|
||||
* @note This is the designated initializer.
|
||||
*
|
||||
* @param texture A Texture2D object whose texture will be applied to this sprite.
|
||||
* @param rect A rectangle assigned the contents of texture.
|
||||
* @param rotated Whether or not the texture rectangle is rotated.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect, bool rotated);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an SpriteFrame. The texture and rect in SpriteFrame will be applied on this sprite
|
||||
*
|
||||
* @param pSpriteFrame A SpriteFrame object. It should includes a valid texture and a rect
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithSpriteFrame(SpriteFrame *pSpriteFrame);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an sprite frame name.
|
||||
*
|
||||
* A SpriteFrame will be fetched from the SpriteFrameCache by name.
|
||||
* If the SpriteFrame doesn't exist it will raise an exception.
|
||||
*
|
||||
* @param spriteFrameName A key string that can fected a volid SpriteFrame from SpriteFrameCache
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
*/
|
||||
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an image filename.
|
||||
*
|
||||
* This method will find filename from local file system, load its content to Texture2D,
|
||||
* then use Texture2D to create a sprite.
|
||||
* After initialization, the rect used will be the size of the image. The offset will be (0,0).
|
||||
*
|
||||
* @param filename The path to an image file in local file system
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @js init
|
||||
* @lua init
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& filename);
|
||||
|
||||
/**
|
||||
* Initializes a sprite with an image filename, and a rect.
|
||||
*
|
||||
* This method will find filename from local file system, load its content to Texture2D,
|
||||
* then use Texture2D to create a sprite.
|
||||
* After initialization, the offset will be (0,0).
|
||||
*
|
||||
* @param filename The path to an image file in local file system.
|
||||
* @param rect The rectangle assigned the content area from texture.
|
||||
* @return true if the sprite is initialized properly, false otherwise.
|
||||
* @js init
|
||||
* @lua init
|
||||
*/
|
||||
virtual bool initWithFile(const std::string& filename, const Rect& rect);
|
||||
|
||||
void updateColor(void);
|
||||
virtual void setTextureCoords(Rect rect);
|
||||
virtual void updateBlendFunc(void);
|
||||
|
@ -575,8 +570,11 @@ protected:
|
|||
bool _opacityModifyRGB;
|
||||
|
||||
// image is flipped
|
||||
bool _flippedX; /// Whether the sprite is flipped horizontally or not
|
||||
bool _flippedY; /// Whether the sprite is flipped vertically or not
|
||||
bool _flippedX; /// Whether the sprite is flipped horizontally or not
|
||||
bool _flippedY; /// Whether the sprite is flipped vertically or not
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Sprite);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -294,9 +294,9 @@ Sprite* TMXLayer::reusedTileWithRect(Rect rect)
|
|||
{
|
||||
if (! _reusedTile)
|
||||
{
|
||||
_reusedTile = new Sprite();
|
||||
_reusedTile->initWithTexture(_textureAtlas->getTexture(), rect, false);
|
||||
_reusedTile = Sprite::createWithTexture(_textureAtlas->getTexture(), rect);
|
||||
_reusedTile->setBatchNode(this);
|
||||
_reusedTile->retain();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -335,8 +335,7 @@ Sprite * TMXLayer::getTileAt(const Point& pos)
|
|||
Rect rect = _tileSet->rectForGID(gid);
|
||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
||||
|
||||
tile = new Sprite();
|
||||
tile->initWithTexture(this->getTexture(), rect);
|
||||
tile = Sprite::createWithTexture(this->getTexture(), rect);
|
||||
tile->setBatchNode(this);
|
||||
tile->setPosition(getPositionAt(pos));
|
||||
tile->setVertexZ((float)getVertexZForPos(pos));
|
||||
|
@ -345,7 +344,6 @@ Sprite * TMXLayer::getTileAt(const Point& pos)
|
|||
|
||||
unsigned int indexForZ = atlasIndexForExistantZ(z);
|
||||
this->addSpriteWithoutQuad(tile, indexForZ, z);
|
||||
tile->release();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,28 +109,12 @@ object->getProperty(name_of_the_property);
|
|||
class CC_DLL TMXTiledMap : public Node
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TMXTiledMap();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TMXTiledMap();
|
||||
|
||||
/** creates a TMX Tiled Map with a TMX file.*/
|
||||
static TMXTiledMap* create(const std::string& tmxFile);
|
||||
|
||||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
||||
static TMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||
|
||||
/** initializes a TMX Tiled Map with a TMX file */
|
||||
bool initWithTMXFile(const std::string& tmxFile);
|
||||
|
||||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
||||
bool initWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||
|
||||
/** return the TMXLayer for the specific layer */
|
||||
TMXLayer* getLayer(const std::string& layerName) const;
|
||||
/**
|
||||
|
@ -187,11 +171,27 @@ public:
|
|||
_properties = properties;
|
||||
};
|
||||
|
||||
private:
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TMXTiledMap();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TMXTiledMap();
|
||||
|
||||
/** initializes a TMX Tiled Map with a TMX file */
|
||||
bool initWithTMXFile(const std::string& tmxFile);
|
||||
|
||||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
||||
bool initWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||
|
||||
TMXLayer * parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
TMXTilesetInfo * tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
void buildWithMapInfo(TMXMapInfo* mapInfo);
|
||||
protected:
|
||||
|
||||
/** the map's size property measured in tiles */
|
||||
Size _mapSize;
|
||||
/** the tiles's size property measured in pixels */
|
||||
|
@ -206,6 +206,9 @@ protected:
|
|||
//! tile properties
|
||||
Dictionary* _tileProperties;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TMXTiledMap);
|
||||
|
||||
};
|
||||
|
||||
// end of tilemap_parallax_nodes group
|
||||
|
|
|
@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <sstream>
|
||||
#include "CCTMXXMLParser.h"
|
||||
#include "CCTMXTiledMap.h"
|
||||
|
@ -38,11 +38,11 @@ using namespace std;
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
static const char* valueForKey(const char *key, std::map<std::string, std::string>* dict)
|
||||
static const char* valueForKey(const char *key, std::unordered_map<std::string, std::string>* dict)
|
||||
{
|
||||
if (dict)
|
||||
{
|
||||
std::map<std::string, std::string>::iterator it = dict->find(key);
|
||||
std::unordered_map<std::string, std::string>::iterator it = dict->find(key);
|
||||
return it!=dict->end() ? it->second.c_str() : "";
|
||||
}
|
||||
return "";
|
||||
|
@ -244,7 +244,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
CC_UNUSED_PARAM(ctx);
|
||||
TMXMapInfo *pTMXMapInfo = this;
|
||||
std::string elementName = (char*)name;
|
||||
std::map<std::string, std::string> *attributeDict = new std::map<std::string, std::string>();
|
||||
std::unordered_map<std::string, std::string> *attributeDict = new std::unordered_map<std::string, std::string>();
|
||||
if (atts && atts[0])
|
||||
{
|
||||
for(int i = 0; atts[i]; i += 2)
|
||||
|
|
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <map>
|
||||
|
||||
#include "CCObject.h"
|
||||
#include "CCGeometry.h"
|
||||
|
|
|
@ -36,7 +36,7 @@ NS_CC_BEGIN
|
|||
|
||||
// implementation TileMapAtlas
|
||||
|
||||
TileMapAtlas * TileMapAtlas::create(const char *tile, const char *mapFile, int tileWidth, int tileHeight)
|
||||
TileMapAtlas * TileMapAtlas::create(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight)
|
||||
{
|
||||
TileMapAtlas *pRet = new TileMapAtlas();
|
||||
if (pRet->initWithTileFile(tile, mapFile, tileWidth, tileHeight))
|
||||
|
@ -48,7 +48,7 @@ TileMapAtlas * TileMapAtlas::create(const char *tile, const char *mapFile, int t
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool TileMapAtlas::initWithTileFile(const char *tile, const char *mapFile, int tileWidth, int tileHeight)
|
||||
bool TileMapAtlas::initWithTileFile(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight)
|
||||
{
|
||||
this->loadTGAfile(mapFile);
|
||||
this->calculateItemsToRender();
|
||||
|
@ -111,10 +111,8 @@ void TileMapAtlas::calculateItemsToRender()
|
|||
}
|
||||
}
|
||||
|
||||
void TileMapAtlas::loadTGAfile(const char *file)
|
||||
void TileMapAtlas::loadTGAfile(const std::string& file)
|
||||
{
|
||||
CCASSERT( file != NULL, "file must be non-nil");
|
||||
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(file);
|
||||
|
||||
// //Find the path of the file
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
/** creates a TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
|
||||
The tile file will be loaded using the TextureMgr.
|
||||
*/
|
||||
static TileMapAtlas * create(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
|
||||
static TileMapAtlas * create(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
/** initializes a TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
|
||||
The file will be loaded using the TextureMgr.
|
||||
*/
|
||||
bool initWithTileFile(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
|
||||
bool initWithTileFile(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight);
|
||||
/** returns a tile from position x,y.
|
||||
For the moment only channel R is used
|
||||
*/
|
||||
|
@ -89,13 +89,14 @@ public:
|
|||
|
||||
inline struct sImageTGA* getTGAInfo() const { return _TGAInfo; };
|
||||
inline void setTGAInfo(struct sImageTGA* TGAInfo) { _TGAInfo = TGAInfo; };
|
||||
private:
|
||||
void loadTGAfile(const char *file);
|
||||
|
||||
protected:
|
||||
void loadTGAfile(const std::string& file);
|
||||
void calculateItemsToRender();
|
||||
void updateAtlasValueAt(const Point& pos, const Color3B& value, int index);
|
||||
void updateAtlasValues();
|
||||
|
||||
protected:
|
||||
|
||||
//! x,y to atlas dictionary
|
||||
Dictionary* _posToAtlasIndex;
|
||||
//! numbers of tiles to render
|
||||
|
|
|
@ -77,7 +77,6 @@ bool TransitionScene::initWithDuration(float t, Scene *scene)
|
|||
if (_outScene == NULL)
|
||||
{
|
||||
_outScene = Scene::create();
|
||||
_outScene->init();
|
||||
}
|
||||
_outScene->retain();
|
||||
|
||||
|
|
|
@ -79,18 +79,6 @@ public:
|
|||
|
||||
/** creates a base transition with duration and incoming scene */
|
||||
static TransitionScene * create(float t, Scene *scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionScene();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionScene();
|
||||
|
||||
/** initializes a transition with duration and incoming scene */
|
||||
bool initWithDuration(float t,Scene* scene);
|
||||
|
||||
/** called after the transition finishes */
|
||||
void finish(void);
|
||||
|
@ -102,30 +90,27 @@ public:
|
|||
// Overrides
|
||||
//
|
||||
virtual void draw() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onExit() override;
|
||||
virtual void cleanup() override;
|
||||
|
||||
protected:
|
||||
virtual void sceneOrder();
|
||||
TransitionScene();
|
||||
virtual ~TransitionScene();
|
||||
/** initializes a transition with duration and incoming scene */
|
||||
bool initWithDuration(float t,Scene* scene);
|
||||
|
||||
private:
|
||||
virtual void sceneOrder();
|
||||
void setNewScene(float dt);
|
||||
|
||||
protected:
|
||||
Scene * _inScene;
|
||||
Scene * _outScene;
|
||||
float _duration;
|
||||
bool _isInSceneOnTop;
|
||||
bool _isSendCleanupToScene;
|
||||
Scene *_inScene;
|
||||
Scene *_outScene;
|
||||
float _duration;
|
||||
bool _isInSceneOnTop;
|
||||
bool _isSendCleanupToScene;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionScene);
|
||||
};
|
||||
|
||||
/** @brief A Transition that supports orientation like.
|
||||
|
@ -136,21 +121,18 @@ class CC_DLL TransitionSceneOriented : public TransitionScene
|
|||
public:
|
||||
/** creates a base transition with duration and incoming scene */
|
||||
static TransitionSceneOriented * create(float t,Scene* scene, Orientation orientation);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionSceneOriented();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSceneOriented();
|
||||
|
||||
/** initializes a transition with duration and incoming scene */
|
||||
bool initWithDuration(float t,Scene* scene,Orientation orientation);
|
||||
|
||||
protected:
|
||||
Orientation _orientation;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSceneOriented);
|
||||
};
|
||||
|
||||
/** @brief TransitionRotoZoom:
|
||||
|
@ -161,21 +143,18 @@ class CC_DLL TransitionRotoZoom : public TransitionScene
|
|||
public:
|
||||
static TransitionRotoZoom* create(float t, Scene* scene);
|
||||
|
||||
TransitionRotoZoom();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionRotoZoom();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionRotoZoom();
|
||||
virtual ~TransitionRotoZoom();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionRotoZoom);
|
||||
|
||||
};
|
||||
|
||||
/** @brief TransitionJumpZoom:
|
||||
|
@ -185,24 +164,18 @@ class CC_DLL TransitionJumpZoom : public TransitionScene
|
|||
{
|
||||
public:
|
||||
static TransitionJumpZoom* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionJumpZoom();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionJumpZoom();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionJumpZoom();
|
||||
virtual ~TransitionJumpZoom();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionJumpZoom);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInL:
|
||||
|
@ -212,17 +185,7 @@ class CC_DLL TransitionMoveInL : public TransitionScene, public TransitionEaseSc
|
|||
{
|
||||
public:
|
||||
static TransitionMoveInL* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionMoveInL();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionMoveInL();
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
||||
/** returns the action that will be performed */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
|
@ -231,11 +194,17 @@ public:
|
|||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionMoveInL();
|
||||
virtual ~TransitionMoveInL();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInL);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInR:
|
||||
|
@ -245,16 +214,15 @@ class CC_DLL TransitionMoveInR : public TransitionMoveInL
|
|||
{
|
||||
public:
|
||||
static TransitionMoveInR* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionMoveInR();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionMoveInR();
|
||||
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInR);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInT:
|
||||
|
@ -264,16 +232,15 @@ class CC_DLL TransitionMoveInT : public TransitionMoveInL
|
|||
{
|
||||
public:
|
||||
static TransitionMoveInT* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionMoveInT();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionMoveInT();
|
||||
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInT);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInB:
|
||||
|
@ -283,16 +250,15 @@ class CC_DLL TransitionMoveInB : public TransitionMoveInL
|
|||
{
|
||||
public:
|
||||
static TransitionMoveInB* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionMoveInB();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionMoveInB();
|
||||
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInB);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInL:
|
||||
|
@ -302,34 +268,28 @@ class CC_DLL TransitionSlideInL : public TransitionScene, public TransitionEaseS
|
|||
{
|
||||
public:
|
||||
static TransitionSlideInL* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSlideInL();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSlideInL();
|
||||
|
||||
virtual ActionInterval* easeActionWithAction(ActionInterval * action);
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
|
||||
protected:
|
||||
TransitionSlideInL();
|
||||
virtual ~TransitionSlideInL();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInL);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInR:
|
||||
|
@ -339,23 +299,21 @@ class CC_DLL TransitionSlideInR : public TransitionSlideInL
|
|||
{
|
||||
public:
|
||||
static TransitionSlideInR* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSlideInR();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSlideInR();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
protected:
|
||||
TransitionSlideInR();
|
||||
virtual ~TransitionSlideInR();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInR);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInB:
|
||||
|
@ -365,23 +323,21 @@ class CC_DLL TransitionSlideInB : public TransitionSlideInL
|
|||
{
|
||||
public:
|
||||
static TransitionSlideInB* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSlideInB();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSlideInB();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
protected:
|
||||
TransitionSlideInB();
|
||||
virtual ~TransitionSlideInB();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes();
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInB);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInT:
|
||||
|
@ -391,23 +347,21 @@ class CC_DLL TransitionSlideInT : public TransitionSlideInL
|
|||
{
|
||||
public:
|
||||
static TransitionSlideInT* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSlideInT();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSlideInT();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
protected:
|
||||
TransitionSlideInT();
|
||||
virtual ~TransitionSlideInT();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInT);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -417,21 +371,23 @@ class CC_DLL TransitionShrinkGrow : public TransitionScene , public TransitionEa
|
|||
{
|
||||
public:
|
||||
static TransitionShrinkGrow* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionShrinkGrow();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionShrinkGrow();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionShrinkGrow();
|
||||
virtual ~TransitionShrinkGrow();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionShrinkGrow);
|
||||
};
|
||||
|
||||
/** @brief TransitionFlipX:
|
||||
|
@ -443,15 +399,6 @@ class CC_DLL TransitionFlipX : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionFlipX* create(float t, Scene* s, Orientation o);
|
||||
static TransitionFlipX* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFlipX();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFlipX();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -461,6 +408,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionFlipX();
|
||||
virtual ~TransitionFlipX();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipX);
|
||||
};
|
||||
|
||||
/** @brief TransitionFlipY:
|
||||
|
@ -472,15 +426,6 @@ class CC_DLL TransitionFlipY : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionFlipY* create(float t, Scene* s, Orientation o);
|
||||
static TransitionFlipY* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFlipY();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFlipY();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -490,6 +435,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionFlipY();
|
||||
virtual ~TransitionFlipY();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipY);
|
||||
};
|
||||
|
||||
/** @brief TransitionFlipAngular:
|
||||
|
@ -501,15 +453,6 @@ class CC_DLL TransitionFlipAngular : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionFlipAngular* create(float t, Scene* s, Orientation o);
|
||||
static TransitionFlipAngular* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFlipAngular();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFlipAngular();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -519,6 +462,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionFlipAngular();
|
||||
virtual ~TransitionFlipAngular();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipAngular);
|
||||
};
|
||||
|
||||
/** @brief TransitionZoomFlipX:
|
||||
|
@ -530,15 +480,6 @@ class CC_DLL TransitionZoomFlipX : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionZoomFlipX* create(float t, Scene* s, Orientation o);
|
||||
static TransitionZoomFlipX* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionZoomFlipX();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionZoomFlipX();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -548,6 +489,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionZoomFlipX();
|
||||
virtual ~TransitionZoomFlipX();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipX);
|
||||
};
|
||||
|
||||
/** @brief TransitionZoomFlipY:
|
||||
|
@ -559,15 +507,6 @@ class CC_DLL TransitionZoomFlipY : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionZoomFlipY* create(float t, Scene* s, Orientation o);
|
||||
static TransitionZoomFlipY* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionZoomFlipY();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionZoomFlipY();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -577,6 +516,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionZoomFlipY();
|
||||
virtual ~TransitionZoomFlipY();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipY);
|
||||
};
|
||||
|
||||
/** @brief TransitionZoomFlipAngular:
|
||||
|
@ -588,15 +534,6 @@ class CC_DLL TransitionZoomFlipAngular : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionZoomFlipAngular* create(float t, Scene* s, Orientation o);
|
||||
static TransitionZoomFlipAngular* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionZoomFlipAngular();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionZoomFlipAngular();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -606,6 +543,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionZoomFlipAngular();
|
||||
virtual ~TransitionZoomFlipAngular();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipAngular);
|
||||
};
|
||||
|
||||
/** @brief TransitionFade:
|
||||
|
@ -617,25 +561,9 @@ public:
|
|||
/** creates the transition with a duration and with an RGB color
|
||||
* Example: FadeTransition::create(2, scene, Color3B(255,0,0); // red color
|
||||
*/
|
||||
static TransitionFade* create(float duration,Scene* scene, const Color3B& color);
|
||||
static TransitionFade* create(float duration,Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFade();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFade();
|
||||
static TransitionFade* create(float duration, Scene* scene, const Color3B& color);
|
||||
static TransitionFade* create(float duration, Scene* scene);
|
||||
|
||||
/** initializes the transition with a duration and with an RGB color */
|
||||
bool initWithDuration(float t, Scene*scene ,const Color3B& color);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
bool initWithDuration(float t,Scene* scene);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
@ -648,7 +576,18 @@ public:
|
|||
virtual void onExit();
|
||||
|
||||
protected:
|
||||
Color4B _color;
|
||||
TransitionFade();
|
||||
virtual ~TransitionFade();
|
||||
|
||||
/** initializes the transition with a duration and with an RGB color */
|
||||
bool initWithDuration(float t, Scene*scene, const Color3B& color);
|
||||
bool initWithDuration(float t, Scene* scene);
|
||||
|
||||
Color4B _color;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFade);
|
||||
|
||||
};
|
||||
|
||||
class RenderTexture;
|
||||
|
@ -660,19 +599,14 @@ class CC_DLL TransitionCrossFade : public TransitionScene
|
|||
{
|
||||
public :
|
||||
static TransitionCrossFade* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionCrossFade();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionCrossFade();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void draw() override;
|
||||
/**
|
||||
* @js NA
|
||||
|
@ -685,6 +619,12 @@ public :
|
|||
*/
|
||||
virtual void onExit() override;
|
||||
|
||||
protected:
|
||||
TransitionCrossFade();
|
||||
virtual ~TransitionCrossFade();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionCrossFade);
|
||||
};
|
||||
|
||||
/** @brief TransitionTurnOffTiles:
|
||||
|
@ -694,15 +634,6 @@ class CC_DLL TransitionTurnOffTiles : public TransitionScene ,public TransitionE
|
|||
{
|
||||
public :
|
||||
static TransitionTurnOffTiles* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionTurnOffTiles();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionTurnOffTiles();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -715,7 +646,13 @@ public :
|
|||
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionTurnOffTiles();
|
||||
virtual ~TransitionTurnOffTiles();
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionTurnOffTiles);
|
||||
};
|
||||
|
||||
/** @brief TransitionSplitCols:
|
||||
|
@ -725,17 +662,8 @@ class CC_DLL TransitionSplitCols : public TransitionScene , public TransitionEas
|
|||
{
|
||||
public:
|
||||
static TransitionSplitCols* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSplitCols();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSplitCols();
|
||||
|
||||
virtual ActionInterval* action(void);
|
||||
virtual ActionInterval* action();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -746,6 +674,13 @@ public:
|
|||
*/
|
||||
virtual void onEnter() override;
|
||||
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionSplitCols();
|
||||
virtual ~TransitionSplitCols();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSplitCols);
|
||||
};
|
||||
|
||||
/** @brief TransitionSplitRows:
|
||||
|
@ -755,20 +690,18 @@ class CC_DLL TransitionSplitRows : public TransitionSplitCols
|
|||
{
|
||||
public:
|
||||
static TransitionSplitRows* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSplitRows();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSplitRows();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* action(void) override;
|
||||
|
||||
protected:
|
||||
TransitionSplitRows();
|
||||
virtual ~TransitionSplitRows();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSplitRows);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeTR:
|
||||
|
@ -778,15 +711,7 @@ class CC_DLL TransitionFadeTR : public TransitionScene , public TransitionEaseSc
|
|||
{
|
||||
public:
|
||||
static TransitionFadeTR* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeTR();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeTR();
|
||||
|
||||
virtual ActionInterval* actionWithSize(const Size& size);
|
||||
|
||||
//
|
||||
|
@ -800,7 +725,13 @@ public:
|
|||
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeTR();
|
||||
virtual ~TransitionFadeTR();
|
||||
|
||||
virtual void sceneOrder();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeTR);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeBL:
|
||||
|
@ -810,21 +741,18 @@ class CC_DLL TransitionFadeBL : public TransitionFadeTR
|
|||
{
|
||||
public:
|
||||
static TransitionFadeBL* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeBL();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeBL();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeBL();
|
||||
virtual ~TransitionFadeBL();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeBL);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeUp:
|
||||
|
@ -834,20 +762,18 @@ class CC_DLL TransitionFadeUp : public TransitionFadeTR
|
|||
{
|
||||
public:
|
||||
static TransitionFadeUp* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeUp();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeUp();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeUp();
|
||||
virtual ~TransitionFadeUp();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeUp);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeDown:
|
||||
|
@ -857,20 +783,19 @@ class CC_DLL TransitionFadeDown : public TransitionFadeTR
|
|||
{
|
||||
public:
|
||||
static TransitionFadeDown* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeDown();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeDown();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeDown();
|
||||
virtual ~TransitionFadeDown();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeDown);
|
||||
|
||||
};
|
||||
|
||||
// end of transition group
|
||||
|
|
|
@ -511,7 +511,7 @@ public:
|
|||
unzFile zipFile;
|
||||
|
||||
// std::unordered_map is faster if available on the platform
|
||||
typedef std::map<std::string, struct ZipEntryInfo> FileListContainer;
|
||||
typedef std::unordered_map<std::string, struct ZipEntryInfo> FileListContainer;
|
||||
FileListContainer fileList;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ NS_CC_BEGIN
|
|||
|
||||
const char* cocos2dVersion()
|
||||
{
|
||||
return "3.0-alpha1";
|
||||
return "3.0-beta0-pre";
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
#define __CCDEVICE_H__
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL Device
|
||||
{
|
||||
private:
|
||||
Device();
|
||||
public:
|
||||
/**
|
||||
* Gets the DPI of device
|
||||
|
@ -24,6 +23,9 @@ public:
|
|||
* Sets the interval of accelerometer.
|
||||
*/
|
||||
static void setAccelerometerInterval(float interval);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_IMPLICIT_CONSTRUCTORS(Device);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ bool EGLViewProtocol::isScissorEnabled()
|
|||
return (GL_FALSE == glIsEnabled(GL_SCISSOR_TEST)) ? false : true;
|
||||
}
|
||||
|
||||
Rect EGLViewProtocol::getScissorRect()
|
||||
Rect EGLViewProtocol::getScissorRect() const
|
||||
{
|
||||
GLfloat params[4];
|
||||
glGetFloatv(GL_SCISSOR_BOX, params);
|
||||
|
@ -188,15 +188,12 @@ Rect EGLViewProtocol::getScissorRect()
|
|||
return Rect(x, y, w, h);
|
||||
}
|
||||
|
||||
void EGLViewProtocol::setViewName(const char* pszViewName)
|
||||
void EGLViewProtocol::setViewName(const std::string& viewname )
|
||||
{
|
||||
if (pszViewName != NULL && strlen(pszViewName) > 0)
|
||||
{
|
||||
strncpy(_viewName, pszViewName, sizeof(_viewName));
|
||||
}
|
||||
_viewName = viewname;
|
||||
}
|
||||
|
||||
const char* EGLViewProtocol::getViewName()
|
||||
const std::string& EGLViewProtocol::getViewName() const
|
||||
{
|
||||
return _viewName;
|
||||
}
|
||||
|
|
|
@ -129,11 +129,10 @@ public:
|
|||
/**
|
||||
* Get the current scissor rectangle
|
||||
*/
|
||||
virtual Rect getScissorRect();
|
||||
virtual Rect getScissorRect() const;
|
||||
|
||||
virtual void setViewName(const char* pszViewName);
|
||||
|
||||
const char* getViewName();
|
||||
virtual void setViewName(const std::string& viewname);
|
||||
const std::string& getViewName() const;
|
||||
|
||||
/** Touch events are handled by default; if you want to customize your handlers, please override these functions: */
|
||||
virtual void handleTouchesBegin(int num, long ids[], float xs[], float ys[]);
|
||||
|
@ -155,10 +154,11 @@ public:
|
|||
* Get scale factor of the vertical direction.
|
||||
*/
|
||||
float getScaleY() const;
|
||||
private:
|
||||
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, long ids[], float xs[], float ys[]);
|
||||
|
||||
|
||||
protected:
|
||||
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, long ids[], float xs[], float ys[]);
|
||||
|
||||
EGLTouchDelegate* _delegate;
|
||||
|
||||
// real screen size
|
||||
|
@ -168,7 +168,7 @@ protected:
|
|||
// the view port size
|
||||
Rect _viewPortRect;
|
||||
// the view name
|
||||
char _viewName[50];
|
||||
std::string _viewName;
|
||||
|
||||
float _scaleX;
|
||||
float _scaleY;
|
||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "ccTypes.h"
|
||||
|
||||
|
@ -399,7 +399,7 @@ protected:
|
|||
* The full path cache. When a file is found, it will be added into this cache.
|
||||
* This variable is used for improving the performance of file search.
|
||||
*/
|
||||
std::map<std::string, std::string> _fullPathCache;
|
||||
std::unordered_map<std::string, std::string> _fullPathCache;
|
||||
|
||||
/**
|
||||
* The singleton pointer of FileUtils.
|
||||
|
|
|
@ -193,7 +193,7 @@ public:
|
|||
@param filePath the file's absolute path, including file suffix.
|
||||
@param isToRGB whether the image is saved as RGB format.
|
||||
*/
|
||||
bool saveToFile(const char *filePath, bool isToRGB = true);
|
||||
bool saveToFile(const std::string &filename, bool isToRGB = true);
|
||||
|
||||
protected:
|
||||
bool initWithJpgData(const unsigned char * data, int dataLen);
|
||||
|
@ -207,8 +207,8 @@ protected:
|
|||
bool initWithS3TCData(const unsigned char * data, int dataLen);
|
||||
bool initWithATITCData(const unsigned char *data, int dataLen);
|
||||
|
||||
bool saveImageToPNG(const char *filePath, bool isToRGB = true);
|
||||
bool saveImageToJPG(const char *filePath);
|
||||
bool saveImageToPNG(const std::string& filePath, bool isToRGB = true);
|
||||
bool saveImageToJPG(const std::string& filePath);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -1784,7 +1784,7 @@ bool Image::initWithRawData(const unsigned char * data, long dataLen, long width
|
|||
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
||||
bool Image::saveToFile(const std::string& filename, bool bIsToRGB)
|
||||
{
|
||||
//only support for Texture2D::PixelFormat::RGB888 or Texture2D::PixelFormat::RGBA8888 uncompressed data
|
||||
if (isCompressed() || (_renderFormat != Texture2D::PixelFormat::RGB888 && _renderFormat != Texture2D::PixelFormat::RGBA8888))
|
||||
|
@ -1797,24 +1797,22 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
|||
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(NULL == pszFilePath);
|
||||
|
||||
std::string strFilePath(pszFilePath);
|
||||
CC_BREAK_IF(strFilePath.size() <= 4);
|
||||
CC_BREAK_IF(filename.size() <= 4);
|
||||
|
||||
std::string strLowerCasePath(strFilePath);
|
||||
std::string strLowerCasePath(filename);
|
||||
for (unsigned int i = 0; i < strLowerCasePath.length(); ++i)
|
||||
{
|
||||
strLowerCasePath[i] = tolower(strFilePath[i]);
|
||||
strLowerCasePath[i] = tolower(filename[i]);
|
||||
}
|
||||
|
||||
if (std::string::npos != strLowerCasePath.find(".png"))
|
||||
{
|
||||
CC_BREAK_IF(!saveImageToPNG(pszFilePath, bIsToRGB));
|
||||
CC_BREAK_IF(!saveImageToPNG(filename, bIsToRGB));
|
||||
}
|
||||
else if (std::string::npos != strLowerCasePath.find(".jpg"))
|
||||
{
|
||||
CC_BREAK_IF(!saveImageToJPG(pszFilePath));
|
||||
CC_BREAK_IF(!saveImageToJPG(filename));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1828,20 +1826,18 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
|||
}
|
||||
#endif
|
||||
|
||||
bool Image::saveImageToPNG(const char * filePath, bool isToRGB)
|
||||
bool Image::saveImageToPNG(const std::string& filePath, bool isToRGB)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(NULL == filePath);
|
||||
|
||||
FILE *fp;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_colorp palette;
|
||||
png_bytep *row_pointers;
|
||||
|
||||
fp = fopen(filePath, "wb");
|
||||
fp = fopen(filePath.c_str(), "wb");
|
||||
CC_BREAK_IF(NULL == fp);
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
|
@ -1968,13 +1964,11 @@ bool Image::saveImageToPNG(const char * filePath, bool isToRGB)
|
|||
} while (0);
|
||||
return bRet;
|
||||
}
|
||||
bool Image::saveImageToJPG(const char * filePath)
|
||||
bool Image::saveImageToJPG(const std::string& filePath)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(NULL == filePath);
|
||||
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
FILE * outfile; /* target file */
|
||||
|
@ -1985,7 +1979,7 @@ bool Image::saveImageToJPG(const char * filePath)
|
|||
/* Now we can initialize the JPEG compression object. */
|
||||
jpeg_create_compress(&cinfo);
|
||||
|
||||
CC_BREAK_IF((outfile = fopen(filePath, "wb")) == NULL);
|
||||
CC_BREAK_IF((outfile = fopen(filePath.c_str(), "wb")) == NULL);
|
||||
|
||||
jpeg_stdio_dest(&cinfo, outfile);
|
||||
|
||||
|
|
|
@ -380,12 +380,12 @@ bool Image::initWithStringShadowStroke(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
||||
bool Image::saveToFile(const std::string& filename, bool bIsToRGB)
|
||||
{
|
||||
bool saveToPNG = false;
|
||||
bool needToCopyPixels = false;
|
||||
std::string filePath(pszFilePath);
|
||||
if (std::string::npos != filePath.find(".png"))
|
||||
|
||||
if (std::string::npos != filename.find(".png"))
|
||||
{
|
||||
saveToPNG = true;
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
|||
data = UIImageJPEGRepresentation(image, 1.0f);
|
||||
}
|
||||
|
||||
[data writeToFile:[NSString stringWithUTF8String:pszFilePath] atomically:YES];
|
||||
[data writeToFile:[NSString stringWithUTF8String:filename.c_str()] atomically:YES];
|
||||
|
||||
[image release];
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ EGLView::EGLView()
|
|||
{
|
||||
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
||||
s_pEglView = this;
|
||||
strcpy(_viewName, "Cocos2dxWin32");
|
||||
_viewName = "Cocos2dxWin32";
|
||||
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
||||
glfwInit();
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ bool EGLView::init(const char* viewName, float width, float height, float frameZ
|
|||
setFrameZoomFactor(frameZoomFactor);
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr);
|
||||
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName.c_str(), nullptr, nullptr);
|
||||
glfwMakeContextCurrent(_mainWindow);
|
||||
|
||||
glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]);
|
||||
|
|
|
@ -21,7 +21,11 @@
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCEGLView.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "EAGLView.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCSet.h"
|
||||
|
@ -34,7 +38,7 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
|
||||
static std::map<int, EventKeyboard::KeyCode> g_keyCodeMap = {
|
||||
static std::unordered_map<int, EventKeyboard::KeyCode> g_keyCodeMap = {
|
||||
/* The unknown key */
|
||||
{ GLFW_KEY_UNKNOWN , EventKeyboard::KeyCode::KEY_NONE },
|
||||
|
||||
|
@ -308,8 +312,8 @@ EGLView::EGLView()
|
|||
, _mainWindow(nullptr)
|
||||
{
|
||||
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
||||
_viewName = "cocos2dx";
|
||||
s_pEglView = this;
|
||||
strcpy(_viewName, "Cocos2dxWin32");
|
||||
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
||||
glfwInit();
|
||||
}
|
||||
|
@ -330,7 +334,7 @@ bool EGLView::init(const char *viewName, float width, float height, float frameZ
|
|||
setFrameZoomFactor(frameZoomFactor);
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr);
|
||||
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName.c_str(), nullptr, nullptr);
|
||||
glfwMakeContextCurrent(_mainWindow);
|
||||
|
||||
glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]);
|
||||
|
|
|
@ -234,19 +234,29 @@ public: virtual void set##funName(varType var) \
|
|||
#define LUALOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
|
||||
#endif // Lua engine debug
|
||||
|
||||
// A macro to disallow the copy constructor and operator= functions
|
||||
// This should be used in the private: declarations for a class
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \
|
||||
|| (defined(__clang__) && (__clang_major__ >= 3))
|
||||
#define CC_DISABLE_COPY(Class) \
|
||||
private: \
|
||||
Class(const Class &) = delete; \
|
||||
Class &operator =(const Class &) = delete;
|
||||
|| (defined(__clang__) && (__clang_major__ >= 3))
|
||||
#define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
TypeName(const TypeName &) = delete; \
|
||||
TypeName &operator =(const TypeName &) = delete;
|
||||
#else
|
||||
#define CC_DISABLE_COPY(Class) \
|
||||
private: \
|
||||
Class(const Class &); \
|
||||
Class &operator =(const Class &);
|
||||
#define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
Class(const TypeName &); \
|
||||
Class &operator =(const TypeName &);
|
||||
#endif
|
||||
|
||||
// A macro to disallow all the implicit constructors, namely the
|
||||
// default constructor, copy constructor and operator= functions.
|
||||
//
|
||||
// This should be used in the private: declarations for a class
|
||||
// that wants to prevent anyone from instantiating it. This is
|
||||
// especially useful for classes containing only static methods.
|
||||
#define CC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
|
||||
TypeName(); \
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
|
||||
/*
|
||||
* only certain compilers support __attribute__((deprecated))
|
||||
*/
|
||||
|
|
|
@ -193,7 +193,7 @@ void ActionObject::simulationActionUpdate(float dt)
|
|||
|
||||
for ( int i = 0; i < nodeNum; i++ )
|
||||
{
|
||||
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
|
||||
ActionNode* actionNode = static_cast<ActionNode*>(_actionNodeList->getObjectAtIndex(i));
|
||||
|
||||
if (actionNode->isActionDoneOnce() == false)
|
||||
{
|
||||
|
|
|
@ -193,10 +193,10 @@ void UIButton::loadTextureNormal(const char* normal,TextureResType texType)
|
|||
switch (_normalTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->initWithFile(normal);
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->setTexture(normal);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->initWithSpriteFrameName(normal);
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->setSpriteFrame(normal);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -239,10 +239,10 @@ void UIButton::loadTexturePressed(const char* selected,TextureResType texType)
|
|||
switch (_pressedTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->initWithFile(selected);
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->setTexture(selected);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->initWithSpriteFrameName(selected);
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->setSpriteFrame(selected);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -285,10 +285,10 @@ void UIButton::loadTextureDisabled(const char* disabled,TextureResType texType)
|
|||
switch (_disabledTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->initWithFile(disabled);
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->setTexture(disabled);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->initWithSpriteFrameName(disabled);
|
||||
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->setSpriteFrame(disabled);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -112,10 +112,10 @@ void UICheckBox::loadTextureBackGround(const char *backGround,TextureResType tex
|
|||
switch (_backGroundTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_backGroundBoxRenderer->initWithFile(backGround);
|
||||
_backGroundBoxRenderer->setTexture(backGround);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_backGroundBoxRenderer->initWithSpriteFrameName(backGround);
|
||||
_backGroundBoxRenderer->setSpriteFrame(backGround);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -136,10 +136,10 @@ void UICheckBox::loadTextureBackGroundSelected(const char *backGroundSelected,Te
|
|||
switch (_backGroundSelectedTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_backGroundSelectedBoxRenderer->initWithFile(backGroundSelected);
|
||||
_backGroundSelectedBoxRenderer->setTexture(backGroundSelected);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_backGroundSelectedBoxRenderer->initWithSpriteFrameName(backGroundSelected);
|
||||
_backGroundSelectedBoxRenderer->setSpriteFrame(backGroundSelected);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -160,10 +160,10 @@ void UICheckBox::loadTextureFrontCross(const char *cross,TextureResType texType)
|
|||
switch (_frontCrossTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_frontCrossRenderer->initWithFile(cross);
|
||||
_frontCrossRenderer->setTexture(cross);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_frontCrossRenderer->initWithSpriteFrameName(cross);
|
||||
_frontCrossRenderer->setSpriteFrame(cross);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -184,10 +184,10 @@ void UICheckBox::loadTextureBackGroundDisabled(const char *backGroundDisabled,Te
|
|||
switch (_backGroundDisabledTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_backGroundBoxDisabledRenderer->initWithFile(backGroundDisabled);
|
||||
_backGroundBoxDisabledRenderer->setTexture(backGroundDisabled);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_backGroundBoxDisabledRenderer->initWithSpriteFrameName(backGroundDisabled);
|
||||
_backGroundBoxDisabledRenderer->setSpriteFrame(backGroundDisabled);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -208,10 +208,10 @@ void UICheckBox::loadTextureFrontCrossDisabled(const char *frontCrossDisabled,Te
|
|||
switch (_frontCrossDisabledTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_frontCrossDisabledRenderer->initWithFile(frontCrossDisabled);
|
||||
_frontCrossDisabledRenderer->setTexture(frontCrossDisabled);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_frontCrossDisabledRenderer->initWithSpriteFrameName(frontCrossDisabled);
|
||||
_frontCrossDisabledRenderer->setSpriteFrame(frontCrossDisabled);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -92,7 +92,7 @@ void UIImageView::loadTexture(const char *fileName, TextureResType texType)
|
|||
}
|
||||
else
|
||||
{
|
||||
DYNAMIC_CAST_CCSPRITE->initWithFile(fileName);
|
||||
DYNAMIC_CAST_CCSPRITE->setTexture(fileName);
|
||||
DYNAMIC_CAST_CCSPRITE->setColor(getColor());
|
||||
DYNAMIC_CAST_CCSPRITE->setOpacity(getOpacity());
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ void UIImageView::loadTexture(const char *fileName, TextureResType texType)
|
|||
}
|
||||
else
|
||||
{
|
||||
DYNAMIC_CAST_CCSPRITE->initWithSpriteFrameName(fileName);
|
||||
DYNAMIC_CAST_CCSPRITE->setSpriteFrame(fileName);
|
||||
DYNAMIC_CAST_CCSPRITE->setColor(getColor());
|
||||
DYNAMIC_CAST_CCSPRITE->setOpacity(getOpacity());
|
||||
}
|
||||
|
|
|
@ -214,10 +214,10 @@ void UILayout::setBackGroundImage(const char* fileName,TextureResType texType)
|
|||
switch (_bgImageTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->initWithFile(fileName);
|
||||
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->setTexture(fileName);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->initWithSpriteFrameName(fileName);
|
||||
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->setSpriteFrame(fileName);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -121,7 +121,7 @@ void UILoadingBar::loadTexture(const char* texture,TextureResType texType)
|
|||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithFile(texture);
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setTexture(texture);
|
||||
}
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
|
@ -132,7 +132,7 @@ void UILoadingBar::loadTexture(const char* texture,TextureResType texType)
|
|||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithSpriteFrameName(texture);
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setSpriteFrame(texture);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -111,7 +111,7 @@ void UISlider::loadBarTexture(const char* fileName, TextureResType texType)
|
|||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithFile(fileName);
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setTexture(fileName);
|
||||
}
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
|
@ -121,7 +121,7 @@ void UISlider::loadBarTexture(const char* fileName, TextureResType texType)
|
|||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithSpriteFrameName(fileName);
|
||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setSpriteFrame(fileName);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -157,7 +157,7 @@ void UISlider::loadProgressBarTexture(const char *fileName, TextureResType texTy
|
|||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->initWithFile(fileName);
|
||||
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->setTexture(fileName);
|
||||
}
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
|
@ -167,7 +167,7 @@ void UISlider::loadProgressBarTexture(const char *fileName, TextureResType texTy
|
|||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->initWithSpriteFrameName(fileName);
|
||||
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->setSpriteFrame(fileName);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -281,10 +281,10 @@ void UISlider::loadSlidBallTextureNormal(const char* normal,TextureResType texTy
|
|||
switch (_ballNTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_slidBallNormalRenderer->initWithFile(normal);
|
||||
_slidBallNormalRenderer->setTexture(normal);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_slidBallNormalRenderer->initWithSpriteFrameName(normal);
|
||||
_slidBallNormalRenderer->setSpriteFrame(normal);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -304,10 +304,10 @@ void UISlider::loadSlidBallTexturePressed(const char* pressed,TextureResType tex
|
|||
switch (_ballPTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_slidBallPressedRenderer->initWithFile(pressed);
|
||||
_slidBallPressedRenderer->setTexture(pressed);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_slidBallPressedRenderer->initWithSpriteFrameName(pressed);
|
||||
_slidBallPressedRenderer->setSpriteFrame(pressed);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -327,10 +327,10 @@ void UISlider::loadSlidBallTextureDisabled(const char* disabled,TextureResType t
|
|||
switch (_ballDTexType)
|
||||
{
|
||||
case UI_TEX_TYPE_LOCAL:
|
||||
_slidBallDisabledRenderer->initWithFile(disabled);
|
||||
_slidBallDisabledRenderer->setTexture(disabled);
|
||||
break;
|
||||
case UI_TEX_TYPE_PLIST:
|
||||
_slidBallDisabledRenderer->initWithSpriteFrameName(disabled);
|
||||
_slidBallDisabledRenderer->setSpriteFrame(disabled);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -116,7 +116,7 @@ private:
|
|||
//c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind)
|
||||
typedef std::function<void(SIOClient*, const std::string&)> SIOEvent;
|
||||
//c++11 map to callbacks
|
||||
typedef std::map<std::string, SIOEvent> EventRegistry;
|
||||
typedef std::unordered_map<std::string, SIOEvent> EventRegistry;
|
||||
|
||||
/**
|
||||
* @brief A single connection to a socket.io endpoint
|
||||
|
|
|
@ -23,11 +23,14 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCPhysicsJointInfo_chipmunk.h"
|
||||
|
||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
std::map<cpConstraint*, PhysicsJointInfo*> PhysicsJointInfo::_map;
|
||||
std::unordered_map<cpConstraint*, PhysicsJointInfo*> PhysicsJointInfo::_map;
|
||||
|
||||
PhysicsJointInfo::PhysicsJointInfo(PhysicsJoint* joint)
|
||||
: _joint(joint)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "chipmunk.h"
|
||||
#include "CCPlatformMacros.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
NS_CC_BEGIN
|
||||
|
||||
class PhysicsJoint;
|
||||
|
@ -45,16 +45,15 @@ public:
|
|||
|
||||
PhysicsJoint* getJoint() const { return _joint; }
|
||||
std::vector<cpConstraint*>& getJoints() { return _joints; }
|
||||
static std::map<cpConstraint*, PhysicsJointInfo*>& getMap() { return _map; }
|
||||
static std::unordered_map<cpConstraint*, PhysicsJointInfo*>& getMap() { return _map; }
|
||||
|
||||
private:
|
||||
protected:
|
||||
PhysicsJointInfo(PhysicsJoint* joint);
|
||||
~PhysicsJointInfo();
|
||||
|
||||
private:
|
||||
std::vector<cpConstraint*> _joints;
|
||||
PhysicsJoint* _joint;
|
||||
static std::map<cpConstraint*, PhysicsJointInfo*> _map;
|
||||
static std::unordered_map<cpConstraint*, PhysicsJointInfo*> _map;
|
||||
|
||||
friend class PhysicsJoint;
|
||||
};
|
||||
|
|
|
@ -23,11 +23,14 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCPhysicsShapeInfo_chipmunk.h"
|
||||
|
||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
std::map<cpShape*, PhysicsShapeInfo*> PhysicsShapeInfo::_map;
|
||||
std::unordered_map<cpShape*, PhysicsShapeInfo*> PhysicsShapeInfo::_map;
|
||||
cpBody* PhysicsShapeInfo::_sharedBody = nullptr;
|
||||
|
||||
PhysicsShapeInfo::PhysicsShapeInfo(PhysicsShape* shape)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include "chipmunk.h"
|
||||
#include "CCPlatformMacros.h"
|
||||
|
||||
|
@ -45,25 +45,23 @@ public:
|
|||
void removeAll();
|
||||
void setGroup(cpGroup group);
|
||||
void setBody(cpBody* body);
|
||||
|
||||
public:
|
||||
|
||||
PhysicsShape* getShape() const { return _shape; }
|
||||
std::vector<cpShape*>& getShapes() { return _shapes; }
|
||||
cpBody* getBody() const { return _body; }
|
||||
cpGroup getGourp() const { return _group; }
|
||||
static std::map<cpShape*, PhysicsShapeInfo*>& getMap() { return _map; }
|
||||
static std::unordered_map<cpShape*, PhysicsShapeInfo*>& getMap() { return _map; }
|
||||
static cpBody* getSharedBody() { return _sharedBody; }
|
||||
|
||||
private:
|
||||
protected:
|
||||
PhysicsShapeInfo(PhysicsShape* shape);
|
||||
~PhysicsShapeInfo();
|
||||
|
||||
private:
|
||||
std::vector<cpShape*> _shapes;
|
||||
PhysicsShape* _shape;
|
||||
cpBody* _body;
|
||||
cpGroup _group;
|
||||
static std::map<cpShape*, PhysicsShapeInfo*> _map;
|
||||
static std::unordered_map<cpShape*, PhysicsShapeInfo*> _map;
|
||||
static cpBody* _sharedBody;
|
||||
|
||||
friend class PhysicsShape;
|
||||
|
|
|
@ -74,11 +74,11 @@ static char *_js_log_buf = NULL;
|
|||
static std::vector<sc_register_sth> registrationList;
|
||||
|
||||
// name ~> JSScript map
|
||||
static std::map<std::string, JSScript*> filename_script;
|
||||
static std::unordered_map<std::string, JSScript*> filename_script;
|
||||
// port ~> socket map
|
||||
static std::map<int,int> ports_sockets;
|
||||
static std::unordered_map<int,int> ports_sockets;
|
||||
// name ~> globals
|
||||
static std::map<std::string, js::RootedObject*> globals;
|
||||
static std::unordered_map<std::string, js::RootedObject*> globals;
|
||||
|
||||
static void ReportException(JSContext *cx)
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
1cd78fedc4d2dc2609f92a179cd60ac4ce33ca08
|
||||
d725d2de77c275c86fc8739e13fdf31684cacf74
|
|
@ -191,7 +191,7 @@ public:
|
|||
|
||||
private:
|
||||
JSObject* _obj;
|
||||
typedef std::map<JSObject*, JSTouchDelegate*> TouchDelegateMap;
|
||||
typedef std::unordered_map<JSObject*, JSTouchDelegate*> TouchDelegateMap;
|
||||
typedef std::pair<JSObject*, JSTouchDelegate*> TouchDelegatePair;
|
||||
static TouchDelegateMap sTouchDelegateMap;
|
||||
bool _needUnroot;
|
||||
|
|
|
@ -105,8 +105,8 @@ private:
|
|||
network::HttpRequest* _httpRequest;
|
||||
bool _isNetwork;
|
||||
bool _withCredentialsValue;
|
||||
std::map<std::string, std::string> _httpHeader;
|
||||
std::map<std::string, std::string> _requestHeader;
|
||||
std::unordered_map<std::string, std::string> _httpHeader;
|
||||
std::unordered_map<std::string, std::string> _requestHeader;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1 +1 @@
|
|||
86fa141032de3d513df690fc82b20d2f2b4ab01b
|
||||
270dc280a6f338f52b0147dc00421c5478941304
|
|
@ -89,18 +89,9 @@ public:
|
|||
DISABLED = 1 << 2, // Disabled state of a control. This state indicates that the control is currently disabled. You can retrieve and set this value through the enabled property.
|
||||
SELECTED = 1 << 3 // Selected state of a control. This state indicates that the control is currently selected. You can retrieve and set this value through the selected property.
|
||||
};
|
||||
|
||||
|
||||
/** Creates a Control object */
|
||||
static Control* create();
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Control();
|
||||
virtual bool init(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Control();
|
||||
|
||||
/** Tells whether the control is enabled. */
|
||||
virtual void setEnabled(bool bEnabled);
|
||||
|
@ -184,6 +175,17 @@ public:
|
|||
virtual void setOpacityModifyRGB(bool bOpacityModifyRGB) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Control();
|
||||
virtual bool init(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Control();
|
||||
|
||||
/**
|
||||
* Returns an Invocation object able to construct messages using a given
|
||||
* target-action pair. (The invocation may optionnaly include the sender and
|
||||
|
@ -240,7 +242,6 @@ protected:
|
|||
*/
|
||||
void removeTargetWithActionForControlEvent(Object* target, Handler action, EventType controlEvent);
|
||||
|
||||
protected:
|
||||
bool _enabled;
|
||||
bool _selected;
|
||||
bool _highlighted;
|
||||
|
@ -260,6 +261,9 @@ protected:
|
|||
|
||||
/** The current control state constant. */
|
||||
CC_SYNTHESIZE_READONLY(State, _state, State);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Control);
|
||||
};
|
||||
|
||||
Control::EventType operator|(Control::EventType a, Control::EventType b);
|
||||
|
|
|
@ -151,13 +151,13 @@ ControlButton* ControlButton::create(Node* label, Scale9Sprite* backgroundSprite
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ControlButton::initWithTitleAndFontNameAndFontSize(string title, const char * fontName, float fontSize)
|
||||
bool ControlButton::initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize)
|
||||
{
|
||||
LabelTTF *label = LabelTTF::create(title.c_str(), fontName, fontSize);
|
||||
LabelTTF *label = LabelTTF::create(title, fontName, fontSize);
|
||||
return initWithLabelAndBackgroundSprite(label, Scale9Sprite::create());
|
||||
}
|
||||
|
||||
ControlButton* ControlButton::create(string title, const char * fontName, float fontSize)
|
||||
ControlButton* ControlButton::create(const std::string& title, const std::string& fontName, float fontSize)
|
||||
{
|
||||
ControlButton *pRet = new ControlButton();
|
||||
pRet->initWithTitleAndFontNameAndFontSize(title, fontName, fontSize);
|
||||
|
@ -237,7 +237,7 @@ bool ControlButton::getZoomOnTouchDown()
|
|||
return _zoomOnTouchDown;
|
||||
}
|
||||
|
||||
void ControlButton::setPreferredSize(Size size)
|
||||
void ControlButton::setPreferredSize(const Size& size)
|
||||
{
|
||||
if(size.width == 0 && size.height == 0)
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ void ControlButton::setPreferredSize(Size size)
|
|||
needsLayout();
|
||||
}
|
||||
|
||||
Size ControlButton::getPreferredSize()
|
||||
const Size& ControlButton::getPreferredSize() const
|
||||
{
|
||||
return _preferredSize;
|
||||
}
|
||||
|
@ -274,12 +274,12 @@ bool ControlButton::doesAdjustBackgroundImage()
|
|||
return _doesAdjustBackgroundImage;
|
||||
}
|
||||
|
||||
Point ControlButton::getLabelAnchorPoint()
|
||||
const Point& ControlButton::getLabelAnchorPoint() const
|
||||
{
|
||||
return this->_labelAnchorPoint;
|
||||
}
|
||||
|
||||
void ControlButton::setLabelAnchorPoint(Point labelAnchorPoint)
|
||||
void ControlButton::setLabelAnchorPoint(const Point& labelAnchorPoint)
|
||||
{
|
||||
this->_labelAnchorPoint = labelAnchorPoint;
|
||||
if (_titleLabel != NULL)
|
||||
|
@ -292,12 +292,12 @@ String* ControlButton::getTitleForState(State state)
|
|||
{
|
||||
if (_titleDispatchTable != NULL)
|
||||
{
|
||||
String* title=(String*)_titleDispatchTable->objectForKey((int)state);
|
||||
String* title = static_cast<String*>(_titleDispatchTable->objectForKey((int)state));
|
||||
if (title)
|
||||
{
|
||||
return title;
|
||||
}
|
||||
return (String*)_titleDispatchTable->objectForKey((int)Control::State::NORMAL);
|
||||
return static_cast<String*>(_titleDispatchTable->objectForKey((int)Control::State::NORMAL));
|
||||
}
|
||||
return String::create("");
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ Color3B ControlButton::getTitleColorForState(State state) const
|
|||
return returnColor;
|
||||
}
|
||||
|
||||
void ControlButton::setTitleColorForState(Color3B color, State state)
|
||||
void ControlButton::setTitleColorForState(const Color3B& color, State state)
|
||||
{
|
||||
//Color3B* colorValue=&color;
|
||||
_titleColorDispatchTable->removeObjectForKey((int)state);
|
||||
|
@ -359,7 +359,7 @@ void ControlButton::setTitleColorForState(Color3B color, State state)
|
|||
|
||||
Node* ControlButton::getTitleLabelForState(State state)
|
||||
{
|
||||
Node* titleLabel = (Node*)_titleLabelDispatchTable->objectForKey((int)state);
|
||||
Node* titleLabel = static_cast<Node*>(_titleLabelDispatchTable->objectForKey((int)state));
|
||||
if (titleLabel)
|
||||
{
|
||||
return titleLabel;
|
||||
|
@ -369,7 +369,7 @@ Node* ControlButton::getTitleLabelForState(State state)
|
|||
|
||||
void ControlButton::setTitleLabelForState(Node* titleLabel, State state)
|
||||
{
|
||||
Node* previousLabel = (Node*)_titleLabelDispatchTable->objectForKey((int)state);
|
||||
Node* previousLabel = static_cast<Node*>(_titleLabelDispatchTable->objectForKey((int)state));
|
||||
if (previousLabel)
|
||||
{
|
||||
removeChild(previousLabel, true);
|
||||
|
@ -388,7 +388,7 @@ void ControlButton::setTitleLabelForState(Node* titleLabel, State state)
|
|||
}
|
||||
}
|
||||
|
||||
void ControlButton::setTitleTTFForState(const char * fntFile, State state)
|
||||
void ControlButton::setTitleTTFForState(const std::string& fntFile, State state)
|
||||
{
|
||||
String * title = this->getTitleForState(state);
|
||||
if (!title)
|
||||
|
@ -398,18 +398,17 @@ void ControlButton::setTitleTTFForState(const char * fntFile, State state)
|
|||
this->setTitleLabelForState(LabelTTF::create(title->getCString(), fntFile, 12), state);
|
||||
}
|
||||
|
||||
const char * ControlButton::getTitleTTFForState(State state)
|
||||
const std::string& ControlButton::getTitleTTFForState(State state)
|
||||
{
|
||||
LabelProtocol* label = dynamic_cast<LabelProtocol*>(this->getTitleLabelForState(state));
|
||||
LabelTTF* labelTTF = dynamic_cast<LabelTTF*>(label);
|
||||
if(labelTTF != 0)
|
||||
{
|
||||
return labelTTF->getFontName().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
return labelTTF->getFontName();
|
||||
}
|
||||
|
||||
static std::string ret("");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ControlButton::setTitleTTFSizeForState(float size, State state)
|
||||
|
@ -439,7 +438,7 @@ float ControlButton::getTitleTTFSizeForState(State state)
|
|||
}
|
||||
}
|
||||
|
||||
void ControlButton::setTitleBMFontForState(const char * fntFile, State state)
|
||||
void ControlButton::setTitleBMFontForState(const std::string& fntFile, State state)
|
||||
{
|
||||
String * title = this->getTitleForState(state);
|
||||
if (!title)
|
||||
|
@ -449,7 +448,7 @@ void ControlButton::setTitleBMFontForState(const char * fntFile, State state)
|
|||
this->setTitleLabelForState(LabelBMFont::create(title->getCString(), fntFile), state);
|
||||
}
|
||||
|
||||
const char * ControlButton::getTitleBMFontForState(State state)
|
||||
const std::string& ControlButton::getTitleBMFontForState(State state)
|
||||
{
|
||||
LabelProtocol* label = dynamic_cast<LabelProtocol*>(this->getTitleLabelForState(state));
|
||||
LabelBMFont* labelBMFont = dynamic_cast<LabelBMFont*>(label);
|
||||
|
@ -457,10 +456,9 @@ const char * ControlButton::getTitleBMFontForState(State state)
|
|||
{
|
||||
return labelBMFont->getFntFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
static std::string ret("");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -56,21 +56,7 @@ public:
|
|||
static ControlButton* create();
|
||||
static ControlButton* create(Scale9Sprite* sprite);
|
||||
static ControlButton* create(Node* label, Scale9Sprite* backgroundSprite);
|
||||
static ControlButton* create(std::string title, const char * fontName, float fontSize);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ControlButton();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ControlButton();
|
||||
|
||||
virtual bool init();
|
||||
virtual bool initWithLabelAndBackgroundSprite(Node* label, Scale9Sprite* backgroundSprite);
|
||||
virtual bool initWithBackgroundSprite(Scale9Sprite* sprite);
|
||||
virtual bool initWithTitleAndFontNameAndFontSize(std::string title, const char * fontName, float fontSize);
|
||||
static ControlButton* create(const std::string& title, const std::string& fontName, float fontSize);
|
||||
|
||||
virtual void needsLayout(void);
|
||||
|
||||
|
@ -119,7 +105,7 @@ public:
|
|||
* @param state The state that uses the specified color. The values are described
|
||||
* in "CCControlState".
|
||||
*/
|
||||
virtual void setTitleColorForState(Color3B color, State state);
|
||||
virtual void setTitleColorForState(const Color3B& color, State state);
|
||||
|
||||
/**
|
||||
* Returns the title label used for a state.
|
||||
|
@ -140,8 +126,8 @@ public:
|
|||
*/
|
||||
virtual void setTitleLabelForState(Node* label, State state);
|
||||
|
||||
virtual void setTitleTTFForState(const char * fntFile, State state);
|
||||
virtual const char * getTitleTTFForState(State state);
|
||||
virtual void setTitleTTFForState(const std::string& fntFile, State state);
|
||||
virtual const std::string& getTitleTTFForState(State state);
|
||||
|
||||
virtual void setTitleTTFSizeForState(float size, State state);
|
||||
virtual float getTitleTTFSizeForState(State state);
|
||||
|
@ -152,8 +138,8 @@ public:
|
|||
* @param state The state that uses the specified fntFile. The values are described
|
||||
* in "CCControlState".
|
||||
*/
|
||||
virtual void setTitleBMFontForState(const char * fntFile, State state);
|
||||
virtual const char * getTitleBMFontForState(State state);
|
||||
virtual void setTitleBMFontForState(const std::string& fntFile, State state);
|
||||
virtual const std::string& getTitleBMFontForState(State state);
|
||||
|
||||
/**
|
||||
* Returns the background sprite used for a state.
|
||||
|
@ -184,31 +170,38 @@ public:
|
|||
//set the margins at once (so we only have to do one call of needsLayout)
|
||||
virtual void setMargins(int marginH, int marginV);
|
||||
|
||||
/** Adjust the background image. YES by default. If the property is set to NO, the
|
||||
background will use the prefered size of the background image. */
|
||||
bool doesAdjustBackgroundImage();
|
||||
void setAdjustBackgroundImage(bool adjustBackgroundImage);
|
||||
|
||||
// Overrides
|
||||
virtual bool onTouchBegan(Touch *touch, Event *event) override;
|
||||
virtual void onTouchMoved(Touch *touch, Event *event) override;
|
||||
virtual void onTouchEnded(Touch *touch, Event *event) override;
|
||||
virtual void onTouchCancelled(Touch *touch, Event *event) override;
|
||||
|
||||
// Overrides
|
||||
// virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) override;
|
||||
// virtual void ccTouchMoved(Touch *pTouch, Event *pEvent) override;
|
||||
// virtual void ccTouchEnded(Touch *pTouch, Event *pEvent) override;
|
||||
// virtual void ccTouchCancelled(Touch *pTouch, Event *pEvent) override;
|
||||
virtual GLubyte getOpacity(void) const override;
|
||||
virtual void setOpacity(GLubyte var) override;
|
||||
virtual const Color3B& getColor(void) const override;
|
||||
virtual void setColor(const Color3B&) override;
|
||||
|
||||
//protected:
|
||||
// RGBAProtocol
|
||||
//bool _isOpacityModifyRGB;
|
||||
|
||||
/** Adjust the background image. YES by default. If the property is set to NO, the
|
||||
background will use the prefered size of the background image. */
|
||||
bool doesAdjustBackgroundImage();
|
||||
void setAdjustBackgroundImage(bool adjustBackgroundImage);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ControlButton();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ControlButton();
|
||||
|
||||
virtual bool init();
|
||||
virtual bool initWithLabelAndBackgroundSprite(Node* label, Scale9Sprite* backgroundSprite);
|
||||
virtual bool initWithBackgroundSprite(Scale9Sprite* sprite);
|
||||
virtual bool initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize);
|
||||
|
||||
bool _isPushed;
|
||||
bool _parentInited;
|
||||
bool _doesAdjustBackgroundImage;
|
||||
|
@ -226,12 +219,12 @@ protected:
|
|||
CC_SYNTHESIZE_RETAIN(Scale9Sprite*, _backgroundSprite, BackgroundSprite);
|
||||
|
||||
/** The prefered size of the button, if label is larger it will be expanded. */
|
||||
CC_PROPERTY(Size, _preferredSize, PreferredSize);
|
||||
CC_PROPERTY_PASS_BY_REF(Size, _preferredSize, PreferredSize);
|
||||
|
||||
/** Adjust the button zooming on touchdown. Default value is YES. */
|
||||
CC_PROPERTY(bool, _zoomOnTouchDown, ZoomOnTouchDown);
|
||||
|
||||
CC_PROPERTY(Point, _labelAnchorPoint, LabelAnchorPoint);
|
||||
CC_PROPERTY_PASS_BY_REF(Point, _labelAnchorPoint, LabelAnchorPoint);
|
||||
|
||||
// <ControlState, String*>
|
||||
CC_SYNTHESIZE_RETAIN(Dictionary*, _titleDispatchTable, TitleDispatchTable);
|
||||
|
@ -246,6 +239,9 @@ protected:
|
|||
CC_SYNTHESIZE_READONLY(int, _marginV, VerticalMargin);
|
||||
/* Define the button margin for Left/Right edge */
|
||||
CC_SYNTHESIZE_READONLY(int, _marginH, HorizontalOrigin);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ControlButton);
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
|
|
|
@ -34,32 +34,20 @@ NS_CC_EXT_BEGIN
|
|||
class ControlSwitchSprite : public Sprite, public ActionTweenDelegate
|
||||
{
|
||||
public:
|
||||
/** creates an autorelease instance of ControlSwitchSprite */
|
||||
static ControlSwitchSprite* create(
|
||||
Sprite *maskSprite,
|
||||
Sprite *onSprite,
|
||||
Sprite *offSprite,
|
||||
Sprite *thumbSprite,
|
||||
LabelTTF* onLabel,
|
||||
LabelTTF* offLabel);
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
ControlSwitchSprite();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ControlSwitchSprite();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithMaskSprite(
|
||||
Sprite *maskSprite,
|
||||
Sprite *onSprite,
|
||||
Sprite *offSprite,
|
||||
Sprite *thumbSprite,
|
||||
LabelTTF* onLabel,
|
||||
LabelTTF* offLabel);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void draw();
|
||||
void draw() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
@ -89,7 +77,8 @@ public:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void updateTweenAction(float value, const char* key);
|
||||
virtual void updateTweenAction(float value, const std::string& key) override;
|
||||
|
||||
/** Contains the position (in x-axis) of the slider inside the receiver. */
|
||||
float _sliderXPosition;
|
||||
CC_SYNTHESIZE(float, _onPosition, OnPosition)
|
||||
|
@ -104,8 +93,47 @@ public:
|
|||
CC_SYNTHESIZE_RETAIN(Sprite*, _thumbSprite, ThumbSprite)
|
||||
CC_SYNTHESIZE_RETAIN(LabelTTF*, _onLabel, OnLabel)
|
||||
CC_SYNTHESIZE_RETAIN(LabelTTF*, _offLabel, OffLabel)
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
ControlSwitchSprite();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ControlSwitchSprite();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
bool initWithMaskSprite(
|
||||
Sprite *maskSprite,
|
||||
Sprite *onSprite,
|
||||
Sprite *offSprite,
|
||||
Sprite *thumbSprite,
|
||||
LabelTTF* onLabel,
|
||||
LabelTTF* offLabel);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ControlSwitchSprite);
|
||||
};
|
||||
|
||||
ControlSwitchSprite* ControlSwitchSprite::create(Sprite *maskSprite,
|
||||
Sprite *onSprite,
|
||||
Sprite *offSprite,
|
||||
Sprite *thumbSprite,
|
||||
LabelTTF* onLabel,
|
||||
LabelTTF* offLabel)
|
||||
{
|
||||
auto ret = new ControlSwitchSprite();
|
||||
ret->initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, onLabel, offLabel);
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
|
||||
ControlSwitchSprite::ControlSwitchSprite()
|
||||
: _sliderXPosition(0.0f)
|
||||
, _onPosition(0.0f)
|
||||
|
@ -187,9 +215,9 @@ bool ControlSwitchSprite::initWithMaskSprite(
|
|||
return false;
|
||||
}
|
||||
|
||||
void ControlSwitchSprite::updateTweenAction(float value, const char* key)
|
||||
void ControlSwitchSprite::updateTweenAction(float value, const std::string& key)
|
||||
{
|
||||
CCLOG("key = %s, value = %f", key, value);
|
||||
CCLOG("key = %s, value = %f", key.c_str(), value);
|
||||
setSliderXPosition(value);
|
||||
}
|
||||
|
||||
|
@ -348,13 +376,13 @@ bool ControlSwitch::initWithMaskSprite(Sprite *maskSprite, Sprite * onSprite, Sp
|
|||
|
||||
_on = true;
|
||||
|
||||
_switchSprite = new ControlSwitchSprite();
|
||||
_switchSprite->initWithMaskSprite(maskSprite,
|
||||
onSprite,
|
||||
offSprite,
|
||||
thumbSprite,
|
||||
onLabel,
|
||||
offLabel);
|
||||
_switchSprite = ControlSwitchSprite::create(maskSprite,
|
||||
onSprite,
|
||||
offSprite,
|
||||
thumbSprite,
|
||||
onLabel,
|
||||
offLabel);
|
||||
_switchSprite->retain();
|
||||
_switchSprite->setPosition(Point(_switchSprite->getContentSize().width / 2, _switchSprite->getContentSize().height / 2));
|
||||
addChild(_switchSprite);
|
||||
|
||||
|
|
|
@ -245,48 +245,49 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, const Rect& o
|
|||
centertopbounds = RectApplyAffineTransform(centertopbounds, t);
|
||||
|
||||
// Centre
|
||||
_centre = new Sprite();
|
||||
_centre->initWithTexture(_scale9Image->getTexture(), centerbounds);
|
||||
_centre = Sprite::createWithTexture(_scale9Image->getTexture(), centerbounds);
|
||||
_centre->retain();
|
||||
_scale9Image->addChild(_centre, 0, pCentre);
|
||||
|
||||
|
||||
// Top
|
||||
_top = new Sprite();
|
||||
_top->initWithTexture(_scale9Image->getTexture(), centertopbounds);
|
||||
_top = Sprite::createWithTexture(_scale9Image->getTexture(), centertopbounds);
|
||||
_top->retain();
|
||||
_scale9Image->addChild(_top, 1, pTop);
|
||||
|
||||
// Bottom
|
||||
_bottom = new Sprite();
|
||||
_bottom->initWithTexture(_scale9Image->getTexture(), centerbottombounds);
|
||||
_bottom = Sprite::createWithTexture(_scale9Image->getTexture(), centerbottombounds);
|
||||
_bottom->retain();
|
||||
_scale9Image->addChild(_bottom, 1, pBottom);
|
||||
|
||||
// Left
|
||||
_left = new Sprite();
|
||||
_left->initWithTexture(_scale9Image->getTexture(), leftcenterbounds);
|
||||
_left = Sprite::createWithTexture(_scale9Image->getTexture(), leftcenterbounds);
|
||||
_left->retain();
|
||||
_scale9Image->addChild(_left, 1, pLeft);
|
||||
|
||||
// Right
|
||||
_right = new Sprite();
|
||||
_right->initWithTexture(_scale9Image->getTexture(), rightcenterbounds);
|
||||
_right = Sprite::createWithTexture(_scale9Image->getTexture(), rightcenterbounds);
|
||||
_right->retain();
|
||||
_scale9Image->addChild(_right, 1, pRight);
|
||||
|
||||
// Top left
|
||||
_topLeft = new Sprite();
|
||||
_topLeft->initWithTexture(_scale9Image->getTexture(), lefttopbounds);
|
||||
_topLeft = Sprite::createWithTexture(_scale9Image->getTexture(), lefttopbounds);
|
||||
_topLeft->retain();
|
||||
_scale9Image->addChild(_topLeft, 2, pTopLeft);
|
||||
|
||||
// Top right
|
||||
_topRight = new Sprite();
|
||||
_topRight->initWithTexture(_scale9Image->getTexture(), righttopbounds);
|
||||
_topRight = Sprite::createWithTexture(_scale9Image->getTexture(), righttopbounds);
|
||||
_topRight->retain();
|
||||
_scale9Image->addChild(_topRight, 2, pTopRight);
|
||||
|
||||
// Bottom left
|
||||
_bottomLeft = new Sprite();
|
||||
_bottomLeft->initWithTexture(_scale9Image->getTexture(), leftbottombounds);
|
||||
_bottomLeft = Sprite::createWithTexture(_scale9Image->getTexture(), leftbottombounds);
|
||||
_bottomLeft->retain();
|
||||
_scale9Image->addChild(_bottomLeft, 2, pBottomLeft);
|
||||
|
||||
// Bottom right
|
||||
_bottomRight = new Sprite();
|
||||
_bottomRight->initWithTexture(_scale9Image->getTexture(), rightbottombounds);
|
||||
_bottomRight = Sprite::createWithTexture(_scale9Image->getTexture(), rightbottombounds);
|
||||
_bottomRight->retain();
|
||||
_scale9Image->addChild(_bottomRight, 2, pBottomRight);
|
||||
} else {
|
||||
// set up transformation of coordinates
|
||||
|
@ -330,48 +331,48 @@ bool Scale9Sprite::updateWithBatchNode(SpriteBatchNode* batchnode, const Rect& o
|
|||
rotatedcentertopbounds.origin = centertopbounds.origin;
|
||||
|
||||
// Centre
|
||||
_centre = new Sprite();
|
||||
_centre->initWithTexture(_scale9Image->getTexture(), rotatedcenterbounds, true);
|
||||
_centre = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedcenterbounds, true);
|
||||
_centre->retain();
|
||||
_scale9Image->addChild(_centre, 0, pCentre);
|
||||
|
||||
// Top
|
||||
_top = new Sprite();
|
||||
_top->initWithTexture(_scale9Image->getTexture(), rotatedcentertopbounds, true);
|
||||
_top = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedcentertopbounds, true);
|
||||
_top->retain();
|
||||
_scale9Image->addChild(_top, 1, pTop);
|
||||
|
||||
// Bottom
|
||||
_bottom = new Sprite();
|
||||
_bottom->initWithTexture(_scale9Image->getTexture(), rotatedcenterbottombounds, true);
|
||||
_bottom = Sprite::Sprite::createWithTexture(_scale9Image->getTexture(), rotatedcenterbottombounds, true);
|
||||
_bottom->retain();
|
||||
_scale9Image->addChild(_bottom, 1, pBottom);
|
||||
|
||||
// Left
|
||||
_left = new Sprite();
|
||||
_left->initWithTexture(_scale9Image->getTexture(), rotatedleftcenterbounds, true);
|
||||
_left = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedleftcenterbounds, true);
|
||||
_left->retain();
|
||||
_scale9Image->addChild(_left, 1, pLeft);
|
||||
|
||||
// Right
|
||||
_right = new Sprite();
|
||||
_right->initWithTexture(_scale9Image->getTexture(), rotatedrightcenterbounds, true);
|
||||
_right = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedrightcenterbounds, true);
|
||||
_right->retain();
|
||||
_scale9Image->addChild(_right, 1, pRight);
|
||||
|
||||
// Top left
|
||||
_topLeft = new Sprite();
|
||||
_topLeft->initWithTexture(_scale9Image->getTexture(), rotatedlefttopbounds, true);
|
||||
_topLeft = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedlefttopbounds, true);
|
||||
_topLeft->retain();
|
||||
_scale9Image->addChild(_topLeft, 2, pTopLeft);
|
||||
|
||||
// Top right
|
||||
_topRight = new Sprite();
|
||||
_topRight->initWithTexture(_scale9Image->getTexture(), rotatedrighttopbounds, true);
|
||||
_topRight = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedrighttopbounds, true);
|
||||
_topRight->retain();
|
||||
_scale9Image->addChild(_topRight, 2, pTopRight);
|
||||
|
||||
// Bottom left
|
||||
_bottomLeft = new Sprite();
|
||||
_bottomLeft->initWithTexture(_scale9Image->getTexture(), rotatedleftbottombounds, true);
|
||||
_bottomLeft = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedleftbottombounds, true);
|
||||
_bottomLeft->retain();
|
||||
_scale9Image->addChild(_bottomLeft, 2, pBottomLeft);
|
||||
|
||||
// Bottom right
|
||||
_bottomRight = new Sprite();
|
||||
_bottomRight->initWithTexture(_scale9Image->getTexture(), rotatedrightbottombounds, true);
|
||||
_bottomRight = Sprite::createWithTexture(_scale9Image->getTexture(), rotatedrightbottombounds, true);
|
||||
_bottomRight->retain();
|
||||
_scale9Image->addChild(_bottomRight, 2, pBottomRight);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,9 +63,6 @@ static Layer* nextAction()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -77,18 +74,12 @@ static Layer* backAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Layer* restartAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ public:
|
|||
class ActionManual : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionManual);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -47,6 +49,8 @@ public:
|
|||
class ActionMove : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionMove);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -54,6 +58,8 @@ public:
|
|||
class ActionScale : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionScale);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -61,6 +67,8 @@ public:
|
|||
class ActionSkew : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionSkew);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -68,6 +76,8 @@ public:
|
|||
class ActionRotationalSkew : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRotationalSkew);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -75,6 +85,8 @@ public:
|
|||
class ActionRotationalSkewVSStandardSkew : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRotationalSkewVSStandardSkew);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -82,6 +94,8 @@ public:
|
|||
class ActionSkewRotateScale : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionSkewRotateScale);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -89,6 +103,8 @@ public:
|
|||
class ActionRotate : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRotate);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -96,6 +112,8 @@ public:
|
|||
class ActionJump : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionJump);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -103,6 +121,8 @@ public:
|
|||
class ActionBezier : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionBezier);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -110,6 +130,8 @@ public:
|
|||
class ActionBlink : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionBlink);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -117,6 +139,8 @@ public:
|
|||
class ActionFade : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionFade);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -124,6 +148,8 @@ public:
|
|||
class ActionTint : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionTint);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -131,6 +157,8 @@ public:
|
|||
class ActionAnimate : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionAnimate);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
|
@ -140,6 +168,8 @@ public:
|
|||
class ActionSequence : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionSequence);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -147,6 +177,8 @@ public:
|
|||
class ActionSequence2 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionSequence2);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
|
||||
|
@ -158,6 +190,8 @@ public:
|
|||
class ActionSpawn : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionSpawn);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -165,6 +199,8 @@ public:
|
|||
class ActionReverse : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionReverse);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -172,6 +208,8 @@ public:
|
|||
class ActionRepeat : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRepeat);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -179,6 +217,8 @@ public:
|
|||
class ActionDelayTime : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionDelayTime);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -186,6 +226,8 @@ public:
|
|||
class ActionReverseSequence : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionReverseSequence);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -193,6 +235,8 @@ public:
|
|||
class ActionReverseSequence2 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionReverseSequence2);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -200,6 +244,8 @@ public:
|
|||
class ActionOrbit : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionOrbit);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -207,6 +253,8 @@ public:
|
|||
class ActionRemoveSelf : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRemoveSelf);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -214,6 +262,8 @@ public:
|
|||
class ActionRepeatForever : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRepeatForever);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
|
||||
|
@ -223,6 +273,8 @@ public:
|
|||
class ActionRotateToRepeat : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRotateToRepeat);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -230,6 +282,8 @@ public:
|
|||
class ActionRotateJerk : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionRotateJerk);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -237,6 +291,8 @@ public:
|
|||
class ActionCallFuncN : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCallFuncN);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -246,6 +302,8 @@ public:
|
|||
class ActionCallFuncND : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCallFuncND);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -255,6 +313,8 @@ public:
|
|||
class ActionCallFuncO : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCallFuncO);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -264,6 +324,8 @@ public:
|
|||
class ActionCallFunction : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCallFunction);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
|
||||
|
@ -276,6 +338,8 @@ public:
|
|||
class ActionFollow : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionFollow);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void draw();
|
||||
virtual std::string subtitle();
|
||||
|
@ -284,6 +348,8 @@ public:
|
|||
class ActionTargeted : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionTargeted);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -292,6 +358,8 @@ public:
|
|||
class ActionTargetedReverse : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionTargetedReverse);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -300,6 +368,8 @@ public:
|
|||
class ActionStacked : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionStacked);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -311,6 +381,8 @@ public:
|
|||
class ActionMoveStacked : public ActionStacked
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionMoveStacked);
|
||||
|
||||
virtual std::string title();
|
||||
virtual void runActionsInSprite(Sprite* sprite);
|
||||
};
|
||||
|
@ -318,6 +390,8 @@ public:
|
|||
class ActionMoveJumpStacked : public ActionStacked
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionMoveJumpStacked);
|
||||
|
||||
virtual std::string title();
|
||||
virtual void runActionsInSprite(Sprite* sprite);
|
||||
};
|
||||
|
@ -325,6 +399,8 @@ public:
|
|||
class ActionMoveBezierStacked : public ActionStacked
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionMoveBezierStacked);
|
||||
|
||||
virtual std::string title();
|
||||
virtual void runActionsInSprite(Sprite* sprite);
|
||||
};
|
||||
|
@ -332,6 +408,8 @@ public:
|
|||
class ActionCatmullRomStacked : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCatmullRomStacked);
|
||||
|
||||
virtual ~ActionCatmullRomStacked();
|
||||
virtual void draw();
|
||||
virtual void onEnter();
|
||||
|
@ -345,6 +423,8 @@ private:
|
|||
class ActionCardinalSplineStacked : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCardinalSplineStacked);
|
||||
|
||||
virtual ~ActionCardinalSplineStacked();
|
||||
virtual void draw();
|
||||
virtual void onEnter();
|
||||
|
@ -357,6 +437,8 @@ private:
|
|||
class Issue1305 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1305);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
void log(Node* sender);
|
||||
|
@ -370,6 +452,8 @@ private:
|
|||
class Issue1305_2 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1305_2);
|
||||
|
||||
virtual void onEnter();
|
||||
void printLog1();
|
||||
void printLog2();
|
||||
|
@ -382,6 +466,8 @@ public:
|
|||
class Issue1288 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1288);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -390,6 +476,8 @@ public:
|
|||
class Issue1288_2 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1288_2);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -398,6 +486,8 @@ public:
|
|||
class Issue1327 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1327);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
virtual std::string title();
|
||||
|
@ -407,6 +497,8 @@ public:
|
|||
class Issue1398 : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1398);
|
||||
|
||||
void incrementInteger();
|
||||
void incrementIntegerCallback(void* data);
|
||||
virtual void onEnter();
|
||||
|
@ -419,6 +511,8 @@ private:
|
|||
class ActionCatmullRom : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCatmullRom);
|
||||
|
||||
~ActionCatmullRom();
|
||||
|
||||
virtual void onEnter();
|
||||
|
@ -433,6 +527,8 @@ private:
|
|||
class ActionCardinalSpline : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ActionCardinalSpline);
|
||||
|
||||
~ActionCardinalSpline();
|
||||
|
||||
virtual void onEnter();
|
||||
|
@ -446,6 +542,8 @@ private:
|
|||
class PauseResumeActions : public ActionsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(PauseResumeActions);
|
||||
|
||||
PauseResumeActions();
|
||||
virtual ~PauseResumeActions();
|
||||
virtual void onEnter();
|
||||
|
|
|
@ -16,36 +16,21 @@ enum {
|
|||
kTagContentNode = 102,
|
||||
};
|
||||
|
||||
TESTLAYER_CREATE_FUNC(ScrollViewDemo);
|
||||
TESTLAYER_CREATE_FUNC(HoleDemo);
|
||||
TESTLAYER_CREATE_FUNC(ShapeTest);
|
||||
TESTLAYER_CREATE_FUNC(ShapeInvertedTest);
|
||||
TESTLAYER_CREATE_FUNC(SpriteTest);
|
||||
TESTLAYER_CREATE_FUNC(SpriteNoAlphaTest);
|
||||
TESTLAYER_CREATE_FUNC(SpriteInvertedTest);
|
||||
TESTLAYER_CREATE_FUNC(NestedTest);
|
||||
TESTLAYER_CREATE_FUNC(RawStencilBufferTest);
|
||||
TESTLAYER_CREATE_FUNC(RawStencilBufferTest2);
|
||||
TESTLAYER_CREATE_FUNC(RawStencilBufferTest3);
|
||||
TESTLAYER_CREATE_FUNC(RawStencilBufferTest4);
|
||||
TESTLAYER_CREATE_FUNC(RawStencilBufferTest5);
|
||||
TESTLAYER_CREATE_FUNC(RawStencilBufferTest6);
|
||||
|
||||
static NEWTESTFUNC createFunctions[] = {
|
||||
CF(ScrollViewDemo),
|
||||
CF(HoleDemo),
|
||||
CF(ShapeTest),
|
||||
CF(ShapeInvertedTest),
|
||||
CF(SpriteTest),
|
||||
CF(SpriteNoAlphaTest),
|
||||
CF(SpriteInvertedTest),
|
||||
CF(NestedTest),
|
||||
CF(RawStencilBufferTest),
|
||||
CF(RawStencilBufferTest2),
|
||||
CF(RawStencilBufferTest3),
|
||||
CF(RawStencilBufferTest4),
|
||||
CF(RawStencilBufferTest5),
|
||||
CF(RawStencilBufferTest6)
|
||||
static std::function<Layer*()> createFunctions[] = {
|
||||
CL(ScrollViewDemo),
|
||||
CL(HoleDemo),
|
||||
CL(ShapeTest),
|
||||
CL(ShapeInvertedTest),
|
||||
CL(SpriteTest),
|
||||
CL(SpriteNoAlphaTest),
|
||||
CL(SpriteInvertedTest),
|
||||
CL(NestedTest),
|
||||
CL(RawStencilBufferTest),
|
||||
CL(RawStencilBufferTest2),
|
||||
CL(RawStencilBufferTest3),
|
||||
CL(RawStencilBufferTest4),
|
||||
CL(RawStencilBufferTest5),
|
||||
CL(RawStencilBufferTest6)
|
||||
};
|
||||
|
||||
static int sceneIdx=-1;
|
||||
|
@ -57,8 +42,6 @@ static Layer* nextAction()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
@ -71,8 +54,6 @@ static Layer* backAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
@ -80,8 +61,6 @@ static Layer* backAction()
|
|||
static Layer* restartAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
class BaseClippingNodeTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(BaseClippingNodeTest);
|
||||
|
||||
~BaseClippingNodeTest();
|
||||
virtual bool init();
|
||||
|
||||
|
@ -22,6 +24,8 @@ public:
|
|||
class BasicTest : public BaseClippingNodeTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(BasicTest);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void setup();
|
||||
|
@ -40,6 +44,8 @@ public:
|
|||
class ShapeTest : public BasicTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ShapeTest);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
||||
|
@ -50,6 +56,8 @@ public:
|
|||
class ShapeInvertedTest : public ShapeTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ShapeInvertedTest);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual ClippingNode* clipper();
|
||||
|
@ -58,6 +66,8 @@ public:
|
|||
class SpriteTest : public BasicTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(SpriteTest);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
||||
|
@ -69,6 +79,8 @@ public:
|
|||
class SpriteNoAlphaTest : public SpriteTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(SpriteNoAlphaTest);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual ClippingNode* clipper();
|
||||
|
@ -77,6 +89,8 @@ public:
|
|||
class SpriteInvertedTest : public SpriteTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(SpriteInvertedTest);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual ClippingNode* clipper();
|
||||
|
@ -85,6 +99,8 @@ public:
|
|||
class NestedTest : public BaseClippingNodeTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(NestedTest);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void setup();
|
||||
|
@ -93,6 +109,8 @@ public:
|
|||
class HoleDemo : public BaseClippingNodeTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(HoleDemo);
|
||||
|
||||
~HoleDemo();
|
||||
virtual void setup();
|
||||
virtual std::string title();
|
||||
|
@ -108,6 +126,8 @@ private:
|
|||
class ScrollViewDemo : public BaseClippingNodeTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ScrollViewDemo);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void setup();
|
||||
|
@ -124,6 +144,8 @@ private:
|
|||
class RawStencilBufferTest : public BaseClippingNodeTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(RawStencilBufferTest);
|
||||
|
||||
~RawStencilBufferTest();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -141,6 +163,8 @@ protected:
|
|||
class RawStencilBufferTest2 : public RawStencilBufferTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(RawStencilBufferTest2);
|
||||
|
||||
virtual std::string subtitle();
|
||||
virtual void setupStencilForClippingOnPlane(GLint plane);
|
||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||
|
@ -149,6 +173,8 @@ public:
|
|||
class RawStencilBufferTest3 : public RawStencilBufferTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(RawStencilBufferTest3);
|
||||
|
||||
virtual std::string subtitle();
|
||||
virtual void setupStencilForClippingOnPlane(GLint plane);
|
||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||
|
@ -157,6 +183,8 @@ public:
|
|||
class RawStencilBufferTest4 : public RawStencilBufferTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(RawStencilBufferTest4);
|
||||
|
||||
virtual std::string subtitle();
|
||||
virtual void setupStencilForClippingOnPlane(GLint plane);
|
||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||
|
@ -165,6 +193,8 @@ public:
|
|||
class RawStencilBufferTest5 : public RawStencilBufferTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(RawStencilBufferTest5);
|
||||
|
||||
virtual std::string subtitle();
|
||||
virtual void setupStencilForClippingOnPlane(GLint plane);
|
||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||
|
@ -173,6 +203,8 @@ public:
|
|||
class RawStencilBufferTest6 : public RawStencilBufferTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(RawStencilBufferTest6);
|
||||
|
||||
virtual std::string subtitle();
|
||||
virtual void setup();
|
||||
virtual void setupStencilForClippingOnPlane(GLint plane);
|
||||
|
@ -184,6 +216,8 @@ public:
|
|||
class ClippingNodeTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ClippingNodeTestScene);
|
||||
|
||||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
|
|
|
@ -3,18 +3,12 @@
|
|||
#include "../testResource.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
TESTLAYER_CREATE_FUNC(ConfigurationLoadConfig);
|
||||
TESTLAYER_CREATE_FUNC(ConfigurationQuery);
|
||||
TESTLAYER_CREATE_FUNC(ConfigurationInvalid);
|
||||
TESTLAYER_CREATE_FUNC(ConfigurationDefault);
|
||||
TESTLAYER_CREATE_FUNC(ConfigurationSet);
|
||||
|
||||
static NEWTESTFUNC createFunctions[] = {
|
||||
CF(ConfigurationLoadConfig),
|
||||
CF(ConfigurationQuery),
|
||||
CF(ConfigurationInvalid),
|
||||
CF(ConfigurationDefault),
|
||||
CF(ConfigurationSet)
|
||||
static std::function<Layer*()> createFunctions[] = {
|
||||
CL(ConfigurationLoadConfig),
|
||||
CL(ConfigurationQuery),
|
||||
CL(ConfigurationInvalid),
|
||||
CL(ConfigurationDefault),
|
||||
CL(ConfigurationSet)
|
||||
};
|
||||
|
||||
static int sceneIdx=-1;
|
||||
|
@ -26,9 +20,6 @@ static Layer* nextAction()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -40,18 +31,12 @@ static Layer* backAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Layer* restartAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ public:
|
|||
class ConfigurationLoadConfig : public ConfigurationBase
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ConfigurationLoadConfig);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -42,6 +44,8 @@ public:
|
|||
class ConfigurationQuery : public ConfigurationBase
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ConfigurationQuery);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -49,6 +53,8 @@ public:
|
|||
class ConfigurationInvalid : public ConfigurationBase
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ConfigurationInvalid);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -56,6 +62,8 @@ public:
|
|||
class ConfigurationDefault : public ConfigurationBase
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ConfigurationDefault);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
@ -63,6 +71,8 @@ public:
|
|||
class ConfigurationSet : public ConfigurationBase
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(ConfigurationSet);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string subtitle();
|
||||
};
|
||||
|
|
|
@ -58,9 +58,6 @@ static Layer* nextAction()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -72,18 +69,12 @@ static Layer* backAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Layer* restartAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
class S9BatchNodeBasic : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9BatchNodeBasic);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -61,6 +63,8 @@ public:
|
|||
class S9FrameNameSpriteSheet : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheet);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -72,6 +76,8 @@ public:
|
|||
class S9FrameNameSpriteSheetRotated : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotated);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -83,6 +89,8 @@ public:
|
|||
class S9BatchNodeScaledNoInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9BatchNodeScaledNoInsets);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -94,6 +102,8 @@ public:
|
|||
class S9FrameNameSpriteSheetScaledNoInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetScaledNoInsets);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -105,6 +115,8 @@ public:
|
|||
class S9FrameNameSpriteSheetRotatedScaledNoInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedScaledNoInsets);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -117,6 +129,8 @@ public:
|
|||
class S9BatchNodeScaleWithCapInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9BatchNodeScaleWithCapInsets);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -128,6 +142,8 @@ public:
|
|||
class S9FrameNameSpriteSheetInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetInsets);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -139,6 +155,8 @@ public:
|
|||
class S9FrameNameSpriteSheetInsetsScaled : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetInsetsScaled);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -150,6 +168,8 @@ public:
|
|||
class S9FrameNameSpriteSheetRotatedInsets : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedInsets);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -161,6 +181,8 @@ public:
|
|||
class S9_TexturePacker : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9_TexturePacker);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -172,6 +194,8 @@ public:
|
|||
class S9FrameNameSpriteSheetRotatedInsetsScaled : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedInsetsScaled);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -183,6 +207,8 @@ public:
|
|||
class S9FrameNameSpriteSheetRotatedSetCapInsetLater : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9FrameNameSpriteSheetRotatedSetCapInsetLater);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -194,6 +220,8 @@ public:
|
|||
class S9CascadeOpacityAndColor : public S9SpriteTestDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(S9CascadeOpacityAndColor);
|
||||
|
||||
virtual void onEnter();
|
||||
|
||||
virtual std::string title();
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
#include "FileUtilsTest.h"
|
||||
|
||||
|
||||
TESTLAYER_CREATE_FUNC(TestResolutionDirectories);
|
||||
TESTLAYER_CREATE_FUNC(TestSearchPath);
|
||||
TESTLAYER_CREATE_FUNC(TestFilenameLookup);
|
||||
TESTLAYER_CREATE_FUNC(TestIsFileExist);
|
||||
TESTLAYER_CREATE_FUNC(TextWritePlist);
|
||||
|
||||
static NEWTESTFUNC createFunctions[] = {
|
||||
CF(TestResolutionDirectories),
|
||||
CF(TestSearchPath),
|
||||
CF(TestFilenameLookup),
|
||||
CF(TestIsFileExist),
|
||||
CF(TextWritePlist),
|
||||
static std::function<Layer*()> createFunctions[] = {
|
||||
CL(TestResolutionDirectories),
|
||||
CL(TestSearchPath),
|
||||
CL(TestFilenameLookup),
|
||||
CL(TestIsFileExist),
|
||||
CL(TextWritePlist),
|
||||
};
|
||||
|
||||
static int sceneIdx=-1;
|
||||
|
@ -24,9 +17,6 @@ static Layer* nextAction()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -38,18 +28,12 @@ static Layer* backAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Layer* restartAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->init();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ public:
|
|||
class TestResolutionDirectories : public FileUtilsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(TestResolutionDirectories);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual string title();
|
||||
|
@ -39,6 +41,8 @@ private:
|
|||
class TestSearchPath : public FileUtilsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(TestSearchPath);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual string title();
|
||||
|
@ -51,6 +55,8 @@ private:
|
|||
class TestFilenameLookup : public FileUtilsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(TestFilenameLookup);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual string title();
|
||||
|
@ -60,6 +66,8 @@ public:
|
|||
class TestIsFileExist : public FileUtilsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(TestIsFileExist);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual string title();
|
||||
|
@ -69,6 +77,8 @@ public:
|
|||
class TextWritePlist : public FileUtilsDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(TextWritePlist);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual string title();
|
||||
|
|
|
@ -82,8 +82,6 @@ Layer* nextAtlasAction()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -95,16 +93,12 @@ Layer* backAtlasAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
Layer* restartAtlasAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ class AtlasDemo : public BaseTest
|
|||
protected:
|
||||
|
||||
public:
|
||||
CREATE_FUNC(AtlasDemo);
|
||||
|
||||
AtlasDemo(void);
|
||||
~AtlasDemo(void);
|
||||
|
||||
|
@ -27,6 +29,8 @@ class Atlas1 : public AtlasDemo
|
|||
{
|
||||
TextureAtlas* _textureAtlas;
|
||||
public:
|
||||
CREATE_FUNC(Atlas1);
|
||||
|
||||
Atlas1();
|
||||
~Atlas1();
|
||||
virtual std::string title();
|
||||
|
@ -38,6 +42,8 @@ class LabelAtlasTest : public AtlasDemo
|
|||
{
|
||||
float _time;
|
||||
public:
|
||||
CREATE_FUNC(LabelAtlasTest);
|
||||
|
||||
LabelAtlasTest();
|
||||
|
||||
virtual void step(float dt);
|
||||
|
@ -50,6 +56,8 @@ class LabelAtlasColorTest : public AtlasDemo
|
|||
{
|
||||
float _time;
|
||||
public:
|
||||
CREATE_FUNC(LabelAtlasColorTest);
|
||||
|
||||
LabelAtlasColorTest();
|
||||
virtual void step(float dt);
|
||||
virtual std::string title();
|
||||
|
@ -60,6 +68,8 @@ public:
|
|||
class LabelTTFAlignment : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFAlignment);
|
||||
|
||||
LabelTTFAlignment();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -70,6 +80,8 @@ class Atlas3 : public AtlasDemo
|
|||
{
|
||||
float _time;
|
||||
public:
|
||||
CREATE_FUNC(Atlas3);
|
||||
|
||||
Atlas3();
|
||||
|
||||
virtual void step(float dt);
|
||||
|
@ -82,6 +94,8 @@ class Atlas4 : public AtlasDemo
|
|||
{
|
||||
float _time;
|
||||
public:
|
||||
CREATE_FUNC(Atlas4);
|
||||
|
||||
Atlas4();
|
||||
virtual void step(float dt);
|
||||
virtual void draw();
|
||||
|
@ -93,6 +107,8 @@ public:
|
|||
class Atlas5 : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Atlas5);
|
||||
|
||||
Atlas5();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -102,6 +118,8 @@ public:
|
|||
class Atlas6 : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Atlas6);
|
||||
|
||||
Atlas6();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -110,6 +128,8 @@ public:
|
|||
class AtlasBitmapColor : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(AtlasBitmapColor);
|
||||
|
||||
AtlasBitmapColor();
|
||||
virtual std::string title();
|
||||
|
||||
|
@ -119,6 +139,8 @@ public:
|
|||
class AtlasFastBitmap : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(AtlasFastBitmap);
|
||||
|
||||
AtlasFastBitmap();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -127,6 +149,8 @@ public:
|
|||
class BitmapFontMultiLine : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(BitmapFontMultiLine);
|
||||
|
||||
BitmapFontMultiLine();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -135,6 +159,8 @@ public:
|
|||
class LabelsEmpty : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelsEmpty);
|
||||
|
||||
LabelsEmpty();
|
||||
void updateStrings(float dt);
|
||||
virtual std::string title();
|
||||
|
@ -147,6 +173,8 @@ private:
|
|||
class LabelBMFontHD : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelBMFontHD);
|
||||
|
||||
LabelBMFontHD();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -155,6 +183,8 @@ public:
|
|||
class LabelAtlasHD : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelAtlasHD);
|
||||
|
||||
LabelAtlasHD();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -163,6 +193,8 @@ public:
|
|||
class LabelGlyphDesigner : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelGlyphDesigner);
|
||||
|
||||
LabelGlyphDesigner();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -171,12 +203,16 @@ public:
|
|||
class AtlasTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(AtlasTestScene);
|
||||
|
||||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class LabelTTFTest : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFTest);
|
||||
|
||||
LabelTTFTest();
|
||||
virtual ~LabelTTFTest();
|
||||
virtual std::string title();
|
||||
|
@ -199,6 +235,8 @@ private:
|
|||
class LabelTTFMultiline : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFMultiline);
|
||||
|
||||
LabelTTFMultiline();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -207,6 +245,8 @@ public:
|
|||
class LabelTTFChinese : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFChinese);
|
||||
|
||||
LabelTTFChinese();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -214,6 +254,8 @@ public:
|
|||
class LabelBMFontChinese : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelBMFontChinese);
|
||||
|
||||
LabelBMFontChinese();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -221,6 +263,8 @@ public:
|
|||
class BitmapFontMultiLineAlignment : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(BitmapFontMultiLineAlignment);
|
||||
|
||||
BitmapFontMultiLineAlignment();
|
||||
~BitmapFontMultiLineAlignment();
|
||||
void snapArrowsToEdge();
|
||||
|
@ -243,6 +287,8 @@ public:
|
|||
class LabelTTFA8Test : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFA8Test);
|
||||
|
||||
LabelTTFA8Test();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -252,6 +298,8 @@ public:
|
|||
class BMFontOneAtlas : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(BMFontOneAtlas);
|
||||
|
||||
BMFontOneAtlas();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -261,6 +309,8 @@ public:
|
|||
class BMFontUnicode : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(BMFontUnicode);
|
||||
|
||||
BMFontUnicode();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -270,6 +320,8 @@ public:
|
|||
class BMFontInit : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(BMFontInit);
|
||||
|
||||
BMFontInit();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -279,6 +331,8 @@ public:
|
|||
class TTFFontInit : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(TTFFontInit);
|
||||
|
||||
TTFFontInit();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -288,6 +342,8 @@ public:
|
|||
class TTFFontShadowAndStroke : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(TTFFontShadowAndStroke);
|
||||
|
||||
TTFFontShadowAndStroke();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -298,6 +354,8 @@ public:
|
|||
class Issue1343 : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1343);
|
||||
|
||||
Issue1343();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -307,6 +365,8 @@ public:
|
|||
class LabelBMFontBounds : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelBMFontBounds);
|
||||
|
||||
LabelBMFontBounds();
|
||||
|
||||
virtual void draw();
|
||||
|
@ -319,7 +379,8 @@ private:
|
|||
class NewLabelTTFUnicode : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
|
||||
CREATE_FUNC(NewLabelTTFUnicode);
|
||||
|
||||
NewLabelTTFUnicode();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -329,6 +390,7 @@ public:
|
|||
class NewLabelBMFontTest : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(NewLabelBMFontTest);
|
||||
|
||||
NewLabelBMFontTest();
|
||||
|
||||
|
@ -341,6 +403,7 @@ private:
|
|||
class NewLabelFontDefTest : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(NewLabelFontDefTest);
|
||||
|
||||
NewLabelFontDefTest();
|
||||
|
||||
|
@ -353,6 +416,8 @@ private:
|
|||
class LabelBMFontCrashTest : public AtlasDemo
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelBMFontCrashTest);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
|
|
@ -74,8 +74,6 @@ Layer* nextAtlasActionNew()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -87,16 +85,12 @@ Layer* backAtlasActionNew()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
Layer* restartAtlasActionNew()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ class AtlasDemoNew : public BaseTest
|
|||
protected:
|
||||
|
||||
public:
|
||||
CREATE_FUNC(AtlasDemoNew);
|
||||
|
||||
AtlasDemoNew(void);
|
||||
~AtlasDemoNew(void);
|
||||
|
||||
|
@ -25,6 +27,8 @@ public:
|
|||
class LabelTTFAlignmentNew : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFAlignmentNew);
|
||||
|
||||
LabelTTFAlignmentNew();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -34,6 +38,8 @@ class LabelFNTColorAndOpacity : public AtlasDemoNew
|
|||
{
|
||||
float _time;
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTColorAndOpacity);
|
||||
|
||||
LabelFNTColorAndOpacity();
|
||||
|
||||
virtual void step(float dt);
|
||||
|
@ -46,6 +52,8 @@ class LabelFNTSpriteActions : public AtlasDemoNew
|
|||
{
|
||||
float _time;
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTSpriteActions);
|
||||
|
||||
LabelFNTSpriteActions();
|
||||
virtual void step(float dt);
|
||||
virtual void draw();
|
||||
|
@ -57,6 +65,8 @@ public:
|
|||
class LabelFNTPadding : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTPadding);
|
||||
|
||||
LabelFNTPadding();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -66,6 +76,8 @@ public:
|
|||
class LabelFNTOffset : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTOffset);
|
||||
|
||||
LabelFNTOffset();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -74,6 +86,8 @@ public:
|
|||
class LabelFNTColor : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTColor);
|
||||
|
||||
LabelFNTColor();
|
||||
virtual std::string title();
|
||||
|
||||
|
@ -83,6 +97,8 @@ public:
|
|||
class LabelFNTHundredLabels : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTHundredLabels);
|
||||
|
||||
LabelFNTHundredLabels();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -91,6 +107,8 @@ public:
|
|||
class LabelFNTMultiLine : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTMultiLine);
|
||||
|
||||
LabelFNTMultiLine();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -99,6 +117,8 @@ public:
|
|||
class LabelFNTandTTFEmpty : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTandTTFEmpty);
|
||||
|
||||
LabelFNTandTTFEmpty();
|
||||
void updateStrings(float dt);
|
||||
virtual std::string title();
|
||||
|
@ -111,6 +131,8 @@ private:
|
|||
class LabelFNTRetina : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTRetina);
|
||||
|
||||
LabelFNTRetina();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -119,6 +141,8 @@ public:
|
|||
class LabelFNTGlyphDesigner : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTGlyphDesigner);
|
||||
|
||||
LabelFNTGlyphDesigner();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -127,12 +151,16 @@ public:
|
|||
class AtlasTestSceneNew : public TestScene
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(AtlasTestSceneNew);
|
||||
|
||||
virtual void runThisTest();
|
||||
};
|
||||
|
||||
class LabelTTFUnicodeChinese : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFUnicodeChinese);
|
||||
|
||||
LabelTTFUnicodeChinese();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -141,6 +169,8 @@ public:
|
|||
class LabelFNTUnicodeChinese : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTUnicodeChinese);
|
||||
|
||||
LabelFNTUnicodeChinese();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -149,6 +179,8 @@ public:
|
|||
class LabelFNTMultiLineAlignment : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTMultiLineAlignment);
|
||||
|
||||
LabelFNTMultiLineAlignment();
|
||||
~LabelFNTMultiLineAlignment();
|
||||
void snapArrowsToEdge();
|
||||
|
@ -171,6 +203,8 @@ public:
|
|||
class LabelFNTUNICODELanguages : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTUNICODELanguages);
|
||||
|
||||
LabelFNTUNICODELanguages();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -180,6 +214,8 @@ public:
|
|||
class LabelFNTBounds : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFNTBounds);
|
||||
|
||||
LabelFNTBounds();
|
||||
|
||||
virtual void draw();
|
||||
|
@ -192,6 +228,7 @@ private:
|
|||
class LabelTTFLongLineWrapping : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFLongLineWrapping);
|
||||
|
||||
LabelTTFLongLineWrapping();
|
||||
|
||||
|
@ -202,6 +239,7 @@ public:
|
|||
class LabelTTFColor : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFColor);
|
||||
|
||||
LabelTTFColor();
|
||||
|
||||
|
@ -212,7 +250,8 @@ public:
|
|||
class LabelTTFUnicodeNew : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
|
||||
CREATE_FUNC(LabelTTFUnicodeNew);
|
||||
|
||||
LabelTTFUnicodeNew();
|
||||
|
||||
virtual std::string title();
|
||||
|
@ -222,7 +261,8 @@ public:
|
|||
class LabelTTFDynamicAlignment : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
|
||||
CREATE_FUNC(LabelTTFDynamicAlignment);
|
||||
|
||||
LabelTTFDynamicAlignment();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -243,6 +283,7 @@ private:
|
|||
class LabelTTFFontsTestNew : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelTTFFontsTestNew);
|
||||
|
||||
LabelTTFFontsTestNew();
|
||||
|
||||
|
@ -254,6 +295,7 @@ public:
|
|||
class LabelBMFontTestNew : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelBMFontTestNew);
|
||||
|
||||
LabelBMFontTestNew();
|
||||
|
||||
|
@ -266,6 +308,7 @@ private:
|
|||
class LabelFontDefTestNew : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelFontDefTestNew);
|
||||
|
||||
LabelFontDefTestNew();
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@ static Layer* nextAction()
|
|||
sceneIdx++;
|
||||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -47,16 +45,12 @@ static Layer* backAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
static Layer* restartAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -156,23 +150,22 @@ void LayerTestCascadingOpacityA::onEnter()
|
|||
label->setPosition( Point( s.width/2, s.height/2));
|
||||
|
||||
layer1->runAction(
|
||||
RepeatForever::create(
|
||||
Sequence::create(
|
||||
FadeTo::create(4, 0),
|
||||
FadeTo::create(4, 255),
|
||||
DelayTime::create(1),
|
||||
NULL)));
|
||||
|
||||
RepeatForever::create(
|
||||
Sequence::create(
|
||||
FadeTo::create(4, 0),
|
||||
FadeTo::create(4, 255),
|
||||
DelayTime::create(1),
|
||||
NULL)));
|
||||
|
||||
sister1->runAction(
|
||||
RepeatForever::create(
|
||||
Sequence::create(
|
||||
FadeTo::create(2, 0),
|
||||
FadeTo::create(2, 255),
|
||||
FadeTo::create(2, 0),
|
||||
FadeTo::create(2, 255),
|
||||
DelayTime::create(1),
|
||||
NULL)));
|
||||
|
||||
RepeatForever::create(
|
||||
Sequence::create(
|
||||
FadeTo::create(2, 0),
|
||||
FadeTo::create(2, 255),
|
||||
FadeTo::create(2, 0),
|
||||
FadeTo::create(2, 255),
|
||||
DelayTime::create(1),
|
||||
NULL)));
|
||||
|
||||
// Enable cascading in scene
|
||||
setEnableRecursiveCascading(this, true);
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
class LayerTestCascadingOpacityA : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTestCascadingOpacityA);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -33,6 +34,7 @@ public:
|
|||
class LayerTestCascadingOpacityB : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTestCascadingOpacityB);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -40,6 +42,7 @@ public:
|
|||
class LayerTestCascadingOpacityC : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTestCascadingOpacityC);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -47,6 +50,7 @@ public:
|
|||
class LayerTestCascadingColorA : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTestCascadingColorA);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -54,6 +58,7 @@ public:
|
|||
class LayerTestCascadingColorB : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTestCascadingColorB);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -61,6 +66,7 @@ public:
|
|||
class LayerTestCascadingColorC : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTestCascadingColorC);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -69,6 +75,8 @@ public:
|
|||
class LayerTest1 : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTest1);
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
|
||||
|
@ -82,6 +90,7 @@ public:
|
|||
class LayerTest2 : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTest2);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -90,6 +99,8 @@ public:
|
|||
class LayerTestBlend : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerTestBlend);
|
||||
|
||||
LayerTestBlend();
|
||||
void newBlend(float dt);
|
||||
virtual std::string title();
|
||||
|
@ -98,6 +109,7 @@ public:
|
|||
class LayerGradientTest : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerGradientTest);
|
||||
LayerGradientTest();
|
||||
void onTouchesMoved(const std::vector<Touch*>& touches, Event *event);
|
||||
virtual std::string title();
|
||||
|
@ -108,6 +120,7 @@ public:
|
|||
class LayerGradientTest2 : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerGradientTest2);
|
||||
LayerGradientTest2();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -116,6 +129,7 @@ public:
|
|||
class LayerGradientTest3 : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerGradientTest3);
|
||||
LayerGradientTest3();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
@ -124,6 +138,7 @@ public:
|
|||
class LayerIgnoreAnchorPointPos : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerIgnoreAnchorPointPos);
|
||||
virtual void onEnter();
|
||||
void onToggle(Object* pObject);
|
||||
virtual std::string title();
|
||||
|
@ -133,6 +148,7 @@ public:
|
|||
class LayerIgnoreAnchorPointRot : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerIgnoreAnchorPointRot);
|
||||
virtual void onEnter();
|
||||
void onToggle(Object* pObject);
|
||||
virtual std::string title();
|
||||
|
@ -142,6 +158,7 @@ public:
|
|||
class LayerIgnoreAnchorPointScale : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerIgnoreAnchorPointScale);
|
||||
virtual void onEnter();
|
||||
void onToggle(Object* pObject);
|
||||
virtual std::string title();
|
||||
|
@ -151,6 +168,7 @@ public:
|
|||
class LayerExtendedBlendOpacityTest : public LayerTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerExtendedBlendOpacityTest);
|
||||
LayerExtendedBlendOpacityTest();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
|
|
@ -28,8 +28,6 @@ Layer* nextMotionAction()
|
|||
sceneIdx = sceneIdx % MAX_LAYER;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -41,16 +39,12 @@ Layer* backMotionAction()
|
|||
sceneIdx += total;
|
||||
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
Layer* restartMotionAction()
|
||||
{
|
||||
auto layer = (createFunctions[sceneIdx])();
|
||||
layer->autorelease();
|
||||
|
||||
return layer;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -32,6 +32,7 @@ protected:
|
|||
Node* _target;
|
||||
|
||||
public:
|
||||
CREATE_FUNC(MotionStreakTest1);
|
||||
virtual void onEnter();
|
||||
void onUpdate(float delta);
|
||||
virtual std::string title();
|
||||
|
@ -44,6 +45,7 @@ protected:
|
|||
Node* _target;
|
||||
|
||||
public:
|
||||
CREATE_FUNC(MotionStreakTest2);
|
||||
virtual void onEnter();
|
||||
void onTouchesMoved(const std::vector<Touch*>& touches, Event* event);
|
||||
virtual std::string title();
|
||||
|
@ -52,6 +54,8 @@ public:
|
|||
class Issue1358 : public MotionStreakTest
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(Issue1358);
|
||||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void onEnter();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue