Classes
Singleton that manages the Animations.
More...
CCSpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw").
More...
Singleton that handles the loading of the sprite frames.
More...
Macros
Functions
Variables
Absolute (real) Index on the SpriteSheet.
More...
Absolute (real) Index on the SpriteSheet.
More...
Absolute (real) Index on the SpriteSheet.
More...
Used batch node (weak reference)
More...
Used batch node (weak reference)
More...
Used batch node (weak reference)
More...
Whether the sprite needs to be updated.
More...
Whether the sprite needs to be updated.
More...
Whether the sprite needs to be updated.
More...
Whether all of the sprite's children needs to be updated.
More...
Whether all of the sprite's children needs to be updated.
More...
Whether all of the sprite's children needs to be updated.
More...
Whether the sprite contains children.
More...
Whether the sprite contains children.
More...
Whether the sprite contains children.
More...
should not be drawn because one of the ancestors is not visible
More...
should not be drawn because one of the ancestors is not visible
More...
should not be drawn because one of the ancestors is not visible
More...
Whether the texture is rotated.
More...
Whether the texture is rotated.
More...
Whether the texture is rotated.
More...
Whether the sprite is flipped horizaontally or not.
More...
Whether the sprite is flipped horizaontally or not.
More...
Whether the sprite is flipped horizaontally or not.
More...
Creators
Creates an empty sprite without texture.
More...
Creates an empty sprite without texture.
More...
Creates an empty sprite without texture.
More...
static CCSprite *
create (const char *pszFileName)
Creates a sprite with an image filename.
More...
Creates a sprite with an image filename.
More...
static CCSprite *
create (const char *pszFileName, const CCRect &rect)
Creates a sprite with an image filename and a rect.
More...
var
create ( var pszFileName, var rect)
Creates a sprite with an image filename and a rect.
More...
local
create ( local pszFileName, local rect)
Creates a sprite with an image filename and a rect.
More...
Creates a sprite with an exsiting texture contained in a
CCTexture2D object After creation, the rect will be the size of the texture, and the offset will be (0,0).
More...
Creates a sprite with an exsiting texture contained in a
CCTexture2D object After creation, the rect will be the size of the texture, and the offset will be (0,0).
More...
Creates a sprite with a texture and a rect.
More...
Creates a sprite with a texture and a rect.
More...
Creates a sprite with an sprite frame.
More...
Creates a sprite with an sprite frame name.
More...
Creates a sprite with an sprite frame name.
More...
Creates a sprite with an sprite frame name.
More...
Initializers
Initializes an empty sprite with nothing init.
More...
Initializes an empty sprite with nothing init.
More...
Initializes an empty sprite with nothing init.
More...
Initializes a sprite with a texture.
More...
Initializes a sprite with a texture and a rect.
More...
Initializes a sprite with a texture and a rect.
More...
Initializes a sprite with a texture and a rect.
More...
virtual bool
initWithTexture (CCTexture2D *pTexture, const CCRect &rect, bool rotated)
Initializes a sprite with a texture and a rect in points, optionally rotated.
More...
Initializes a sprite with a texture and a rect in points, optionally rotated.
More...
Initializes a sprite with an SpriteFrame.
More...
Initializes a sprite with an SpriteFrame.
More...
Initializes a sprite with an SpriteFrame.
More...
Initializes a sprite with an sprite frame name.
More...
Initializes a sprite with an sprite frame name.
More...
Initializes a sprite with an sprite frame name.
More...
Initializes a sprite with an image filename.
More...
virtual bool
initWithFile (const char *pszFilename, const CCRect &rect)
Initializes a sprite with an image filename, and a rect.
More...
var
init ( var pszFilename, var rect)
Initializes a sprite with an image filename, and a rect.
More...
Initializes a sprite with an image filename, and a rect.
More...
Functions inherited from CCTextureProtocol
Returns the currently used texture.
More...
Sets the source blending function.
More...
Sets the source blending function.
More...
Sets the source blending function.
More...
Returns the blending function that is currently being used.
More...
Returns the blending function that is currently being used.
More...
Functions inherited from CCNode
Changes the scale factor on X axis of this node.
More...
Changes the scale factor on Y axis of this node.
More...
Changes the scale factor on Y axis of this node.
More...
Changes the position (x,y) of the node in OpenGL coordinates.
More...
Sets the rotation (angle) of the node in degrees.
More...
Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
More...
Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
More...
Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
More...
Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
More...
Changes the X skew angle of the node in degrees.
More...
Changes the X skew angle of the node in degrees.
More...
Changes the X skew angle of the node in degrees.
More...
Changes the Y skew angle of the node in degrees.
More...
Changes the Y skew angle of the node in degrees.
More...
Changes the Y skew angle of the node in degrees.
More...
virtual void
removeChild (CCNode *pChild, bool bCleanup)
Removes a child from the container.
More...
Removes a child from the container.
More...
Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
More...
Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
More...
Reorders a child according to a new z value.
More...
Reorders a child according to a new z value.
More...
Reorders a child according to a new z value.
More...
Adds a child to the container with z-order as 0.
More...
Adds a child to the container with z-order as 0.
More...
virtual void
addChild (CCNode *pChild, int zOrder)
Adds a child to the container with a z-order.
More...
local
addChild ( local pChild, local zOrder)
Adds a child to the container with a z-order.
More...
virtual void
addChild (CCNode *pChild, int zOrder, int tag)
Adds a child to the container with z order and tag.
More...
local
addChild ( local pChild, local zOrder, local tag)
Adds a child to the container with z order and tag.
More...
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
More...
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
More...
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
More...
Changes both X and Y scale factor of the node.
More...
Changes both X and Y scale factor of the node.
More...
Sets the real OpenGL Z vertex.
More...
Sets the real OpenGL Z vertex.
More...
Sets the real OpenGL Z vertex.
More...
Sets the anchor point in percent.
More...
Sets the anchor point in percent.
More...
Sets the anchor point in percent.
More...
Sets whether the anchor point will be (0,0) when you position this node.
More...
Sets whether the anchor point will be (0,0) when you position this node.
More...
Sets whether the node is visible.
More...
Sets whether the node is visible.
More...
Sets whether the node is visible.
More...
Override this method to draw your own node.
More...
Override this method to draw your own node.
More...
Functions inherited from CCNodeRGBA
recursive method that updates display color
More...
recursive method that updates display color
More...
Changes the OpacityModifyRGB property.
More...
Changes the OpacityModifyRGB property.
More...
Changes the OpacityModifyRGB property.
More...
Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
More...
Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
More...
Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
More...
recursive method that updates the displayed opacity.
More...
recursive method that updates the displayed opacity.
More...
recursive method that updates the displayed opacity.
More...
BatchNode methods
Updates the quad according the rotation, position, scale values.
More...
virtual void
setBatchNode (CCSpriteBatchNode *pobSpriteBatchNode)
Sets the batch node to sprite.
More...
Sets the batch node to sprite.
More...
Texture methods
virtual void
setTextureRect (const CCRect &rect, bool rotated, const CCSize &untrimmedSize)
Sets the texture rect, rectRotated and untrimmed size of the
CCSprite in points.
More...
local
setTextureRect ( local rect, local rotated, local untrimmedSize)
Sets the texture rect, rectRotated and untrimmed size of the
CCSprite in points.
More...
Frames methods
Returns the current displayed frame.
More...
Returns the current displayed frame.
More...
Animation methods
Changes the display frame with animation name and index.
More...
Changes the display frame with animation name and index.
More...
Changes the display frame with animation name and index.
More...
Sprite Properties' setter/getters
Whether or not the Sprite needs to be updated in the Atlas.
More...
Makes the Sprite to be updated in the Atlas.
More...
Makes the Sprite to be updated in the Atlas.
More...
Makes the Sprite to be updated in the Atlas.
More...
Returns the quad (tex coords, vertex coords and color) information.
More...
Returns the quad (tex coords, vertex coords and color) information.
More...
Returns whether or not the texture rectangle is rotated.
More...
Returns the index used on the TextureAtlas.
More...
Returns the index used on the TextureAtlas.
More...
Returns the index used on the TextureAtlas.
More...
Sets the index used on the TextureAtlas.
More...
Gets the offset position of the sprite.
More...
Gets the offset position of the sprite.
More...
Returns the flag which indicates whether the sprite is flipped horizontally or not.
More...
Sets whether the sprite should be flipped horizontally or not.
More...
Sets whether the sprite should be flipped horizontally or not.
More...
Return the flag which indicates whether the sprite is flipped vertically or not.
More...
Sets whether the sprite should be flipped vertically or not.
More...
Detailed Description
Macro Definition Documentation
#define CCSpriteIndexNotInitialized 0xffffffff
#define kDefaultSpriteBatchCapacity 29
Function Documentation
virtual ~CCSprite
(
void
)
virtual
virtual void addChild
(
CCNode *
child )
virtual
Adds a child to the container with z-order as 0.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
Reimplemented from CCNode.
var addChild
(
var
child )
virtual
Adds a child to the container with z-order as 0.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
Reimplemented from CCNode.
local addChild
(
local
child )
virtual
Adds a child to the container with z-order as 0.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
Reimplemented from CCNode.
virtual void addChild
(
CCNode *
child,
int
zOrder
)
virtual
Adds a child to the container with a z-order.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
Reimplemented from CCNode.
var addChild
(
var
child,
var
zOrder
)
virtual
Adds a child to the container with a z-order.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
Reimplemented from CCNode.
local addChild
(
local
child,
local
zOrder
)
virtual
Adds a child to the container with a z-order.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
Reimplemented from CCNode.
virtual void addChild
(
CCNode *
child,
int
zOrder,
int
tag
)
virtual
Adds a child to the container with z order and tag.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
tag A interger to identify the node easily. Please refer to
setTag(int)
Reimplemented from CCNode.
var addChild
(
var
child,
var
zOrder,
var
tag
)
virtual
Adds a child to the container with z order and tag.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
tag A interger to identify the node easily. Please refer to
setTag(int)
Reimplemented from CCNode.
local addChild
(
local
child,
local
zOrder,
local
tag
)
virtual
Adds a child to the container with z order and tag.
If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called immediately.
- Parameters
-
child A child node
tag A interger to identify the node easily. Please refer to
setTag(int)
Reimplemented from CCNode.
static CCSprite* create
(
)
static
Creates an empty sprite without texture.
You can call setTexture method subsequently.
- Returns
- An empty sprite object that is marked as autoreleased.
Creates an empty sprite without texture.
You can call setTexture method subsequently.
- Returns
- An empty sprite object that is marked as autoreleased.
Creates an empty sprite without texture.
You can call setTexture method subsequently.
- Returns
- An empty sprite object that is marked as autoreleased.
static CCSprite* create
(
const char *
pszFileName )
static
Creates a sprite with an image filename.
After creation, the rect of sprite will be the size of the image, and the offset will be (0,0).
- Parameters
-
pszFileName The string which indicates a path to image file, e.g., "scene1/monster.png".
- Returns
- A valid sprite object that is marked as autoreleased.
var create
(
var
pszFileName )
static
Creates a sprite with an image filename.
After creation, the rect of sprite will be the size of the image, and the offset will be (0,0).
- Parameters
-
pszFileName The string which indicates a path to image file, e.g., "scene1/monster.png".
- Returns
- A valid sprite object that is marked as autoreleased.
local create
(
local
pszFileName )
static
Creates a sprite with an image filename.
After creation, the rect of sprite will be the size of the image, and the offset will be (0,0).
- Parameters
-
pszFileName The string which indicates a path to image file, e.g., "scene1/monster.png".
- Returns
- A valid sprite object that is marked as autoreleased.
static CCSprite* create
(
const char *
pszFileName,
)
static
Creates a sprite with an image filename and a rect.
- Parameters
-
pszFileName The string wich indicates a path to image file, e.g., "scene1/monster.png"
rect Only the contents inside rect of pszFileName's texture will be applied for this sprite.
- Returns
- A valid sprite object that is marked as autoreleased.
var create
(
var
pszFileName,
var
rect
)
static
Creates a sprite with an image filename and a rect.
- Parameters
-
pszFileName The string wich indicates a path to image file, e.g., "scene1/monster.png"
rect Only the contents inside rect of pszFileName's texture will be applied for this sprite.
- Returns
- A valid sprite object that is marked as autoreleased.
local create
(
local
pszFileName,
local
rect
)
static
Creates a sprite with an image filename and a rect.
- Parameters
-
pszFileName The string wich indicates a path to image file, e.g., "scene1/monster.png"
rect Only the contents inside rect of pszFileName's texture will be applied for this sprite.
- Returns
- A valid sprite object that is marked as autoreleased.
static CCSprite*
createWithSpriteFrame
(
CCSpriteFrame *
pSpriteFrame )
static
Creates a sprite with an sprite frame.
- Parameters
-
pSpriteFrame A sprite frame which involves a texture and a rect
- Returns
- A valid sprite object that is marked as autoreleased.
var createWithSpriteFrame
(
var
pSpriteFrame )
static
Creates a sprite with an sprite frame.
- Parameters
-
pSpriteFrame A sprite frame which involves a texture and a rect
- Returns
- A valid sprite object that is marked as autoreleased.
local createWithSpriteFrame
(
local
pSpriteFrame )
static
Creates a sprite with an sprite frame.
- Parameters
-
pSpriteFrame A sprite frame which involves a texture and a rect
- Returns
- A valid sprite object that is marked as autoreleased.
static CCSprite*
createWithSpriteFrameName
(
const char *
pszSpriteFrameName )
static
Creates a sprite with an sprite frame name.
A CCSpriteFrame will be fetched from the CCSpriteFrameCache by pszSpriteFrameName param. If the CCSpriteFrame doesn't exist it will raise an exception.
- Parameters
-
pszSpriteFrameName A null terminated string which indicates the sprite frame name.
- Returns
- A valid sprite object that is marked as autoreleased.
var createWithSpriteFrameName
(
var
pszSpriteFrameName )
static
Creates a sprite with an sprite frame name.
A CCSpriteFrame will be fetched from the CCSpriteFrameCache by pszSpriteFrameName param. If the CCSpriteFrame doesn't exist it will raise an exception.
- Parameters
-
pszSpriteFrameName A null terminated string which indicates the sprite frame name.
- Returns
- A valid sprite object that is marked as autoreleased.
local createWithSpriteFrameName
(
local
pszSpriteFrameName )
static
Creates a sprite with an sprite frame name.
A CCSpriteFrame will be fetched from the CCSpriteFrameCache by pszSpriteFrameName param. If the CCSpriteFrame doesn't exist it will raise an exception.
- Parameters
-
pszSpriteFrameName A null terminated string which indicates the sprite frame name.
- Returns
- A valid sprite object that is marked as autoreleased.
static CCSprite* createWithTexture
(
CCTexture2D *
pTexture )
static
Creates a sprite with an exsiting texture contained in a CCTexture2D object After creation, the rect will be the size of the texture, and the offset will be (0,0).
- Parameters
-
- Returns
- A valid sprite object that is marked as autoreleased.
var createWithTexture
(
var
pTexture )
static
Creates a sprite with an exsiting texture contained in a CCTexture2D object After creation, the rect will be the size of the texture, and the offset will be (0,0).
- Parameters
-
- Returns
- A valid sprite object that is marked as autoreleased.
local createWithTexture
(
local
pTexture )
static
Creates a sprite with an exsiting texture contained in a CCTexture2D object After creation, the rect will be the size of the texture, and the offset will be (0,0).
- Parameters
-
- Returns
- A valid sprite object that is marked as autoreleased.
static CCSprite* createWithTexture
(
CCTexture2D *
pTexture,
)
static
Creates a sprite with a texture and a rect.
After creation, the offset will be (0,0).
- Parameters
-
rect Only the contents inside the rect of this texture will be applied for this sprite.
- Returns
- A valid sprite object that is marked as autoreleased.
var createWithTexture
(
var
pTexture,
var
rect
)
static
Creates a sprite with a texture and a rect.
After creation, the offset will be (0,0).
- Parameters
-
rect Only the contents inside the rect of this texture will be applied for this sprite.
- Returns
- A valid sprite object that is marked as autoreleased.
local createWithTexture
(
local
pTexture,
local
rect
)
static
Creates a sprite with a texture and a rect.
After creation, the offset will be (0,0).
- Parameters
-
rect Only the contents inside the rect of this texture will be applied for this sprite.
- Returns
- A valid sprite object that is marked as autoreleased.
virtual CCSpriteFrame* displayFrame
(
void
)
virtual
Returns the current displayed frame.
local displayFrame
(
)
virtual
Returns the current displayed frame.
virtual void draw
(
void
)
virtual
Override this method to draw your own node.
The following GL states will be enabled by default:
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnable(GL_TEXTURE_2D); AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE But if you enable any other GL state, you should disable it after drawing your node.
Reimplemented from CCNode.
Reimplemented in CCTextFieldTTF.
Override this method to draw your own node.
The following GL states will be enabled by default:
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnable(GL_TEXTURE_2D); AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE But if you enable any other GL state, you should disable it after drawing your node.
Reimplemented from CCNode.
Reimplemented in CCTextFieldTTF.
Override this method to draw your own node.
The following GL states will be enabled by default:
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnable(GL_TEXTURE_2D); AND YOU SHOULD NOT DISABLE THEM AFTER DRAWING YOUR NODE But if you enable any other GL state, you should disable it after drawing your node.
Reimplemented from CCNode.
Reimplemented in CCTextFieldTTF.
unsigned int getAtlasIndex
(
void
)
inline
Returns the index used on the TextureAtlas.
var getAtlasIndex
(
)
inline
Returns the index used on the TextureAtlas.
local getAtlasIndex
(
)
inline
Returns the index used on the TextureAtlas.
virtual CCSpriteBatchNode*
getBatchNode
(
void
)
virtual
var getBatchNode
(
)
virtual
local getBatchNode
(
)
virtual
Returns the blending function that is currently being used.
- Returns
- A ccBlendFunc structure with source and destination factor which specified pixel arithmetic.
Implements CCBlendProtocol.
local getBlendFunc
(
)
inlinevirtual
Returns the blending function that is currently being used.
- Returns
- A ccBlendFunc structure with source and destination factor which specified pixel arithmetic.
Implements CCBlendProtocol.
const CCPoint& getOffsetPosition
(
void
)
inline
Gets the offset position of the sprite.
Calculated automatically by editors like Zwoptex.
var getOffsetPosition
(
)
inline
Gets the offset position of the sprite.
Calculated automatically by editors like Zwoptex.
local getOffsetPosition
(
)
inline
Gets the offset position of the sprite.
Calculated automatically by editors like Zwoptex.
Returns the quad (tex coords, vertex coords and color) information.
Returns the quad (tex coords, vertex coords and color) information.
virtual CCTexture2D* getTexture
(
void
)
virtual
Returns the currently used texture.
- Returns
- The texture that is currenlty being used.
Implements CCTextureProtocol.
var getTexture
(
)
virtual
Returns the currently used texture.
- Returns
- The texture that is currenlty being used.
Implements CCTextureProtocol.
local getTexture
(
)
virtual
Returns the currently used texture.
- Returns
- The texture that is currenlty being used.
Implements CCTextureProtocol.
CCTextureAtlas* getTextureAtlas
(
void
)
inline
var getTextureAtlas
(
)
inline
local getTextureAtlas
(
)
inline
const CCRect& getTextureRect
(
void
)
inline
Returns the rect of the CCSprite in points.
var getTextureRect
(
)
inline
Returns the rect of the CCSprite in points.
local getTextureRect
(
)
inline
Returns the rect of the CCSprite in points.
virtual void
ignoreAnchorPointForPosition
(
bool
ignore )
virtual
Sets whether the anchor point will be (0,0) when you position this node.
This is an internal method, only used by CCLayer and CCScene. Don't call it outside framework. The default value is false, while in CCLayer and CCScene are true
- Parameters
-
ignore true if anchor point will be (0,0) when you position this node
- Todo:
- This method shoud be renamed as setIgnoreAnchorPointForPosition(bool) or something with "set"
Reimplemented from CCNode.
var ignoreAnchorPointForPosition
(
var
ignore )
virtual
Sets whether the anchor point will be (0,0) when you position this node.
This is an internal method, only used by CCLayer and CCScene. Don't call it outside framework. The default value is false, while in CCLayer and CCScene are true
- Parameters
-
ignore true if anchor point will be (0,0) when you position this node
- Todo:
- This method shoud be renamed as setIgnoreAnchorPointForPosition(bool) or something with "set"
Reimplemented from CCNode.
local ignoreAnchorPointForPosition
(
local
ignore )
virtual
Sets whether the anchor point will be (0,0) when you position this node.
This is an internal method, only used by CCLayer and CCScene. Don't call it outside framework. The default value is false, while in CCLayer and CCScene are true
- Parameters
-
ignore true if anchor point will be (0,0) when you position this node
- Todo:
- This method shoud be renamed as setIgnoreAnchorPointForPosition(bool) or something with "set"
Reimplemented from CCNode.
virtual bool init
(
void
)
virtual
Initializes an empty sprite with nothing init.
Reimplemented from CCNodeRGBA.
Reimplemented in CCLabelTTF.
Initializes an empty sprite with nothing init.
Reimplemented from CCNodeRGBA.
Reimplemented in CCLabelTTF.
Initializes an empty sprite with nothing init.
Reimplemented from CCNodeRGBA.
Reimplemented in CCLabelTTF.
virtual bool initWithFile
(
const char *
pszFilename )
virtual
Initializes a sprite with an image filename.
This method will find pszFilename from local file system, load its content to CCTexture2D, then use CCTexture2D to create a sprite. After initialization, the rect used will be the size of the image. The offset will be (0,0).
- Parameters
-
pszFilename The path to an image file in local file system
- Returns
- true if the sprite is initialized properly, false otherwise.
Reimplemented in CCSkin.
var init
(
var
pszFilename )
virtual
Initializes a sprite with an image filename.
This method will find pszFilename from local file system, load its content to CCTexture2D, then use CCTexture2D to create a sprite. After initialization, the rect used will be the size of the image. The offset will be (0,0).
- Parameters
-
pszFilename The path to an image file in local file system
- Returns
- true if the sprite is initialized properly, false otherwise.
Reimplemented in CCSkin.
local initWithFile
(
local
pszFilename )
virtual
Initializes a sprite with an image filename.
This method will find pszFilename from local file system, load its content to CCTexture2D, then use CCTexture2D to create a sprite. After initialization, the rect used will be the size of the image. The offset will be (0,0).
- Parameters
-
pszFilename The path to an image file in local file system
- Returns
- true if the sprite is initialized properly, false otherwise.
Reimplemented in CCSkin.
virtual bool initWithFile
(
const char *
pszFilename,
)
virtual
Initializes a sprite with an image filename, and a rect.
This method will find pszFilename from local file system, load its content to CCTexture2D, then use CCTexture2D to create a sprite. After initialization, the offset will be (0,0).
- Parameters
-
pszFilename The path to an image file in local file system.
rect The rectangle assigned the content area from texture.
- Returns
- true if the sprite is initialized properly, false otherwise.
var init
(
var
pszFilename,
var
rect
)
virtual
Initializes a sprite with an image filename, and a rect.
This method will find pszFilename from local file system, load its content to CCTexture2D, then use CCTexture2D to create a sprite. After initialization, the offset will be (0,0).
- Parameters
-
pszFilename The path to an image file in local file system.
rect The rectangle assigned the content area from texture.
- Returns
- true if the sprite is initialized properly, false otherwise.
local initWithFile
(
local
pszFilename,
local
rect
)
virtual
Initializes a sprite with an image filename, and a rect.
This method will find pszFilename from local file system, load its content to CCTexture2D, then use CCTexture2D to create a sprite. After initialization, the offset will be (0,0).
- Parameters
-
pszFilename The path to an image file in local file system.
rect The rectangle assigned the content area from texture.
- Returns
- true if the sprite is initialized properly, false otherwise.
virtual bool initWithSpriteFrame
(
CCSpriteFrame *
pSpriteFrame )
virtual
Initializes a sprite with an SpriteFrame.
The texture and rect in SpriteFrame will be applied on this sprite
- Parameters
-
pSpriteFrame A
CCSpriteFrame object. It should includes a valid texture and a rect
- Returns
- true if the sprite is initialized properly, false otherwise.
var initWithSpriteFrame
(
var
pSpriteFrame )
virtual
Initializes a sprite with an SpriteFrame.
The texture and rect in SpriteFrame will be applied on this sprite
- Parameters
-
pSpriteFrame A
CCSpriteFrame object. It should includes a valid texture and a rect
- Returns
- true if the sprite is initialized properly, false otherwise.
local initWithSpriteFrame
(
local
pSpriteFrame )
virtual
Initializes a sprite with an SpriteFrame.
The texture and rect in SpriteFrame will be applied on this sprite
- Parameters
-
pSpriteFrame A
CCSpriteFrame object. It should includes a valid texture and a rect
- Returns
- true if the sprite is initialized properly, false otherwise.
virtual bool
initWithSpriteFrameName
(
const char *
pszSpriteFrameName )
virtual
Initializes a sprite with an sprite frame name.
A CCSpriteFrame will be fetched from the CCSpriteFrameCache by name. If the CCSpriteFrame doesn't exist it will raise an exception.
- Parameters
-
- Returns
- true if the sprite is initialized properly, false otherwise.
Reimplemented in CCSkin.
var initWithSpriteFrameName
(
var
pszSpriteFrameName )
virtual
Initializes a sprite with an sprite frame name.
A CCSpriteFrame will be fetched from the CCSpriteFrameCache by name. If the CCSpriteFrame doesn't exist it will raise an exception.
- Parameters
-
- Returns
- true if the sprite is initialized properly, false otherwise.
Reimplemented in CCSkin.
local initWithSpriteFrameName
(
local
pszSpriteFrameName )
virtual
Initializes a sprite with an sprite frame name.
A CCSpriteFrame will be fetched from the CCSpriteFrameCache by name. If the CCSpriteFrame doesn't exist it will raise an exception.
- Parameters
-
- Returns
- true if the sprite is initialized properly, false otherwise.
Reimplemented in CCSkin.
virtual bool initWithTexture
(
CCTexture2D *
pTexture )
virtual
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).
- Parameters
-
- Returns
- true if the sprite is initialized properly, false otherwise.
var initWithTexture
(
var
pTexture )
virtual
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).
- Parameters
-
- Returns
- true if the sprite is initialized properly, false otherwise.
local initWithTexture
(
local
pTexture )
virtual
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).
- Parameters
-
- Returns
- true if the sprite is initialized properly, false otherwise.
Initializes a sprite with a texture and a rect.
After initialization, the offset will be (0,0).
- Parameters
-
rect Only the contents inside rect of this texture will be applied for this sprite.
- Returns
- true if the sprite is initialized properly, false otherwise.
var initWithTexture
(
var
pTexture,
var
rect
)
virtual
Initializes a sprite with a texture and a rect.
After initialization, the offset will be (0,0).
- Parameters
-
rect Only the contents inside rect of this texture will be applied for this sprite.
- Returns
- true if the sprite is initialized properly, false otherwise.
local initWithTexture
(
local
pTexture,
local
rect
)
virtual
Initializes a sprite with a texture and a rect.
After initialization, the offset will be (0,0).
- Parameters
-
rect Only the contents inside rect of this texture will be applied for this sprite.
- Returns
- true if the sprite is initialized properly, false otherwise.
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.
- Parameters
-
pTexture A
CCTexture2D object whose texture will be applied to this sprite.
rect A rectangle assigned the contents of texture.
rotated Whether or not the texture rectangle is rotated.
- Returns
- true if the sprite is initialized properly, false otherwise.
var initWithTexture
(
var
pTexture,
var
rect,
var
rotated
)
virtual
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.
- Parameters
-
pTexture A
CCTexture2D object whose texture will be applied to this sprite.
rect A rectangle assigned the contents of texture.
rotated Whether or not the texture rectangle is rotated.
- Returns
- true if the sprite is initialized properly, false otherwise.
local initWithTexture
(
local
pTexture,
local
rect,
local
rotated
)
virtual
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.
- Parameters
-
pTexture A
CCTexture2D object whose texture will be applied to this sprite.
rect A rectangle assigned the contents of texture.
rotated Whether or not the texture rectangle is rotated.
- Returns
- true if the sprite is initialized properly, false otherwise.
virtual bool isDirty
(
void
)
inlinevirtual
Whether or not the Sprite needs to be updated in the Atlas.
- Returns
- true if the sprite needs to be updated in the Atlas, false otherwise.
Reimplemented in CCPhysicsSprite.
var isDirty
(
)
inlinevirtual
Whether or not the Sprite needs to be updated in the Atlas.
- Returns
- true if the sprite needs to be updated in the Atlas, false otherwise.
Reimplemented in CCPhysicsSprite.
local isDirty
(
)
inlinevirtual
Whether or not the Sprite needs to be updated in the Atlas.
- Returns
- true if the sprite needs to be updated in the Atlas, false otherwise.
Reimplemented in CCPhysicsSprite.
Returns the flag which indicates whether the sprite is flipped horizontally or not.
It only flips the texture of the sprite, and not the texture of the sprite's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: sprite->setScaleX(sprite->getScaleX() * -1);
- Returns
- true if the sprite is flipped horizaontally, false otherwise.
Returns the flag which indicates whether the sprite is flipped horizontally or not.
It only flips the texture of the sprite, and not the texture of the sprite's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: sprite->setScaleX(sprite->getScaleX() * -1);
- Returns
- true if the sprite is flipped horizaontally, false otherwise.
Returns the flag which indicates whether the sprite is flipped horizontally or not.
It only flips the texture of the sprite, and not the texture of the sprite's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: sprite->setScaleX(sprite->getScaleX() * -1);
- Returns
- true if the sprite is flipped horizaontally, false otherwise.
Return the flag which indicates whether the sprite is flipped vertically or not.
It only flips the texture of the sprite, and not the texture of the sprite's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: sprite->setScaleY(sprite->getScaleY() * -1);
- Returns
- true if the sprite is flipped vertically, flase otherwise.
Return the flag which indicates whether the sprite is flipped vertically or not.
It only flips the texture of the sprite, and not the texture of the sprite's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: sprite->setScaleY(sprite->getScaleY() * -1);
- Returns
- true if the sprite is flipped vertically, flase otherwise.
Return the flag which indicates whether the sprite is flipped vertically or not.
It only flips the texture of the sprite, and not the texture of the sprite's children. Also, flipping the texture doesn't alter the anchorPoint. If you want to flip the anchorPoint too, and/or to flip the children too use: sprite->setScaleY(sprite->getScaleY() * -1);
- Returns
- true if the sprite is flipped vertically, flase otherwise.
var isFrameDisplayed
(
var
pFrame )
virtual
local isFrameDisplayed
(
local
pFrame )
virtual
virtual bool isOpacityModifyRGB
(
void
)
virtual
Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
- Returns
- Returns opacity modify flag.
Reimplemented from CCNodeRGBA.
var isOpacityModifyRGB
(
)
virtual
Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
- Returns
- Returns opacity modify flag.
Reimplemented from CCNodeRGBA.
local isOpacityModifyRGB
(
)
virtual
Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
- Returns
- Returns opacity modify flag.
Reimplemented from CCNodeRGBA.
bool isTextureRectRotated
(
void
)
inline
Returns whether or not the texture rectangle is rotated.
var isTextureRectRotated
(
)
inline
Returns whether or not the texture rectangle is rotated.
local isTextureRectRotated
(
)
inline
Returns whether or not the texture rectangle is rotated.
virtual void
removeAllChildrenWithCleanup
(
bool
cleanup )
virtual
Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
- Parameters
-
cleanup true if all running actions on all children nodes should be cleanup, false oterwise.
Reimplemented from CCNode.
var removeAllChildrenWithCleanup
(
var
cleanup )
virtual
Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
- Parameters
-
cleanup true if all running actions on all children nodes should be cleanup, false oterwise.
Reimplemented from CCNode.
local removeAllChildrenWithCleanup
(
local
cleanup )
virtual
Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter.
- Parameters
-
cleanup true if all running actions on all children nodes should be cleanup, false oterwise.
Reimplemented from CCNode.
virtual void removeChild
(
CCNode *
child,
bool
cleanup
)
virtual
Removes a child from the container.
It will also cleanup all running actions depending on the cleanup parameter.
- Parameters
-
child The child node which will be removed.
cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
Reimplemented from CCNode.
var removeChild
(
var
child,
var
cleanup
)
virtual
Removes a child from the container.
It will also cleanup all running actions depending on the cleanup parameter.
- Parameters
-
child The child node which will be removed.
cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
Reimplemented from CCNode.
local removeChild
(
local
child,
local
cleanup
)
virtual
Removes a child from the container.
It will also cleanup all running actions depending on the cleanup parameter.
- Parameters
-
child The child node which will be removed.
cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
Reimplemented from CCNode.
virtual void reorderChild
(
CCNode *
child,
int
zOrder
)
virtual
Reorders a child according to a new z value.
- Parameters
-
child An already added child node. It MUST be already added.
Reimplemented from CCNode.
var reorderChild
(
var
child,
var
zOrder
)
virtual
Reorders a child according to a new z value.
- Parameters
-
child An already added child node. It MUST be already added.
Reimplemented from CCNode.
local reorderChild
(
local
child,
local
zOrder
)
virtual
Reorders a child according to a new z value.
- Parameters
-
child An already added child node. It MUST be already added.
Reimplemented from CCNode.
virtual void setAnchorPoint
(
const
CCPoint &
anchorPoint )
virtual
Sets the anchor point in percent.
anchorPoint is the point around which all transformations and positioning manipulations take place. It's like a pin in the node where it is "attached" to its parent. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. But you can use values higher than (1,1) and lower than (0,0) too. The default anchorPoint is (0.5,0.5), so it starts in the center of the node.
- Parameters
-
anchorPoint The anchor point of node.
Reimplemented from CCNode.
var setAnchorPoint
(
var
anchorPoint )
virtual
Sets the anchor point in percent.
anchorPoint is the point around which all transformations and positioning manipulations take place. It's like a pin in the node where it is "attached" to its parent. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. But you can use values higher than (1,1) and lower than (0,0) too. The default anchorPoint is (0.5,0.5), so it starts in the center of the node.
- Parameters
-
anchorPoint The anchor point of node.
Reimplemented from CCNode.
local setAnchorPoint
(
local
anchorPoint )
virtual
Sets the anchor point in percent.
anchorPoint is the point around which all transformations and positioning manipulations take place. It's like a pin in the node where it is "attached" to its parent. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. But you can use values higher than (1,1) and lower than (0,0) too. The default anchorPoint is (0.5,0.5), so it starts in the center of the node.
- Parameters
-
anchorPoint The anchor point of node.
Reimplemented from CCNode.
void setAtlasIndex
(
unsigned int
uAtlasIndex )
inline
Sets the index used on the TextureAtlas.
- Warning
- Don't modify this value unless you know what you are doing
var setAtlasIndex
(
var
uAtlasIndex )
inline
Sets the index used on the TextureAtlas.
- Warning
- Don't modify this value unless you know what you are doing
local setAtlasIndex
(
local
uAtlasIndex )
inline
Sets the index used on the TextureAtlas.
- Warning
- Don't modify this value unless you know what you are doing
Sets the batch node to sprite.
- Warning
- This method is not recommended for game developers. Sample code for using batch node
var setBatchNode
(
var
pobSpriteBatchNode )
virtual
Sets the batch node to sprite.
- Warning
- This method is not recommended for game developers. Sample code for using batch node
local setBatchNode
(
local
pobSpriteBatchNode )
virtual
Sets the batch node to sprite.
- Warning
- This method is not recommended for game developers. Sample code for using batch node
Sets the source blending function.
- Parameters
-
blendFunc A structure with source and destination factor to specify pixel arithmetic, e.g. {GL_ONE, GL_ONE}, {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}.
Implements CCBlendProtocol.
var setBlendFunc
(
var
blendFunc )
inlinevirtual
Sets the source blending function.
- Parameters
-
blendFunc A structure with source and destination factor to specify pixel arithmetic, e.g. {GL_ONE, GL_ONE}, {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}.
Implements CCBlendProtocol.
local setBlendFunc
(
local
blendFunc )
inlinevirtual
Sets the source blending function.
- Parameters
-
blendFunc A structure with source and destination factor to specify pixel arithmetic, e.g. {GL_ONE, GL_ONE}, {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}.
Implements CCBlendProtocol.
virtual void setColor
(
const
ccColor3B &
color )
virtual
var setColor
(
var
color )
virtual
local setColor
(
local
color )
virtual
virtual void setDirty
(
bool
bDirty )
inlinevirtual
Makes the Sprite to be updated in the Atlas.
var setDirty
(
var
bDirty )
inlinevirtual
Makes the Sprite to be updated in the Atlas.
local setDirty
(
local
bDirty )
inlinevirtual
Makes the Sprite to be updated in the Atlas.
virtual void setDirtyRecursively
(
bool
bValue )
protectedvirtual
var setDirtyRecursively
(
var
bValue )
protectedvirtual
local setDirtyRecursively
(
local
bValue )
protectedvirtual
Sets a new display frame to the CCSprite.
var setDisplayFrame
(
var
pNewFrame )
virtual
Sets a new display frame to the CCSprite.
local setDisplayFrame
(
local
pNewFrame )
virtual
Sets a new display frame to the CCSprite.
virtual void
setDisplayFrameWithAnimationName
(
const char *
animationName,
int
frameIndex
)
virtual
Changes the display frame with animation name and index.
The animation name will be get from the CCAnimationCache
var
setDisplayFrameWithAnimationName
(
var
animationName,
var
frameIndex
)
virtual
Changes the display frame with animation name and index.
The animation name will be get from the CCAnimationCache
local
setDisplayFrameWithAnimationName
(
local
animationName,
local
frameIndex
)
virtual
Changes the display frame with animation name and index.
The animation name will be get from the CCAnimationCache
void setFlipX
(
bool
bFlipX )
Sets whether the sprite should be flipped horizontally or not.
- Parameters
-
bFlipX true if the sprite should be flipped horizaontally, false otherwise.
var setFlipX
(
var
bFlipX )
Sets whether the sprite should be flipped horizontally or not.
- Parameters
-
bFlipX true if the sprite should be flipped horizaontally, false otherwise.
local setFlipX
(
local
bFlipX )
Sets whether the sprite should be flipped horizontally or not.
- Parameters
-
bFlipX true if the sprite should be flipped horizaontally, false otherwise.
void setFlipY
(
bool
bFlipY )
Sets whether the sprite should be flipped vertically or not.
- Parameters
-
bFlipY true if the sprite should be flipped vertically, flase otherwise.
var setFlipY
(
var
bFlipY )
Sets whether the sprite should be flipped vertically or not.
- Parameters
-
bFlipY true if the sprite should be flipped vertically, flase otherwise.
local setFlipY
(
local
bFlipY )
Sets whether the sprite should be flipped vertically or not.
- Parameters
-
bFlipY true if the sprite should be flipped vertically, flase otherwise.
virtual void setOpacity
(
GLubyte
opacity )
virtual
Changes the opacity.
- Parameters
-
value Goes from 0 to 255, where 255 means fully opaque and 0 means fully transparent.
Reimplemented from CCNodeRGBA.
var setOpacity
(
var
opacity )
virtual
Changes the opacity.
- Parameters
-
value Goes from 0 to 255, where 255 means fully opaque and 0 means fully transparent.
Reimplemented from CCNodeRGBA.
local setOpacity
(
local
opacity )
virtual
Changes the opacity.
- Parameters
-
value Goes from 0 to 255, where 255 means fully opaque and 0 means fully transparent.
Reimplemented from CCNodeRGBA.
virtual void setOpacityModifyRGB
(
bool
bValue )
virtual
Changes the OpacityModifyRGB property.
If thie property is set to true, then the rendered color will be affected by opacity. Normally, r = r * opacity/255, g = g * opacity/255, b = b * opacity/255.
- Parameters
-
bValue true then the opacity will be applied as: glColor(R,G,B,opacity); false then the opacity will be applied as: glColor(opacity, opacity, opacity, opacity);
Reimplemented from CCNodeRGBA.
var setOpacityModifyRGB
(
var
bValue )
virtual
Changes the OpacityModifyRGB property.
If thie property is set to true, then the rendered color will be affected by opacity. Normally, r = r * opacity/255, g = g * opacity/255, b = b * opacity/255.
- Parameters
-
bValue true then the opacity will be applied as: glColor(R,G,B,opacity); false then the opacity will be applied as: glColor(opacity, opacity, opacity, opacity);
Reimplemented from CCNodeRGBA.
local setOpacityModifyRGB
(
local
bValue )
virtual
Changes the OpacityModifyRGB property.
If thie property is set to true, then the rendered color will be affected by opacity. Normally, r = r * opacity/255, g = g * opacity/255, b = b * opacity/255.
- Parameters
-
bValue true then the opacity will be applied as: glColor(R,G,B,opacity); false then the opacity will be applied as: glColor(opacity, opacity, opacity, opacity);
Reimplemented from CCNodeRGBA.
virtual void setPosition
(
const
CCPoint &
position )
virtual
Changes the position (x,y) of the node in OpenGL coordinates.
Usually we use ccp(x,y) to compose CCPoint object. The original point (0,0) is at the left-bottom corner of screen. For example, this codesnip sets the node in the center of screen.
node->setPosition(
ccp(size.width/2, size.height/2) )
- Parameters
-
position The position (x,y) of the node in OpenGL coordinates
Reimplemented from CCNode.
Reimplemented in CCPhysicsSprite.
var setPosition
(
var
position )
virtual
Changes the position (x,y) of the node in OpenGL coordinates.
Usually we use ccp(x,y) to compose CCPoint object. The original point (0,0) is at the left-bottom corner of screen. For example, this codesnip sets the node in the center of screen.
node->setPosition(
ccp(size.width/2, size.height/2) )
- Parameters
-
position The position (x,y) of the node in OpenGL coordinates
Reimplemented from CCNode.
Reimplemented in CCPhysicsSprite.
virtual void
setReorderChildDirtyRecursively
(
void
)
protectedvirtual
var setReorderChildDirtyRecursively
(
)
protectedvirtual
local
setReorderChildDirtyRecursively
(
)
protectedvirtual
virtual void setRotation
(
float
fRotation )
virtual
Sets the rotation (angle) of the node in degrees.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotation The roration of the node in degrees.
Reimplemented from CCNode.
Reimplemented in CCPhysicsSprite.
var setRotation
(
var
fRotation )
virtual
Sets the rotation (angle) of the node in degrees.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotation The roration of the node in degrees.
Reimplemented from CCNode.
Reimplemented in CCPhysicsSprite.
local setRotation
(
local
fRotation )
virtual
Sets the rotation (angle) of the node in degrees.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotation The roration of the node in degrees.
Reimplemented from CCNode.
Reimplemented in CCPhysicsSprite.
virtual void setRotationX
(
float
fRotaionX )
virtual
Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotationX The X rotation in degrees which performs a horizontal rotational skew.
Reimplemented from CCNode.
var setRotationX
(
var
fRotaionX )
virtual
Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotationX The X rotation in degrees which performs a horizontal rotational skew.
Reimplemented from CCNode.
local setRotationX
(
local
fRotaionX )
virtual
Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotationX The X rotation in degrees which performs a horizontal rotational skew.
Reimplemented from CCNode.
virtual void setRotationY
(
float
fRotationY )
virtual
Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotationY The Y rotation in degrees.
Reimplemented from CCNode.
var setRotationY
(
var
fRotationY )
virtual
Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotationY The Y rotation in degrees.
Reimplemented from CCNode.
local setRotationY
(
local
fRotationY )
virtual
Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew.
0 is the default rotation angle. Positive values rotate node clockwise, and negative values for anti-clockwise.
- Parameters
-
fRotationY The Y rotation in degrees.
Reimplemented from CCNode.
virtual void setScale
(
float
scale )
virtual
Changes both X and Y scale factor of the node.
1.0 is the default scale factor. It modifies the X and Y scale at the same time.
- Parameters
-
scale The scale factor for both X and Y axis.
Reimplemented from CCNode.
var setScale
(
var
scale )
virtual
Changes both X and Y scale factor of the node.
1.0 is the default scale factor. It modifies the X and Y scale at the same time.
- Parameters
-
scale The scale factor for both X and Y axis.
Reimplemented from CCNode.
local setScale
(
local
scale )
virtual
Changes both X and Y scale factor of the node.
1.0 is the default scale factor. It modifies the X and Y scale at the same time.
- Parameters
-
scale The scale factor for both X and Y axis.
Reimplemented from CCNode.
virtual void setScaleX
(
float
fScaleX )
virtual
Changes the scale factor on X axis of this node.
The deafult value is 1.0 if you haven't changed it before
- Parameters
-
fScaleX The scale factor on X axis.
Reimplemented from CCNode.
var setScaleX
(
var
fScaleX )
virtual
Changes the scale factor on X axis of this node.
The deafult value is 1.0 if you haven't changed it before
- Parameters
-
fScaleX The scale factor on X axis.
Reimplemented from CCNode.
local setScaleX
(
local
fScaleX )
virtual
Changes the scale factor on X axis of this node.
The deafult value is 1.0 if you haven't changed it before
- Parameters
-
fScaleX The scale factor on X axis.
Reimplemented from CCNode.
virtual void setScaleY
(
float
fScaleY )
virtual
Changes the scale factor on Y axis of this node.
The Default value is 1.0 if you haven't changed it before.
- Parameters
-
fScaleY The scale factor on Y axis.
Reimplemented from CCNode.
var setScaleY
(
var
fScaleY )
virtual
Changes the scale factor on Y axis of this node.
The Default value is 1.0 if you haven't changed it before.
- Parameters
-
fScaleY The scale factor on Y axis.
Reimplemented from CCNode.
local setScaleY
(
local
fScaleY )
virtual
Changes the scale factor on Y axis of this node.
The Default value is 1.0 if you haven't changed it before.
- Parameters
-
fScaleY The scale factor on Y axis.
Reimplemented from CCNode.
virtual void setSkewX
(
float
fSkewX )
virtual
Changes the X skew angle of the node in degrees.
This angle describes the shear distortion in the X direction. Thus, it is the angle between the Y axis and the left edge of the shape The default skewX angle is 0. Positive values distort the node in a CW direction.
- Parameters
-
fSkewX The X skew angle of the node in degrees.
Reimplemented from CCNode.
var setSkewX
(
var
fSkewX )
virtual
Changes the X skew angle of the node in degrees.
This angle describes the shear distortion in the X direction. Thus, it is the angle between the Y axis and the left edge of the shape The default skewX angle is 0. Positive values distort the node in a CW direction.
- Parameters
-
fSkewX The X skew angle of the node in degrees.
Reimplemented from CCNode.
local setSkewX
(
local
fSkewX )
virtual
Changes the X skew angle of the node in degrees.
This angle describes the shear distortion in the X direction. Thus, it is the angle between the Y axis and the left edge of the shape The default skewX angle is 0. Positive values distort the node in a CW direction.
- Parameters
-
fSkewX The X skew angle of the node in degrees.
Reimplemented from CCNode.
virtual void setSkewY
(
float
fSkewY )
virtual
Changes the Y skew angle of the node in degrees.
This angle describes the shear distortion in the Y direction. Thus, it is the angle between the X axis and the bottom edge of the shape The default skewY angle is 0. Positive values distort the node in a CCW direction.
- Parameters
-
fSkewY The Y skew angle of the node in degrees.
Reimplemented from CCNode.
var setSkewY
(
var
fSkewY )
virtual
Changes the Y skew angle of the node in degrees.
This angle describes the shear distortion in the Y direction. Thus, it is the angle between the X axis and the bottom edge of the shape The default skewY angle is 0. Positive values distort the node in a CCW direction.
- Parameters
-
fSkewY The Y skew angle of the node in degrees.
Reimplemented from CCNode.
local setSkewY
(
local
fSkewY )
virtual
Changes the Y skew angle of the node in degrees.
This angle describes the shear distortion in the Y direction. Thus, it is the angle between the X axis and the bottom edge of the shape The default skewY angle is 0. Positive values distort the node in a CCW direction.
- Parameters
-
fSkewY The Y skew angle of the node in degrees.
Reimplemented from CCNode.
Sets a new texuture.
It will be retained.
- Parameters
-
texture A valid
CCTexture2D object, which will be applied to this sprite object.
Implements CCTextureProtocol.
var setTexture
(
var
texture )
virtual
Sets a new texuture.
It will be retained.
- Parameters
-
texture A valid
CCTexture2D object, which will be applied to this sprite object.
Implements CCTextureProtocol.
local setTexture
(
local
texture )
virtual
Sets a new texuture.
It will be retained.
- Parameters
-
texture A valid
CCTexture2D object, which will be applied to this sprite object.
Implements CCTextureProtocol.
var setTextureAtlas
(
var
pobTextureAtlas )
inline
local setTextureAtlas
(
local
pobTextureAtlas )
inline
virtual void setTextureCoords
(
CCRect
rect )
protectedvirtual
var setTextureCoords
(
var
rect )
protectedvirtual
local setTextureCoords
(
local
rect )
protectedvirtual
virtual void setTextureRect
(
const
CCRect &
rect )
virtual
Updates the texture rect of the CCSprite in points.
It will call setTextureRect:rotated:untrimmedSize with rotated = NO, and utrimmedSize = rect.size.
var setTextureRect
(
var
rect )
virtual
Updates the texture rect of the CCSprite in points.
It will call setTextureRect:rotated:untrimmedSize with rotated = NO, and utrimmedSize = rect.size.
local setTextureRect
(
local
rect )
virtual
Updates the texture rect of the CCSprite in points.
It will call setTextureRect:rotated:untrimmedSize with rotated = NO, and utrimmedSize = rect.size.
virtual void setTextureRect
(
const
CCRect &
rect,
bool
rotated,
)
virtual
Sets the texture rect, rectRotated and untrimmed size of the CCSprite in points.
It will update the texture coordinates and the vertex rectangle.
var setTextureRect
(
var
rect,
var
rotated,
var
untrimmedSize
)
virtual
Sets the texture rect, rectRotated and untrimmed size of the CCSprite in points.
It will update the texture coordinates and the vertex rectangle.
local setTextureRect
(
local
rect,
local
rotated,
local
untrimmedSize
)
virtual
Sets the texture rect, rectRotated and untrimmed size of the CCSprite in points.
It will update the texture coordinates and the vertex rectangle.
virtual void setVertexRect
(
const
CCRect &
rect )
virtual
Sets the vertex rect.
It will be called internally by setTextureRect. Useful if you want to create 2x images from SD images in Retina Display. Do not call it manually. Use setTextureRect instead.
var setVertexRect
(
var
rect )
virtual
Sets the vertex rect.
It will be called internally by setTextureRect. Useful if you want to create 2x images from SD images in Retina Display. Do not call it manually. Use setTextureRect instead.
local setVertexRect
(
local
rect )
virtual
Sets the vertex rect.
It will be called internally by setTextureRect. Useful if you want to create 2x images from SD images in Retina Display. Do not call it manually. Use setTextureRect instead.
virtual void setVertexZ
(
float
vertexZ )
virtual
Sets the real OpenGL Z vertex.
Differences between openGL Z vertex and cocos2d Z order:
- OpenGL Z modifies the Z vertex, and not the Z order in the relation between parent-children
- OpenGL Z might require to set 2D projection
- cocos2d Z order works OK if all the nodes uses the same openGL Z vertex. eg: vertexZ = 0
- Warning
- Use it at your own risk since it might break the cocos2d parent-children z order
- Parameters
-
fVertexZ OpenGL Z vertex of this node.
Reimplemented from CCNode.
var setVertexZ
(
var
vertexZ )
virtual
Sets the real OpenGL Z vertex.
Differences between openGL Z vertex and cocos2d Z order:
- OpenGL Z modifies the Z vertex, and not the Z order in the relation between parent-children
- OpenGL Z might require to set 2D projection
- cocos2d Z order works OK if all the nodes uses the same openGL Z vertex. eg: vertexZ = 0
- Warning
- Use it at your own risk since it might break the cocos2d parent-children z order
- Parameters
-
fVertexZ OpenGL Z vertex of this node.
Reimplemented from CCNode.
local setVertexZ
(
local
vertexZ )
virtual
Sets the real OpenGL Z vertex.
Differences between openGL Z vertex and cocos2d Z order:
- OpenGL Z modifies the Z vertex, and not the Z order in the relation between parent-children
- OpenGL Z might require to set 2D projection
- cocos2d Z order works OK if all the nodes uses the same openGL Z vertex. eg: vertexZ = 0
- Warning
- Use it at your own risk since it might break the cocos2d parent-children z order
- Parameters
-
fVertexZ OpenGL Z vertex of this node.
Reimplemented from CCNode.
virtual void setVisible
(
bool
visible )
virtual
Sets whether the node is visible.
The default value is true, a node is default to visible
- Parameters
-
visible true if the node is visible, false if the node is hidden.
Reimplemented from CCNode.
var setVisible
(
var
visible )
virtual
Sets whether the node is visible.
The default value is true, a node is default to visible
- Parameters
-
visible true if the node is visible, false if the node is hidden.
Reimplemented from CCNode.
local setVisible
(
local
visible )
virtual
Sets whether the node is visible.
The default value is true, a node is default to visible
- Parameters
-
visible true if the node is visible, false if the node is hidden.
Reimplemented from CCNode.
virtual void sortAllChildren
(
)
virtual
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
This appraoch can improves the performance massively.
- Note
- Don't call this manually unless a child added needs to be removed in the same frame
Reimplemented from CCNode.
var sortAllChildren
(
)
virtual
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
This appraoch can improves the performance massively.
- Note
- Don't call this manually unless a child added needs to be removed in the same frame
Reimplemented from CCNode.
local sortAllChildren
(
)
virtual
Sorts the children array once before drawing, instead of every time when a child is added or reordered.
This appraoch can improves the performance massively.
- Note
- Don't call this manually unless a child added needs to be removed in the same frame
Reimplemented from CCNode.
virtual void updateBlendFunc
(
void
)
protectedvirtual
var updateBlendFunc
(
)
protectedvirtual
local updateBlendFunc
(
)
protectedvirtual
void updateColor
(
void
)
protected
var updateColor
(
)
protected
local updateColor
(
)
protected
virtual void updateDisplayedColor
(
const
ccColor3B &
color )
virtual
recursive method that updates display color
Reimplemented from CCNodeRGBA.
var updateDisplayedColor
(
var
color )
virtual
recursive method that updates display color
Reimplemented from CCNodeRGBA.
local updateDisplayedColor
(
local
color )
virtual
recursive method that updates display color
Reimplemented from CCNodeRGBA.
virtual void updateDisplayedOpacity
(
GLubyte
opacity )
virtual
recursive method that updates the displayed opacity.
Reimplemented from CCNodeRGBA.
var updateDisplayedOpacity
(
var
opacity )
virtual
recursive method that updates the displayed opacity.
Reimplemented from CCNodeRGBA.
local updateDisplayedOpacity
(
local
opacity )
virtual
recursive method that updates the displayed opacity.
Reimplemented from CCNodeRGBA.
virtual void updateTransform
(
void
)
virtual
Updates the quad according the rotation, position, scale values.
Reimplemented from CCNode.
Reimplemented in CCSkin.
var updateTransform
(
)
virtual
Updates the quad according the rotation, position, scale values.
Reimplemented from CCNode.
Reimplemented in CCSkin.
local updateTransform
(
)
virtual
Updates the quad according the rotation, position, scale values.
Reimplemented from CCNode.
Reimplemented in CCSkin.
Variable Documentation
Used batch node (weak reference)
Used batch node (weak reference)
Used batch node (weak reference)
Whether the sprite is flipped horizaontally or not.
Whether the sprite is flipped horizaontally or not.
Whether the sprite is flipped horizaontally or not.
bool m_bHasChildren
protected
Whether all of the sprite's children needs to be updated.
var m_bHasChildren
protected
Whether all of the sprite's children needs to be updated.
local m_bHasChildren
protected
Whether all of the sprite's children needs to be updated.
bool m_bOpacityModifyRGB
protected
var m_bOpacityModifyRGB
protected
local m_bOpacityModifyRGB
protected
bool m_bRectRotated
protected
var m_bRectRotated
protected
local m_bRectRotated
protected
bool m_bRecursiveDirty
protected
Whether the sprite needs to be updated.
var m_bRecursiveDirty
protected
Whether the sprite needs to be updated.
local m_bRecursiveDirty
protected
Whether the sprite needs to be updated.
bool m_bShouldBeHidden
protected
Whether the sprite contains children.
var m_bShouldBeHidden
protected
Whether the sprite contains children.
local m_bShouldBeHidden
protected
Whether the sprite contains children.
CCPoint m_obOffsetPosition
protected
Whether the texture is rotated.
var m_obOffsetPosition
protected
Whether the texture is rotated.
local m_obOffsetPosition
protected
Whether the texture is rotated.
CCRect m_obRect
protected
CCPoint
m_obUnflippedOffsetPositionFromCenter
protected
var
m_obUnflippedOffsetPositionFromCenter
protected
local
m_obUnflippedOffsetPositionFromCenter
protected
CCSpriteBatchNode* m_pobBatchNode
protected
Absolute (real) Index on the SpriteSheet.
var m_pobBatchNode
protected
Absolute (real) Index on the SpriteSheet.
local m_pobBatchNode
protected
Absolute (real) Index on the SpriteSheet.
CCTexture2D* m_pobTexture
protected
var m_pobTexture
protected
local m_pobTexture
protected
CCTextureAtlas* m_pobTextureAtlas
protected
var m_sBlendFunc
protected
local m_sBlendFunc
protected
CCAffineTransform
m_transformToBatch
protected
should not be drawn because one of the ancestors is not visible
var m_transformToBatch
protected
should not be drawn because one of the ancestors is not visible
local m_transformToBatch
protected
should not be drawn because one of the ancestors is not visible
unsigned int m_uAtlasIndex
protected
var m_uAtlasIndex
protected
local m_uAtlasIndex
protected