Merge branch 'v3' of github.com:cocos2d/cocos2d-x into v3

This commit is contained in:
calfjohn 2015-03-18 20:10:16 +08:00
commit e67a57512f
25 changed files with 1361 additions and 459 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,12 +39,19 @@ class NodeGrid;
* @{
*/
/** @brief Base class for Grid actions */
/**
@class GridAction
@brief Base class for Grid actions.
@detail Grid actions are the actions take effect on GridBase.
*/
class CC_DLL GridAction : public ActionInterval
{
public:
/** returns the grid */
/**
@brief Get the pointer of GridBase.
@return The pointer of GridBase.
*/
virtual GridBase* getGrid();
// overrides
@ -60,8 +67,10 @@ CC_CONSTRUCTOR_ACCESS:
GridAction() {}
virtual ~GridAction() {}
/**
* initializes the action with size and duration
* @param duration in seconds
* @brief Initializes the action with size and duration.
* @param duration The duration of the GridAction. It's a value in seconds.
* @param gridSize The size of the GridAction should be.
* @return Return true when the initialization success, otherwise return false.
*/
bool initWithDuration(float duration, const Size& gridSize);
@ -78,15 +87,18 @@ private:
/**
@brief Base class for Grid3D actions.
Grid3D actions can modify a non-tiled grid.
@detail Grid3D actions can modify a non-tiled grid.
*/
class CC_DLL Grid3DAction : public GridAction
{
public:
/** returns the grid */
virtual GridBase* getGrid() override;
/** returns the vertex than belongs to certain position in the grid
/**
* @brief Get the vertex that belongs to certain position in the grid.
* @param position The position of the grid.
* @return Return a pointer of vertex.
* @js NA
* @lua NA
*/
@ -98,7 +110,10 @@ public:
*/
CC_DEPRECATED_ATTRIBUTE inline Vec3 vertex(const Vec2& position) { return getVertex(position); }
/** returns the non-transformed vertex than belongs to certain position in the grid
/**
* @brief Get the non-transformed vertex that belongs to certain position in the grid.
* @param position The position of the grid.
* @return Return a pointer of vertex.
* @js NA
* @lua NA
*/
@ -110,7 +125,10 @@ public:
*/
CC_DEPRECATED_ATTRIBUTE inline Vec3 originalVertex(const Vec2& position) { return getOriginalVertex(position); }
/** sets a new vertex to a certain position of the grid
/**
* @brief Set a new vertex to a certain position of the grid.
* @param position The position of the grid.
* @param vertex The vertex will be used on the certain position of grid.
* @js NA
* @lua NA
*/
@ -124,17 +142,26 @@ public:
}
};
/** @brief Base class for TiledGrid3D actions */
/**
@brief Base class for TiledGrid3D actions
*/
class CC_DLL TiledGrid3DAction : public GridAction
{
public:
/** creates the action with size and duration
/**
* @brief Create the action with size and duration.
* @param duration The duration of the action. It's a value in seconds.
* @param gridSize Specify the grid size of the action.
* @return A pointer of TiledGrid3DAction. If creation failed, return nil.
* @js NA
* @lua NA
*/
static TiledGrid3DAction* create(float duration, const Size& gridSize);
/** returns the tile that belongs to a certain position of the grid
/**
* @brief Get the tile that belongs to a certain position of the grid.
* @param position The position of the tile want to get.
* @return A quadrilateral of the tile.
* @js NA
* @lua NA
*/
@ -146,19 +173,25 @@ public:
*/
CC_DEPRECATED_ATTRIBUTE Quad3 tile(const Vec2& position) { return getTile(position); }
/** returns the non-transformed tile that belongs to a certain position of the grid
/**
* @brief Get the non-transformed tile that belongs to a certain position of the grid.
* @param position The position of the tile want to get.
* @return A quadrilateral of the tile.
* @js NA
* @lua NA
*/
Quad3 getOriginalTile(const Vec2& position) const;
/** @deprecated Use getOriginalTile() instead
/** @deprecated Use getOriginalTile() instead.
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Quad3 originalTile(const Vec2& position) { return getOriginalTile(position); }
/** sets a new tile to a certain position of the grid
/**
* @brief Set a new tile to a certain position of the grid.
* @param position The position of the tile.
* @param coords The quadrilateral of the new tile.
* @js NA
* @lua NA
*/
@ -175,23 +208,33 @@ public:
}
};
/** @brief AccelDeccelAmplitude action */
/**
@brief AccelDeccelAmplitude action.
*/
class CC_DLL AccelDeccelAmplitude : public ActionInterval
{
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
/**
@brief Create the action with an inner action that has the amplitude property, and a duration time.
@@param action A pointer of the inner action.
@param duration Specify the duration of the AccelDeccelAmplitude action.
@return Return a pointer of AccelDeccelAmplitude action. When the creation failed, return nil.
*/
static AccelDeccelAmplitude* create(Action *action, float duration);
/** get amplitude rate */
/**
@brief Get the value of amplitude rate.
@return the value of amplitude rate.
*/
inline float getRate(void) const { return _rate; }
/** set amplitude rate */
/**
@brief Set the value of amplitude rate.
@param rate Specify the value of amplitude rate.
*/
inline void setRate(float rate) { _rate = rate; }
// Overrides
virtual void startWithTarget(Node *target) override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
virtual AccelDeccelAmplitude* clone() const override;
virtual AccelDeccelAmplitude* reverse() const override;
@ -200,7 +243,12 @@ CC_CONSTRUCTOR_ACCESS:
AccelDeccelAmplitude() {}
virtual ~AccelDeccelAmplitude();
/** initializes the action with an inner action that has the amplitude property, and a duration time */
/**
@brief Initializes the action with an inner action that has the amplitude property, and a duration time.
@param action A pointer of the inner action.
@param duration Specify the duration of the AccelDeccelAmplitude action.
@return If the initialization success, return true; otherwise, return false.
*/
bool initWithAction(Action *action, float duration);
protected:
@ -211,23 +259,33 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
};
/** @brief AccelAmplitude action */
/**
@brief AccelAmplitude action.
*/
class CC_DLL AccelAmplitude : public ActionInterval
{
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
/**
@brief Create the action with an inner action that has the amplitude property, and a duration time.
@param action A pointer of the inner action.
@param duration Specify the duration of the AccelAmplitude action.
@return Return a pointer of AccelAmplitude action. When the creation failed, return nil.
*/
static AccelAmplitude* create(Action *action, float duration);
/** get amplitude rate */
/**
@brief Get the value of amplitude rate.
@return The value of amplitude rate.
*/
inline float getRate() const { return _rate; }
/** set amplitude rate */
/**
@brief Set the value of amplitude rate.
@param rate Specify the value of amplitude rate.
*/
inline void setRate(float rate) { _rate = rate; }
// Overrides
virtual void startWithTarget(Node *target) override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
virtual AccelAmplitude* clone() const override;
virtual AccelAmplitude* reverse() const override;
@ -246,23 +304,33 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
};
/** @brief DeccelAmplitude action */
/**
@brief DeccelAmplitude action
*/
class CC_DLL DeccelAmplitude : public ActionInterval
{
public:
/** creates the action with an inner action that has the amplitude property, and a duration time */
/**
@brief Creates the action with an inner action that has the amplitude property, and a duration time.
@param action A pointer of the inner action.
@param duration Specify the duration of the DeccelAmplitude action.
@return Return a pointer of DeccelAmplitude. When the creation failed, return nil.
*/
static DeccelAmplitude* create(Action *action, float duration);
/** get amplitude rate */
/**
@brief Get the value of amplitude rate.
@return The value of amplitude rate.
*/
inline float getRate() const { return _rate; }
/** set amplitude rate */
/**
@brief Set the value of amplitude rate.
@param rate Specify the value.
*/
inline void setRate(float rate) { _rate = rate; }
// overrides
virtual void startWithTarget(Node *target) override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
virtual DeccelAmplitude* clone() const override;
virtual DeccelAmplitude* reverse() const override;
@ -271,7 +339,12 @@ CC_CONSTRUCTOR_ACCESS:
DeccelAmplitude() {}
virtual ~DeccelAmplitude();
/** initializes the action with an inner action that has the amplitude property, and a duration time */
/**
@brief Initializes the action with an inner action that has the amplitude property, and a duration time.
@param action The pointer of inner action.
@param duration The duration of the DeccelAmplitude action.
@return If the initilization sucess, return true; otherwise, return false.
*/
bool initWithAction(Action *action, float duration);
protected:
@ -282,7 +355,8 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
};
/** @brief StopGrid action.
/**
@brief StopGrid action.
@warning Don't call this action if another grid action is active.
Call if you want to remove the the grid effect. Example:
Sequence::actions(Lens::action(...), StopGrid::action(...), nullptr);
@ -290,7 +364,10 @@ private:
class CC_DLL StopGrid : public ActionInstant
{
public:
/** Allocates and initializes the action */
/**
@brief Create a StopGrid Action.
@return Return a pointer of StopGrid. When the creation failed, return nil.
*/
static StopGrid* create();
// Overrides
@ -311,11 +388,17 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(StopGrid);
};
/** @brief ReuseGrid action */
/**
@brief ReuseGrid action.
*/
class CC_DLL ReuseGrid : public ActionInstant
{
public:
/** creates an action with the number of times that the current grid will be reused */
/**
@brief Create an action with the number of times that the current grid will be reused.
@param times Specify times the grid will be reused.
@return Return a pointer of ReuseGrid. When the creation failed, return nil.
*/
static ReuseGrid* create(int times);
// Override
@ -327,7 +410,11 @@ CC_CONSTRUCTOR_ACCESS:
ReuseGrid() {}
virtual ~ReuseGrid() {}
/** initializes an action with the number of times that the current grid will be reused */
/**
@brief Initializes an action with the number of times that the current grid will be reused.
@param times Specify times the grid will be reused.
@return If the initialization sucess, return true; otherwise, return false.
*/
bool initWithTimes(int times);
protected:

View File

@ -36,36 +36,62 @@ NS_CC_BEGIN
*/
/**
@brief Waves3D action
@brief Waves3D action.
@detail This action is used for take effect on the target node as 3D waves.
You can control the effect by these parameters:
duration, grid size, waves count, amplitude.
*/
class CC_DLL Waves3D : public Grid3DAction
{
public:
/** creates an action with duration, grid size, waves and amplitude */
/**
@brief Create an action with duration, grid size, waves and amplitude.
@param duration Specify the duration of the Waves3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param waves Specify the waves count of the Waves3D action.
@param amplitude Specify the amplitude of the Waves3D action.
@return If the creation sucess, return a pointer of Waves3D action; otherwise, return nil.
*/
static Waves3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
/** returns the amplitude of the effect */
/**
@brief Get the amplitude of the effect.
@return Return the amplitude of the effect.
*/
inline float getAmplitude() const { return _amplitude; }
/** sets the amplitude to the effect */
/**
@brief Set the amplitude to the effect.
@param amplitude The value of amplitude will be set.
*/
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
/** returns the amplitude rate */
/**
@brief Get the amplitude rate of the effect.
@return Return the amplitude rate of the effect.
*/
inline float getAmplitudeRate() const { return _amplitudeRate; }
/** sets the ampliture rate */
/**
@brief Set the ampliture rate of the effect.
@param amplitudeRate The value of amplitude rate will be set.
*/
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
// Overrides
virtual Waves3D* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
Waves3D() {}
virtual ~Waves3D() {}
/** initializes an action with duration, grid size, waves and amplitude */
/**
@brief Initializes an action with duration, grid size, waves and amplitude.
@param duration Specify the duration of the Waves3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param waves Specify the waves count of the Waves3D action.
@param amplitude Specify the amplitude of the Waves3D action.
@return If the initialization success, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
protected:
@ -77,43 +103,62 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Waves3D);
};
/** @brief FlipX3D action */
/**
@brief FlipX3D action.
@detail This action is used for flipping the target node on the x axis.
*/
class CC_DLL FlipX3D : public Grid3DAction
{
public:
/** creates the action with duration */
/**
@brief Create the action with duration.
@param duration Specify the duration of the FilpX3D action. It's a value in seconds.
@return If the creation sucess, return a pointer of FilpX3D action; otherwise, return nil.
*/
static FlipX3D* create(float duration);
// Override
virtual FlipX3D* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
FlipX3D() {}
virtual ~FlipX3D() {}
/** initializes the action with duration */
/**
@brief Initializes an action with duration.
@param duration Specify the duration of the FlipX3D action. It's a value in seconds.
@return If the initialization success, return true; otherwise, return false.
*/
bool initWithDuration(float duration);
/**
@brief Initializes an action with duration and grid size.
@param gridSize Specify the grid size of the FlipX3D action.
@param duration Specify the duration of the FlipX3D action. It's a value in seconds.
@return If the initialization success, return true; otherwise, return false.
*/
virtual bool initWithSize(const Size& gridSize, float duration);
private:
CC_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
};
/** @brief FlipY3D action */
/**
@brief FlipY3D action.
@detail This action is used for flipping the target node on the y axis.
*/
class CC_DLL FlipY3D : public FlipX3D
{
public:
/** creates the action with duration */
/**
@brief Create the action with duration.
@param duration Specify the duration of the FlipY3D action. It's a value in seconds.
@return If the creation sucess, return a pointer of FlipY3D action; otherwise, return nil.
*/
static FlipY3D* create(float duration);
// Overrides
/**
* @param time in seconds
*/
virtual void update(float time) override;
virtual FlipY3D* clone() const override;
@ -124,35 +169,72 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
};
/** @brief Lens3D action */
/**
@brief Lens3D action.
@detail This action is used for take effect on the target node as lens.
You can create the action by these parameters:
duration, grid size, center position of lens, radius of lens.
Also you can change the lens effect value & whether effect is concave by the setter methods.
*/
class CC_DLL Lens3D : public Grid3DAction
{
public:
/** creates the action with center position, radius, a grid size and duration */
/**
@brief Create the action with center position, radius, a grid size and duration.
@param duration Specify the duration of the Lens3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param position Specify the center position of the lens.
@param radius Specify the radius of the lens.
@return If the creation sucess, return a pointer of Lens3D action; otherwise, return nil.
*/
static Lens3D* create(float duration, const Size& gridSize, const Vec2& position, float radius);
/** Get lens center position */
/**
@brief Get the value of lens effect. Default value is 0.7.
@return The value of lens effect.
*/
inline float getLensEffect() const { return _lensEffect; }
/** Set lens center position */
/**
@brief Set the value of lens effect.
@param lensEffect The value of lens effect will be set.
*/
inline void setLensEffect(float lensEffect) { _lensEffect = lensEffect; }
/** Set whether lens is concave */
/**
@brief Set whether lens is concave.
@param concave Whether lens is concave.
*/
inline void setConcave(bool concave) { _concave = concave; }
/**
@brief Get the center position of lens effect.
@return The center position of lens effect.
*/
inline const Vec2& getPosition() const { return _position; }
/**
@brief Set the center position of lens effect.
@param The center position will be set.
*/
void setPosition(const Vec2& position);
// Overrides
virtual Lens3D* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
Lens3D() {}
virtual ~Lens3D() {}
/** initializes the action with center position, radius, a grid size and duration */
/**
@brief Initializes the action with center position, radius, grid size and duration.
@param duration Specify the duration of the Lens3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param position Specify the center position of the lens effect.
@param radius Specify the radius of the lens effect.
@return If the initialization success, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const Size& gridSize, const Vec2& position, float radius);
protected:
@ -170,36 +252,79 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Lens3D);
};
/** @brief Ripple3D action */
/**
@brief Ripple3D action.
@detail This action is used for take effect on the target node as ripple.
You can create the action by these parameters:
duration, grid size, center position of ripple,
radius of ripple, waves count, amplitude.
*/
class CC_DLL Ripple3D : public Grid3DAction
{
public:
/** creates the action with radius, number of waves, amplitude, a grid size and duration */
/**
@brief Create the action with center position, radius, number of waves, amplitude, a grid size and duration.
@param duration Specify the duration of the Ripple3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param position Specify the center position of the ripple effect.
@param radius Specify the radius of the ripple effect.
@param waves Specify the waves count of the ripple effect.
@param amplitude Specify the amplitude of the ripple effect.
@return If the creation sucess, return a pointer of Ripple3D action; otherwise, return nil.
*/
static Ripple3D* create(float duration, const Size& gridSize, const Vec2& position, float radius, unsigned int waves, float amplitude);
/** get center position */
/**
@brief Get the center position of ripple effect.
@return The center position of ripple effect.
*/
inline const Vec2& getPosition() const { return _position; }
/** set center position */
/**
@brief Set the center position of ripple effect.
@param position The center position of ripple effect will be set.
*/
void setPosition(const Vec2& position);
/**
@brief Get the amplitude of ripple effect.
@return The amplitude of ripple effect.
*/
inline float getAmplitude() const { return _amplitude; }
/**
@brief Set the amplitude of ripple effect.
@param fAmplitude The amplitude of ripple effect.
*/
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
/**
@brief Get the amplitude rate of ripple effect.
@return The amplitude rate of ripple effect.
*/
inline float getAmplitudeRate() const { return _amplitudeRate; }
/**
@brief Set the amplitude rate of ripple effect.
@param fAmplitudeRate The amplitude rate of ripple effect.
*/
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
// Override
virtual Ripple3D* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
Ripple3D() {}
virtual ~Ripple3D() {}
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
/**
@brief Initializes the action with center position, radius, number of waves, amplitude, a grid size and duration.
@param duration Specify the duration of the Ripple3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param position Specify the center position of the ripple effect.
@param radius Specify the radius of the ripple effect.
@param waves Specify the waves count of the ripple effect.
@param amplitude Specify the amplitude of the ripple effect.
@return If the initialization success, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const Size& gridSize, const Vec2& position, float radius, unsigned int waves, float amplitude);
protected:
@ -214,12 +339,24 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
};
/** @brief Shaky3D action */
/**
@brief Shaky3D action.
@detail This action is used for take effect on the target node as shaky.
You can create the action by these parameters:
duration, grid size, range, whether shake on the z axis.
*/
class CC_DLL Shaky3D : public Grid3DAction
{
public:
/** creates the action with a range, shake Z vertices, a grid and duration */
static Shaky3D* create(float duration, const Size& gridSize, int range, bool shakeZ);
/**
@brief Create the action with a range, shake Z vertices, a grid and duration.
@param duration Specify the duration of the Shaky3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param range Specify the range of the shaky effect.
@param shakeZ Specify whether shake on the z axis.
@return If the creation sucess, return a pointer of Shaky3D action; otherwise, return nil.
*/
static Shaky3D* create(float initWithDuration, const Size& gridSize, int range, bool shakeZ);
// Overrides
virtual Shaky3D* clone() const override;
@ -230,8 +367,12 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~Shaky3D() {}
/**
* initializes the action with a range, shake Z vertices, a grid and duration
* @param duration in seconds
@brief Initializes the action with a range, shake Z vertices, grid size and duration.
@param duration Specify the duration of the Shaky3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param range Specify the range of the shaky effect.
@param shakeZ Specify whether shake on the z axis.
@return If the Initialization sucess, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ);
@ -243,31 +384,63 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
};
/** @brief Liquid action */
/**
@brief Liquid action.
@detail This action is used for take effect on the target node as liquid.
You can create the action by these parameters:
duration, grid size, waves count, amplitude of the liquid effect.
*/
class CC_DLL Liquid : public Grid3DAction
{
public:
/** creates the action with amplitude, a grid and duration */
/**
@brief Create the action with amplitude, grid size, waves count and duration.
@param duration Specify the duration of the Liquid action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param waves Specify the waves count of the Liquid action.
@param amplitude Specify the amplitude of the Liquid action.
@return If the creation sucess, return a pointer of Liquid action; otherwise, return nil.
*/
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
/**
@brief Get the amplitude of the effect.
@return Return the amplitude of the effect.
*/
inline float getAmplitude() const { return _amplitude; }
/**
@brief Set the amplitude to the effect.
@param amplitude The value of amplitude will be set.
*/
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
/**
@brief Get the amplitude rate of the effect.
@return Return the amplitude rate of the effect.
*/
inline float getAmplitudeRate() const { return _amplitudeRate; }
/**
@brief Set the ampliture rate of the effect.
@param amplitudeRate The value of amplitude rate will be set.
*/
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
// Overrides
virtual Liquid* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
Liquid() {}
virtual ~Liquid() {}
/** initializes the action with amplitude, a grid and duration */
/**
@brief Initializes the action with amplitude, grid size, waves count and duration.
@param duration Specify the duration of the Liquid action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param waves Specify the waves count of the Liquid action.
@param amplitude Specify the amplitude of the Liquid action.
@return If the initialization sucess, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
protected:
@ -279,31 +452,68 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Liquid);
};
/** @brief Waves action */
/**
@brief Waves action.
@detail This action is used for take effect on the target node as waves.
You can control the effect by these parameters:
duration, grid size, waves count, amplitude,
whether waves on horizontal and whether waves on vertical.
*/
class CC_DLL Waves : public Grid3DAction
{
public:
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
/**
@brief Create the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration.
@param duration Specify the duration of the Waves action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param waves Specify the waves count of the Waves action.
@param amplitude Specify the amplitude of the Waves action.
@param horizontal Specify whether waves on horizontal.
@param vertical Specify whether waves on vertical.
@return If the creation sucess, return a pointer of Waves action; otherwise, return nil.
*/
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
/**
@brief Get the amplitude of the effect.
@return Return the amplitude of the effect.
*/
inline float getAmplitude() const { return _amplitude; }
/**
@brief Set the amplitude to the effect.
@param amplitude The value of amplitude will be set.
*/
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
/**
@brief Get the amplitude rate of the effect.
@return Return the amplitude rate of the effect.
*/
inline float getAmplitudeRate() const { return _amplitudeRate; }
/**
@brief Set the ampliture rate of the effect.
@param amplitudeRate The value of amplitude rate will be set.
*/
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
// Overrides
virtual Waves* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
Waves() {}
virtual ~Waves() {}
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
/**
@brief Initializes the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration.
@param duration Specify the duration of the Waves action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param waves Specify the waves count of the Waves action.
@param amplitude Specify the amplitude of the Waves action.
@param horizontal Specify whether waves on horizontal.
@param vertical Specify whether waves on vertical.
@return If the initialization sucess, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
protected:
@ -317,37 +527,77 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Waves);
};
/** @brief Twirl action */
/**
@brief Twirl action.
@detail This action is used for take effect on the target node as twirl.
You can control the effect by these parameters:
duration, grid size, center position, twirls count, amplitude.
*/
class CC_DLL Twirl : public Grid3DAction
{
public:
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
/**
@brief Create the action with center position, number of twirls, amplitude, a grid size and duration.
@param duration Specify the duration of the Twirl action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param position Specify the center position of the twirl action.
@param twirls Specify the twirls count of the Twirl action.
@param amplitude Specify the amplitude of the Twirl action.
@return If the creation sucess, return a pointer of Twirl action; otherwise, return nil.
*/
static Twirl* create(float duration, const Size& gridSize, Vec2 position, unsigned int twirls, float amplitude);
/** get twirl center */
/**
@brief Get the center position of twirl action.
@return The center position of twirl action.
*/
inline const Vec2& getPosition() const { return _position; }
/** set twirl center */
/**
@brief Set the center position of twirl action.
@param position The center position of twirl action will be set.
*/
void setPosition(const Vec2& position);
/**
@brief Get the amplitude of the effect.
@return Return the amplitude of the effect.
*/
inline float getAmplitude() const { return _amplitude; }
/**
@brief Set the amplitude to the effect.
@param amplitude The value of amplitude will be set.
*/
inline void setAmplitude(float amplitude) { _amplitude = amplitude; }
/**
@brief Get the amplitude rate of the effect.
@return Return the amplitude rate of the effect.
*/
inline float getAmplitudeRate() const { return _amplitudeRate; }
/**
@brief Set the ampliture rate of the effect.
@param amplitudeRate The value of amplitude rate will be set.
*/
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
// Overrides
virtual Twirl* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
Twirl() {}
virtual ~Twirl() {}
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
/**
@brief Initializes the action with center position, number of twirls, amplitude, a grid size and duration.
@param duration Specify the duration of the Twirl action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@param position Specify the center position of the twirl action.
@param twirls Specify the twirls count of the Twirl action.
@param amplitude Specify the amplitude of the Twirl action.
@return If the initialization sucess, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const Size& gridSize, Vec2 position, unsigned int twirls, float amplitude);
protected:

View File

@ -37,8 +37,8 @@ NS_CC_BEGIN
/**
@brief This action simulates a page turn from the bottom right hand corner of the screen.
It's not much use by itself but is used by the PageTurnTransition.
@detail It's not much use by itself but is used by the PageTurnTransition.
Based on an original paper by L Hong et al.
http://www.parc.com/publication/1638/turning-pages-of-3d-electronic-books.html
@ -48,14 +48,17 @@ class CC_DLL PageTurn3D : public Grid3DAction
{
public:
virtual GridBase* getGrid() override;
/** create the action */
/**
@brief Create an action with duration, grid size.
@param duration Specify the duration of the PageTurn3D action. It's a value in seconds.
@param gridSize Specify the size of the grid.
@return If the creation sucess, return a pointer of PageTurn3D action; otherwise, return nil.
*/
static PageTurn3D* create(float duration, const Size& gridSize);
// Overrides
virtual PageTurn3D* clone() const override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
};

View File

@ -36,15 +36,19 @@ NS_CC_BEGIN
*/
/**
@brief Progress to percentage
@brief Progress to percentage.
@detail This action show the target node from current percentage to the specified percentage.
You should specify the destination percentage when creating the action.
@since v0.99.1
*/
class CC_DLL ProgressTo : public ActionInterval
{
public:
/**
* Creates and initializes with a duration and a percent
* @param duration in seconds
* @brief Create and initializes with a duration and a destination percentage.
* @param duration Specify the duration of the ProgressTo action. It's a value in seconds.
* @param percent Specify the destination percentage.
* @return If the creation sucess, return a pointer of ProgressTo action; otherwise, return nil.
*/
static ProgressTo* create(float duration, float percent);
@ -54,9 +58,6 @@ public:
virtual ProgressTo* clone() const override;
virtual ProgressTo* reverse() const override;
virtual void startWithTarget(Node *target) override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
@ -64,8 +65,10 @@ CC_CONSTRUCTOR_ACCESS:
virtual ~ProgressTo() {}
/**
* Initializes with a duration and a percent
* @param duration in seconds
* @brief Initializes with a duration and destination percentage.
* @param duration Specify the duration of the ProgressTo action. It's a value in seconds.
* @param percent Specify the destination percentage.
* @return If the creation sucess, return true; otherwise, return false.
*/
bool initWithDuration(float duration, float percent);
@ -78,15 +81,18 @@ private:
};
/**
@brief Progress from a percentage to another percentage
@brief Progress from a percentage to another percentage.
@since v0.99.1
*/
class CC_DLL ProgressFromTo : public ActionInterval
{
public:
/**
* Creates and initializes the action with a duration, a "from" percentage and a "to" percentage
* @param duration in seconds
* @brief Create and initializes the action with a duration, a "from" percentage and a "to" percentage.
* @param duration Specify the duration of the ProgressFromTo action. It's a value in seconds.
* @param fromPercentage Specify the source percentage.
* @param toPercentage Specify the destination percentage.
* @return If the creation sucess, return a pointer of ProgressFromTo action; otherwise, return nil.
*/
static ProgressFromTo* create(float duration, float fromPercentage, float toPercentage);
@ -96,16 +102,19 @@ public:
virtual ProgressFromTo* clone() const override;
virtual ProgressFromTo* reverse() const override;
virtual void startWithTarget(Node *target) override;
/**
* @param time in seconds
*/
virtual void update(float time) override;
CC_CONSTRUCTOR_ACCESS:
ProgressFromTo() {}
virtual ~ProgressFromTo() {}
/** Initializes the action with a duration, a "from" percentage and a "to" percentage */
/**
* @brief Initializes the action with a duration, a "from" percentage and a "to" percentage.
* @param duration Specify the duration of the ProgressFromTo action. It's a value in seconds.
* @param fromPercentage Specify the source percentage.
* @param toPercentage Specify the destination percentage.
* @return If the creation sucess, return true; otherwise, return false.
*/
bool initWithDuration(float duration, float fromPercentage, float toPercentage);
protected:

View File

@ -35,6 +35,15 @@ NS_CC_BEGIN
* @{
*/
/**
@brief The delegate class for ActionTween.
@detail If you want to use ActionTween on a node.
You should implement the node follow these steps:
1. The node should be inherit from ActionTweenDelegate.
2. Override the virtual method updateTweenAction in the node.
Then once you running ActionTween on the node, the method updateTweenAction will be incoked.
*/
class CC_DLL ActionTweenDelegate
{
public:
@ -43,6 +52,12 @@ public:
* @lua NA
*/
virtual ~ActionTweenDelegate() {}
/**
@brief The callback function when ActionTween is running.
@param value The new value of the specified key.
@param key The key of property which should be updated.
*/
virtual void updateTweenAction(float value, const std::string& key) = 0;
};
@ -70,24 +85,29 @@ class CC_DLL ActionTween : public ActionInterval
{
public:
/**
* creates an initializes the action with the property name (key), and the from and to parameters.
* @param duration in seconds
* @brief Create and initializes the action with the property name (key), and the from and to parameters.
* @param duration The duration of the ActionTween. It's a value in seconds.
* @param key The key of property which should be updated.
* @param from The value of the specified property when the action begin.
* @param to The value of the specified property when the action end.
* @return If the creation success, return a pointer of ActionTween; otherwise, return nil.
*/
static ActionTween* create(float duration, const std::string& key, float from, float to);
// Overrides
void startWithTarget(Node *target) override;
/**
* @param dt in seconds
*/
void update(float dt) override;
ActionTween* reverse() const override;
ActionTween *clone() const override;
CC_CONSTRUCTOR_ACCESS:
/**
* initializes the action with the property name (key), and the from and to parameters.
* @param duration in seconds
* @brief Initializes the action with the property name (key), and the from and to parameters.
* @param duration The duration of the ActionTween. It's a value in seconds.
* @param key The key of property which should be updated.
* @param from The value of the specified property when the action begin.
* @param to The value of the specified property when the action end.
* @return If the initialization success, return true; otherwise, return false.
*/
bool initWithDuration(float duration, const std::string& key, float from, float to);

View File

@ -932,6 +932,8 @@ void Label::createSpriteWithFontDefinition()
texture->initWithString(_originalUTF8String.c_str(),_fontDefinition);
_textSprite = Sprite::createWithTexture(texture);
//set camera mask using label's camera mask, because _textSprite may be null when setting camera mask to label
_textSprite->setCameraMask(getCameraMask());
_textSprite->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
this->setContentSize(_textSprite->getContentSize());
texture->release();
@ -1073,6 +1075,8 @@ void Label::drawTextSprite(Renderer *renderer, uint32_t parentFlags)
{
_shadowNode->setBlendFunc(_blendFunc);
}
//set camera mask using label's mask. Because _shadowNode may be null when setting the label's camera mask
_shadowNode->setCameraMask(getCameraMask());
_shadowNode->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
_shadowNode->setColor(_shadowColor);
_shadowNode->setOpacity(_shadowOpacity * _displayedOpacity);

View File

@ -40,7 +40,7 @@ class CC_DLL AutoreleasePool
{
public:
/**
* @warn Don't create an auto release pool in heap, create it in stack.
* @warn Don't create an autorelease pool in heap, create it in stack.
* @js NA
* @lua NA
*/
@ -48,6 +48,11 @@ public:
/**
* Create an autorelease pool with specific name. This name is useful for debugging.
* @warn Don't create an autorelease pool in heap, create it in stack.
* @js NA
* @lua NA
*
* @param name The name of created autorelease pool.
*/
AutoreleasePool(const std::string &name);
@ -58,13 +63,13 @@ public:
~AutoreleasePool();
/**
* Add a given object to this pool.
* Add a given object to this autorelease pool.
*
* The same object may be added several times to the same pool; When the
* pool is destructed, the object's Ref::release() method will be called
* for each time it was added.
* The same object may be added several times to an autorelease pool. When the
* pool is destructed, the object's `Ref::release()` method will be called
* the same times as it was added.
*
* @param object The object to add to the pool.
* @param object The object to be added into the autorelease pool.
* @js NA
* @lua NA
*/
@ -73,8 +78,8 @@ public:
/**
* Clear the autorelease pool.
*
* Ref::release() will be called for each time the managed object is
* added to the pool.
* It will invoke each element's `release()` function.
*
* @js NA
* @lua NA
*/
@ -82,22 +87,34 @@ public:
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
/**
* Whether the pool is doing `clear` operation.
* Whether the autorelease pool is doing `clear` operation.
*
* @return True if autorelase pool is clearning, false if not.
*
* @js NA
* @lua NA
*/
bool isClearing() const { return _isClearing; };
#endif
/**
* Checks whether the pool contains the specified object.
* Checks whether the autorelease pool contains the specified object.
*
* @param object The object to be checked.
* @return True if the autorelease pool contains the object, false if not
* @js NA
* @lua NA
*/
bool contains(Ref* object) const;
/**
* Dump the objects that are put into autorelease pool. It is used for debugging.
* Dump the objects that are put into the autorelease pool. It is used for debugging.
*
* The result will look like:
* Object pointer address object id reference count
*
* @js NA
* @lua NA
*/
void dump();
@ -122,20 +139,16 @@ private:
#endif
};
/**
* @cond
*/
class CC_DLL PoolManager
{
public:
/**
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE static PoolManager* sharedPoolManager() { return getInstance(); }
static PoolManager* getInstance();
/**
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE static void purgePoolManager() { destroyInstance(); }
static void destroyInstance();
@ -147,10 +160,7 @@ public:
bool isObjectInPools(Ref* obj) const;
/**
* @js NA
* @lua NA
*/
friend class AutoreleasePool;
private:
@ -164,6 +174,9 @@ private:
std::vector<AutoreleasePool*> _releasePoolStack;
};
/**
* @endcond
*/
// end of base_nodes group
/// @}

View File

@ -33,28 +33,58 @@
NS_CC_BEGIN
/**
* @lua NA
*/
class CC_DLL Data
{
public:
/**
* This parameter is defined for convenient reference if a null Data object is needed.
*/
static const Data Null;
/**
* Constructor of Data.
*/
Data();
/**
* Copy constructor of Data.
*/
Data(const Data& other);
/**
* Copy constructor of Data.
*/
Data(Data&& other);
/**
* Destructor of Data.
*/
~Data();
// Assignment operator
/**
* Overroads of operator=.
*/
Data& operator= (const Data& other);
/**
* Overroads of operator=.
*/
Data& operator= (Data&& other);
/**
* @js NA
* @lua NA
* Gets internal bytes of Data. It will retrun the pointer directly used in Data, so don't delete it.
*
* @return Pointer of bytes used internal in Data.
*/
unsigned char* getBytes() const;
/**
* @js NA
* @lua NA
* Gets the size of the bytes.
*
* @return The size of bytes of Data.
*/
ssize_t getSize() const;
@ -74,10 +104,16 @@ public:
*/
void fastSet(unsigned char* bytes, const ssize_t size);
/** Clears data, free buffer and reset data size */
/**
* Clears data, free buffer and reset data size.
*/
void clear();
/** Check whether the data is null. */
/**
* Check whether the data is null.
*
* @return True if the the Data is null, false if not.
*/
bool isNull() const;
private:

View File

@ -41,8 +41,7 @@ class __Dictionary;
class __Set;
/**
* @addtogroup data_structures
* @{
* @cond
*/
/**
@ -106,8 +105,9 @@ private:
std::string _result;
};
// end of data_structure group
/// @}
/**
* @endcond
*/
NS_CC_END

View File

@ -248,8 +248,6 @@ void Director::setGLDefaultValues()
CCASSERT(_openGLView, "opengl view should not be null");
setAlphaBlending(true);
// FIXME: Fix me, should enable/disable depth test according the depth format as cocos2d-iphone did
// [self setDepthTest: view_.depthFormat];
setDepthTest(false);
setProjection(_projection);
}

View File

@ -62,67 +62,73 @@ class Camera;
class Console;
/**
@brief Class that creates and handles the main Window and manages how
and when to execute the Scenes.
The Director is also responsible for:
- initializing the OpenGL context
- setting the OpenGL pixel format (default on is RGB565)
- setting the OpenGL buffer depth (default one is 0-bit)
- setting the projection (default one is 3D)
- setting the orientation (default one is Portrait)
Since the Director is a singleton, the standard way to use it is by calling:
_ Director::getInstance()->methodName();
The Director also sets the default OpenGL context:
- GL_TEXTURE_2D is enabled
- GL_VERTEX_ARRAY is enabled
- GL_COLOR_ARRAY is enabled
- GL_TEXTURE_COORD_ARRAY is enabled
*/
* @brief Matrix stack type.
*/
enum class MATRIX_STACK_TYPE
{
/// Model view matrix stack
MATRIX_STACK_MODELVIEW,
/// projection matrix stack
MATRIX_STACK_PROJECTION,
/// texture matrix stack
MATRIX_STACK_TEXTURE
};
/**
@brief Class that creates and handles the main Window and manages how
and when to execute the Scenes.
The Director is also responsible for:
- initializing the OpenGL context
- setting the OpenGL buffer depth (default one is 0-bit)
- setting the projection (default one is 3D)
Since the Director is a singleton, the standard way to use it is by calling:
_ Director::getInstance()->methodName();
*/
class CC_DLL Director : public Ref
{
public:
/** Director will trigger an event when projection type is changed. */
static const char *EVENT_PROJECTION_CHANGED;
/** Director will trigger an event after Schedule::update() is invoked. */
static const char* EVENT_AFTER_UPDATE;
/** Director will trigger an event after Scene::render() is invoked. */
static const char* EVENT_AFTER_VISIT;
/** Director will trigger an event after a scene is drawn, the data is sent to GPU. */
static const char* EVENT_AFTER_DRAW;
/** @typedef ccDirectorProjection
Possible OpenGL projections used by director
/**
* @brief Possible OpenGL projections used by director
*/
enum class Projection
{
/// sets a 2D projection (orthogonal projection)
/// Sets a 2D projection (orthogonal projection).
_2D,
/// sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
/// Sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
_3D,
/// it calls "updateProjection" on the projection delegate.
/// It calls "updateProjection" on the projection delegate.
CUSTOM,
/// Default projection is 3D projection
/// Default projection is 3D projection.
DEFAULT = _3D,
};
/** returns a shared instance of the director */
/** Returns a shared instance of the director. */
static Director* getInstance();
/** @deprecated Use getInstance() instead */
/** @deprecated Use getInstance() instead. */
CC_DEPRECATED_ATTRIBUTE static Director* sharedDirector() { return Director::getInstance(); }
/**
* @js ctor
*/
Director(void);
Director();
/**
* @js NA
* @lua NA
@ -132,105 +138,128 @@ public:
// attribute
/** Get current running Scene. Director can only run one Scene at a time */
/** Gets current running Scene. Director can only run one Scene at a time. */
inline Scene* getRunningScene() { return _runningScene; }
/** Get the FPS value */
/** Gets the FPS value. */
inline double getAnimationInterval() { return _animationInterval; }
/** Set the FPS value. */
/** Sets the FPS value. FPS = 1/internal. */
virtual void setAnimationInterval(double interval) = 0;
/** Whether or not to display the FPS on the bottom-left corner */
/** Whether or not to display the FPS on the bottom-left corner. */
inline bool isDisplayStats() { return _displayStats; }
/** Display the FPS on the bottom-left corner */
/** Display the FPS on the bottom-left corner. */
inline void setDisplayStats(bool displayStats) { _displayStats = displayStats; }
/** seconds per frame */
/** Get seconds per frame. */
inline float getSecondsPerFrame() { return _secondsPerFrame; }
/** Get the GLView, where everything is rendered
/**
* Get the GLView.
* @js NA
* @lua NA
*/
inline GLView* getOpenGLView() { return _openGLView; }
/**
* Sets the GLView.
*
* @lua NA
* @js NA
*/
void setOpenGLView(GLView *openGLView);
/** Gets singleton of TextureCache. */
TextureCache* getTextureCache() const;
/** Whether or not `_nextDeltaTimeZero` is set to 0. */
inline bool isNextDeltaTimeZero() { return _nextDeltaTimeZero; }
/**
* Sets the detal time between current frame and next frame is 0.
* This value will be used in Schedule, and will affect all functions that are using frame detal time, such as Actions.
* This value will take effect only one time.
*/
void setNextDeltaTimeZero(bool nextDeltaTimeZero);
/** Whether or not the Director is paused */
/** Whether or not the Director is paused. */
inline bool isPaused() { return _paused; }
/** How many frames were called since the director started */
inline unsigned int getTotalFrames() { return _totalFrames; }
/** Sets an OpenGL projection
/** Gets an OpenGL projection.
@since v0.8.2
* @js NA
* @lua NA
*/
inline Projection getProjection() { return _projection; }
/** Sets OpenGL projection. */
void setProjection(Projection projection);
/** Sets the glViewport*/
/** Sets the glViewport.*/
void setViewport();
/** How many frames were called since the director started */
/** Whether or not the replaced scene will receive the cleanup message.
If the new scene is pushed, then the old scene won't receive the "cleanup" message.
If the new scene replaces the old one, the it will receive the "cleanup" message.
@since v0.99.0
* If the new scene is pushed, then the old scene won't receive the "cleanup" message.
* If the new scene replaces the old one, the it will receive the "cleanup" message.
* @since v0.99.0
*/
inline bool isSendCleanupToScene() { return _sendCleanupToScene; }
/** This object will be visited after the main scene is visited.
This object MUST implement the "visit" selector.
Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications)
@since v0.99.5
* This object MUST implement the "visit" function.
* Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications)
* @since v0.99.5
*/
Node* getNotificationNode() const { return _notificationNode; }
/**
* Sets the notification node.
* @see Director::getNotificationNode()
*/
void setNotificationNode(Node *node);
// window size
/** returns the size of the OpenGL view in points.
*/
/** Returns the size of the OpenGL view in points. */
const Size& getWinSize() const;
/** returns the size of the OpenGL view in pixels.
*/
/** Returns the size of the OpenGL view in pixels. */
Size getWinSizeInPixels() const;
/** returns visible size of the OpenGL view in points.
* the value is equal to getWinSize if don't invoke
* GLView::setDesignResolutionSize()
/**
* Returns visible size of the OpenGL view in points.
* The value is equal to `Director::getWinSize()` if don't invoke `GLView::setDesignResolutionSize()`.
*/
Size getVisibleSize() const;
/** returns visible origin of the OpenGL view in points.
*/
/** Returns visible origin coordinate of the OpenGL view in points. */
Vec2 getVisibleOrigin() const;
/** converts a UIKit coordinate to an OpenGL coordinate
Useful to convert (multi) touch coordinates to the current layout (portrait or landscape)
/**
* Converts a screen coordinate to an OpenGL coordinate.
* Useful to convert (multi) touch coordinates to the current layout (portrait or landscape).
*/
Vec2 convertToGL(const Vec2& point);
/** converts an OpenGL coordinate to a UIKit coordinate
Useful to convert node points to window points for calls such as glScissor
/**
* Converts an OpenGL coordinate to a screen coordinate.
* Useful to convert node points to window points for calls such as glScissor.
*/
Vec2 convertToUI(const Vec2& point);
/// FIXME: missing description
/**
* Gets the distance between camera and near clipping frane.
* It is correct for default camera that near clipping frane is the same as screen.
*/
float getZEye() const;
// Scene Management
/** Enters the Director's main loop with the given Scene.
/**
* Enters the Director's main loop with the given Scene.
* Call it to run only your FIRST scene.
* Don't call it if there is already a running scene.
*
@ -238,23 +267,26 @@ public:
*/
void runWithScene(Scene *scene);
/** Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
/**
* Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
* The new scene will be executed.
* Try to avoid big stacks of pushed scenes to reduce memory allocation.
* ONLY call it if there is a running scene.
*/
void pushScene(Scene *scene);
/** Pops out a scene from the stack.
/**
* Pops out a scene from the stack.
* This scene will replace the running one.
* The running scene will be deleted. If there are no more scenes in the stack the execution is terminated.
* ONLY call it if there is a running scene.
*/
void popScene();
/** Pops out all scenes from the stack until the root scene in the queue.
/**
* Pops out all scenes from the stack until the root scene in the queue.
* This scene will replace the running one.
* Internally it will call `popToSceneStackLevel(1)`
* Internally it will call `popToSceneStackLevel(1)`.
*/
void popToRootScene();
@ -271,132 +303,153 @@ public:
void replaceScene(Scene *scene);
/** Ends the execution, releases the running scene.
It doesn't remove the OpenGL view from its parent. You have to do it manually.
* @lua endToLua
*/
void end();
/** Pauses the running scene.
The running scene will be _drawed_ but all scheduled timers will be paused
While paused, the draw rate will be 4 FPS to reduce CPU consumption
* The running scene will be _drawed_ but all scheduled timers will be paused.
* While paused, the draw rate will be 4 FPS to reduce CPU consumption.
*/
void pause();
/** Resumes the paused scene
The scheduled timers will be activated again.
The "delta time" will be 0 (as if the game wasn't paused)
/** Resumes the paused scene.
* The scheduled timers will be activated again.
* The "delta time" will be 0 (as if the game wasn't paused).
*/
void resume();
/** Restart the director
*/
/** Restart the director. */
void restart();
/** Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore.
If you don't want to pause your animation call [pause] instead.
* If you don't want to pause your animation call [pause] instead.
*/
virtual void stopAnimation() = 0;
/** The main loop is triggered again.
Call this function only if [stopAnimation] was called earlier
@warning Don't call this function to start the main loop. To run the main loop call runWithScene
* Call this function only if [stopAnimation] was called earlier.
* @warning Don't call this function to start the main loop. To run the main loop call runWithScene.
*/
virtual void startAnimation() = 0;
/** Draw the scene.
This method is called every frame. Don't call it manually.
* This method is called every frame. Don't call it manually.
*/
void drawScene();
// Memory Helper
/** Removes all cocos2d cached data.
It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache
@since v0.99.3
* It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache
* @since v0.99.3
*/
void purgeCachedData();
/** sets the default values based on the Configuration info */
/** Sets the default values based on the Configuration info. */
void setDefaultValues();
// OpenGL Helper
/** sets the OpenGL default values */
/** Sets the OpenGL default values.
* It will enable alpha blending, disable depth test.
*/
void setGLDefaultValues();
/** enables/disables OpenGL alpha blending */
/** Enables/disables OpenGL alpha blending. */
void setAlphaBlending(bool on);
/** set clear values for the color buffers, value range of each element is [0.0, 1.0] */
/** Sets clear values for the color buffers, value range of each element is [0.0, 1.0]. */
void setClearColor(const Color4F& clearColor);
/** enables/disables OpenGL depth test */
/** Enables/disables OpenGL depth test. */
void setDepthTest(bool on);
virtual void mainLoop() = 0;
/** The size in pixels of the surface. It could be different than the screen size.
High-res devices might have a higher surface size than the screen size.
Only available when compiled using SDK >= 4.0.
@since v0.99.4
* High-res devices might have a higher surface size than the screen size.
* Only available when compiled using SDK >= 4.0.
* @since v0.99.4
*/
void setContentScaleFactor(float scaleFactor);
/**
* Gets content scale factor.
* @see Director::setContentScaleFactor()
*/
float getContentScaleFactor() const { return _contentScaleFactor; }
/** Gets the Scheduler associated with this director
@since v2.0
/** Gets the Scheduler associated with this director.
* @since v2.0
*/
Scheduler* getScheduler() const { return _scheduler; }
/** Sets the Scheduler associated with this director
@since v2.0
/** Sets the Scheduler associated with this director.
* @since v2.0
*/
void setScheduler(Scheduler* scheduler);
/** Gets the ActionManager associated with this director
@since v2.0
/** Gets the ActionManager associated with this director.
* @since v2.0
*/
ActionManager* getActionManager() const { return _actionManager; }
/** Sets the ActionManager associated with this director
@since v2.0
/** Sets the ActionManager associated with this director.
* @since v2.0
*/
void setActionManager(ActionManager* actionManager);
/** Gets the EventDispatcher associated with this director
@since v3.0
/** Gets the EventDispatcher associated with this director.
* @since v3.0
*/
EventDispatcher* getEventDispatcher() const { return _eventDispatcher; }
/** Sets the EventDispatcher associated with this director
@since v3.0
/** Sets the EventDispatcher associated with this director.
* @since v3.0
*/
void setEventDispatcher(EventDispatcher* dispatcher);
/** Returns the Renderer
@since v3.0
/** Returns the Renderer associated with this director.
* @since v3.0
*/
Renderer* getRenderer() const { return _renderer; }
/** Returns the Console
@since v3.0
/** Returns the Console associated with this director.
* @since v3.0
*/
Console* getConsole() const { return _console; }
/* Gets delta time since last tick to main loop */
/* Gets delta time since last tick to main loop. */
float getDeltaTime() const;
/**
* get Frame Rate
* Gets Frame Rate.
*/
float getFrameRate() const { return _frameRate; }
/** Clones a specified type matrix and put it to the top of specified type of matrix stack. */
void pushMatrix(MATRIX_STACK_TYPE type);
/** Pops the top matrix of the specified type of matrix stack. */
void popMatrix(MATRIX_STACK_TYPE type);
/** Adds an identity matrix to the top of specified type of matrxi stack. */
void loadIdentityMatrix(MATRIX_STACK_TYPE type);
/**
* Adds a matrix to the top of specified type of matrix stack.
*
* @param type Matrix type.
* @param mat The matrix that to be added.
*/
void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
/**
* Multipies a matrix to the top of specified type of matrix stack.
*
* @param type Matrix type.
* @param mat The matrix that to be multipied.
*/
void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
/** Gets the top matrix of specified type of matrix stack. */
const Mat4& getMatrix(MATRIX_STACK_TYPE type);
/** Cleras all types of matrix stack, and add indentity matrix to these matrix stacks. */
void resetMatrixStack();
protected:

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x 3.5rc0";
return "cocos2d-x 3.5";
}
NS_CC_END

View File

@ -1276,7 +1276,10 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
readername.append("Reader");
NodeReaderProtocol* reader = dynamic_cast<NodeReaderProtocol*>(ObjectFactory::getInstance()->createObject(readername));
if (reader)
{
node = reader->createNodeWithFlatBuffers(options->data());
}
Widget* widget = dynamic_cast<Widget*>(node);
if (widget)

View File

@ -67,7 +67,8 @@ enum class LanguageType
POLISH,
TURKISH,
UKRAINIAN,
ROMANIAN
ROMANIAN,
BULGARIAN
};
// END of platform group

View File

@ -188,6 +188,10 @@ LanguageType Application::getCurrentLanguage()
{
ret = LanguageType::ROMANIAN;
}
else if (0 == strcmp("bg", pLanguageName))
{
ret = LanguageType::BULGARIAN;
}
return ret;
}

View File

@ -161,6 +161,9 @@ LanguageType Application::getCurrentLanguage()
else if ([languageCode isEqualToString:@"ro"]){
ret = LanguageType::ROMANIAN;
}
else if ([languageCode isEqualToString:@"bg"]){
ret = LanguageType::BULGARIAN;
}
return ret;
}

View File

@ -257,6 +257,10 @@ LanguageType Application::getCurrentLanguage()
{
ret = LanguageType::ROMANIAN;
}
else if (0 == strcmp("bg", pLanguageName))
{
ret = LanguageType::BULGARIAN;
}
return ret;
}

View File

@ -215,6 +215,9 @@ LanguageType Application::getCurrentLanguage()
else if ([languageCode isEqualToString:@"ro"]){
ret = LanguageType::ROMANIAN;
}
else if ([languageCode isEqualToString:@"bg"]){
ret = LanguageType::BULGARIAN;
}
return ret;
}

View File

@ -194,6 +194,9 @@ LanguageType Application::getCurrentLanguage()
case LANG_ROMANIAN:
ret = LanguageType::ROMANIAN;
break;
case LANG_BULGARIAN:
ret = LanguageType::BULGARIAN;
break;
}
return ret;

View File

@ -205,6 +205,10 @@ LanguageType Application::getCurrentLanguage()
{
ret = LanguageType::ROMANIAN;
}
else if (strncmp(code, "bg", 2) == 0)
{
ret = LanguageType::BULGARIAN;
}
return ret;
}

View File

@ -33,85 +33,218 @@ NS_CC_BEGIN
class EventListenerCustom;
/**
VertexBuffer is an abstraction of low level openGL Vertex Buffer Object.
It is used to save an array of vertices.
*/
class CC_DLL VertexBuffer : public Ref
{
public:
/**
Create an instance of VertexBuffer.
@param sizePerVertex Size in bytes of one vertex.
@param vertexNumber The number of vertex.
@param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it.
*/
static VertexBuffer* create(int sizePerVertex, int vertexNumber, GLenum usage = GL_STATIC_DRAW);
/**Get the size in bytes of one vertex.*/
int getSizePerVertex() const;
/**Get the number of vertices.*/
int getVertexNumber() const;
/**
Update all or part of vertice data, if the range specified exceeds the vertex buffer, it will be clipped.
@param verts The pointer of the vertex data.
@param count The number of vertices to update.
@param begin The first vertex to update.
*/
bool updateVertices(const void* verts, int count, int begin);
/**
Get the size of the vertex array in bytes, equals getSizePerVertex() * getVertexNumber().
*/
int getSize() const;
/**
Get the internal openGL handle.
*/
GLuint getVBO() const;
protected:
/**
Constructor.
*/
VertexBuffer();
/**
Destructor.
*/
virtual ~VertexBuffer();
/**
Init the storage of vertex buffer.
@param sizePerVertex Size in bytes of one vertex.
@param vertexNumber The number of vertex.
@param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it.
*/
bool init(int sizePerVertex, int vertexNumber, GLenum usage = GL_STATIC_DRAW);
protected:
//event listener for foreground
/**
Event handler for foreground.
*/
void recreateVBO() const;
/**
Event listener for foreground.
*/
EventListenerCustom* _recreateVBOEventListener;
protected:
/**
Internal handle for openGL.
*/
mutable GLuint _vbo;
/**
Size in bytes for one vertex.
*/
int _sizePerVertex;
/**
Number of vertices.
*/
int _vertexNumber;
//buffer used for shadow copy
/**
Buffer used for shadow copy.
*/
std::vector<unsigned char> _shadowCopy;
/**
Hint for optimisation in GL.
*/
GLenum _usage;
protected:
/**
Static member to indicate that use _shadowCopy or not.
*/
static bool _enableShadowCopy;
public:
/**
Static getter for shadowCopy.
*/
static bool isShadowCopyEnabled() { return _enableShadowCopy; }
/**
Static setter for shadowCopy.
*/
static void enableShadowCopy(bool enabled) { _enableShadowCopy = enabled; }
};
/**
IndexBuffer is an abstraction of low level openGL Buffer Object.
It used to save an array of indices.
*/
class CC_DLL IndexBuffer : public Ref
{
public:
/**
Enum for the type of index, short indices and int indices could be used.
*/
enum class IndexType
{
/**Short index will be used.*/
INDEX_TYPE_SHORT_16,
/**Int index will be used.*/
INDEX_TYPE_UINT_32
};
public:
/**
Create an instance of IndexBuffer.
@param type type of index.
@param number The number of indices.
@param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it.
*/
static IndexBuffer* create(IndexType type, int number, GLenum usage = GL_STATIC_DRAW);
/**
Getter for type of indices.
*/
IndexType getType() const;
/**
Get the size in bytes for one index, will be 2 for INDEX_TYPE_SHORT_16 and 4 for INDEX_TYPE_UINT_32.
*/
int getSizePerIndex() const;
/**
Get the number of indices.
*/
int getIndexNumber() const;
/**
Update all or part of indices data, if the range specified exceeds the vertex buffer, it will be clipped.
@param indices The pointer of the index data.
@param count The number of indices to update.
@param begin The start index to update.
*/
bool updateIndices(const void* indices, int count, int begin);
/**
Get the size in bytes of the array of indices.
*/
int getSize() const;
/**
Get the openGL handle for index buffer.
*/
GLuint getVBO() const;
protected:
/**
Constructor.
*/
IndexBuffer();
/**
Destructor.
*/
virtual ~IndexBuffer();
/**
Init the storageof IndexBuffer.
@param type type of index.
@param number The number of indices.
@param usage A hint to indicate whether the vertexBuffer are updated frequently or not to let GL optimise it.
*/
bool init(IndexType type, int number, GLenum usage = GL_STATIC_DRAW);
protected:
/**
Handle for openGL.
*/
mutable GLuint _vbo;
/**
Type for index.
*/
IndexType _type;
/**
Number of indices.
*/
int _indexNumber;
protected:
//event listener for foreground
/**
Event handler for foreground.
*/
void recreateVBO() const;
/**
Event listener for foreground.
*/
EventListenerCustom* _recreateVBOEventListener;
//buffer used for shadow copy
/**
Buffer used for shadow copy.
*/
std::vector<unsigned char> _shadowCopy;
/**
Hint for optimisation in GL.
*/
GLenum _usage;
protected:
/**
Static member to indicate that use _shadowCopy or not.
*/
static bool _enableShadowCopy;
public:
/**
Static getter for shadowCopy.
*/
static bool isShadowCopyEnabled() { return _enableShadowCopy; }
/**
Static setter for shadowCopy.
*/
static void enableShadowCopy(bool enabled) { _enableShadowCopy = enabled; }
};

View File

@ -31,55 +31,144 @@
NS_CC_BEGIN
class VertexBuffer;
/**
VertexStreamAttribute is used to specify the vertex attribute for drawing, which is correspondent to
glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr).
_semantic -> index
_size -> size
_type -> type
_normalize -> normalized
_offset is used to compute the start offset in a interleaved array, take a V3F_C4B_T2F array,
offset of vertex will be 0, offset of color would be 0 + sizeof(float) * 3 = 12,
offset of texture coord would be 12 + sizeof(char) * 4 = 16.
*/
struct CC_DLL VertexStreamAttribute
{
/**
Constructor.
*/
VertexStreamAttribute()
: _normalize(false),_offset(0),_semantic(0),_type(0),_size(0)
{
}
/**
Constructor
@param offset The offset of the attribute.
@param semantic The semantic (Position, Texcoord, Color etc) of attribute.
@param type The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc.
@param size Describe how many elements of type in the attribute.
*/
VertexStreamAttribute(int offset, int semantic, int type, int size)
: _normalize(false),_offset(offset),_semantic(semantic),_type(type),_size(size)
{
}
/**
Constructor
@param offset The offset of the attribute.
@param semantic The semantic (Position, Texcoord, Color etc) of attribute.
@param type The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc.
@param size Describe how many elements of type in the attribute.
@param normalize If true, the data will be normalized by deviding 255.
*/
VertexStreamAttribute(int offset, int semantic, int type, int size, bool normalize)
: _normalize(normalize),_offset(offset),_semantic(semantic),_type(type),_size(size)
{
}
/**
Whether the attribute should be normalized or not.
*/
bool _normalize;
/**
The offset of the attribute in the buffer.
*/
int _offset;
/**
Describe that the attribute usage, could be Position, Color etc.
*/
int _semantic;
/**
Describe the type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc.
*/
int _type;
/**
Describe how many elements of type in the attribute.
*/
int _size;
};
/**
VertexData is a class used for specify input streams for GPU rendering pipeline,
a VertexData will be composed by several streams, every stream will contain a VertexStreamAttribute
and the binding VertexBuffer. Streams will be identified by semantic.
*/
class CC_DLL VertexData : public Ref
{
public:
/**
Create function, used to create a instance of VertexData.
*/
static VertexData* create();
/**
Get the number of streams in the VertexData.
*/
size_t getVertexStreamCount() const;
/**
Set a stream to VertexData,given that stream is identified by semantic, so if the semantic is not
specified before, it will add a stream, or it will override the old one.
@param buffer The binding buffer of the stream.
@param stream The binding vertex attribute, its member semantic will be used as the identifier.
*/
bool setStream(VertexBuffer* buffer, const VertexStreamAttribute& stream);
/**
Remove the given streams.
@param semantic The semantic of the stream.
*/
void removeStream(int semantic);
/**
Get the attribute of stream, const version.
@param semantic The semantic of the stream.
*/
const VertexStreamAttribute* getStreamAttribute(int semantic) const;
/**
Get the attribute of stream.
@param semantic The semantic of the stream.
*/
VertexStreamAttribute* getStreamAttribute(int semantic);
/**
Get the binded buffer of the stream.
@param semantic The semantic of the stream.
*/
VertexBuffer* getStreamBuffer(int semantic) const;
/**
Called for rendering, it will bind the state of vertex data to current rendering pipeline.
*/
void use();
protected:
/**
Constructor.
*/
VertexData();
/**
Destructor.
*/
virtual ~VertexData();
protected:
/**
Simple struct to bundle buffer and attribute.
*/
struct BufferAttribute
{
VertexBuffer* _buffer;
VertexStreamAttribute _stream;
};
/**
Streams in the VertexData.
*/
std::map<int, BufferAttribute> _vertexStreams;
};

View File

@ -67,6 +67,14 @@
-- @param #cc.Node stencil
-- @return ClippingNode#ClippingNode ret (return value: cc.ClippingNode)
--------------------------------
--
-- @function [parent=#ClippingNode] setCameraMask
-- @param self
-- @param #unsigned short mask
-- @param #bool applyChildren
-- @return ClippingNode#ClippingNode self (return value: cc.ClippingNode)
--------------------------------
--
-- @function [parent=#ClippingNode] visit

View File

@ -478,4 +478,12 @@
-- @param #color3b_table parentColor
-- @return Label#Label self (return value: cc.Label)
--------------------------------
--
-- @function [parent=#Label] setCameraMask
-- @param self
-- @param #unsigned short mask
-- @param #bool applyChildren
-- @return Label#Label self (return value: cc.Label)
return nil