cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
Sprite Nodes

Classes

class  CCAnimationFrame
 CCAnimationFrame A frame of the animation. More...
 
class  CCAnimation
 A CCAnimation object is used to perform animations on the CCSprite objects. More...
 
class  CCAnimationCache
 Singleton that manages the Animations. More...
 
class  CCSprite
 CCSprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_graphics) ) More...
 
class  CCSpriteBatchNode
 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...
 
class  CCSpriteFrame
 A CCSpriteFrame has: More...
 
class  CCSpriteFrameCache
 Singleton that handles the loading of the sprite frames. More...
 

Macros

#define CCSpriteIndexNotInitialized   0xffffffff
 
#define kDefaultSpriteBatchCapacity   29
 

Functions

void updateColor (void)
 
virtual void updateBlendFunc (void)
 
virtual void setReorderChildDirtyRecursively (void)
 
virtual void setDirtyRecursively (bool bValue)
 

Variables

CCTextureAtlasm_pobTextureAtlas
 
unsigned int m_uAtlasIndex
 CCSpriteBatchNode texture atlas (weak reference) More...
 
CCSpriteBatchNodem_pobBatchNode
 Absolute (real) Index on the SpriteSheet. More...
 
bool m_bDirty
 Used batch node (weak reference) More...
 
bool m_bRecursiveDirty
 Whether the sprite needs to be updated. More...
 
bool m_bHasChildren
 Whether all of the sprite's children needs to be updated. More...
 
bool m_bShouldBeHidden
 Whether the sprite contains children. More...
 
CCAffineTransform m_transformToBatch
 should not be drawn because one of the ancestors is not visible More...
 
ccBlendFunc m_sBlendFunc
 
CCTexture2Dm_pobTexture
 It's required for CCTextureProtocol inheritance. More...
 
CCRect m_obRect
 CCTexture2D object that is used to render the sprite. More...
 
bool m_bRectRotated
 Retangle of CCTexture2D. More...
 
CCPoint m_obOffsetPosition
 Whether the texture is rotated. More...
 
CCPoint m_obUnflippedOffsetPositionFromCenter
 
ccV3F_C4B_T2F_Quad m_sQuad
 
bool m_bOpacityModifyRGB
 
bool m_bFlipX
 
bool m_bFlipY
 Whether the sprite is flipped horizaontally or not. More...
 
bool m_bDontDraw
 Whether the sprite is flipped vertically or not. More...
 
float m_fTlVertexMod
 Whether the sprite is flipped vertically or not. More...
 
float m_fTrVertexMod
 Whether the sprite is flipped vertically or not. More...
 
float m_fBlVertexMod
 Whether the sprite is flipped vertically or not. More...
 
float m_fBrVertexMod
 Whether the sprite is flipped vertically or not. More...
 
char m_achPadding [16]
 
bool m_bUnknown
 Whether the sprite is flipped vertically or not. More...
 
int m_nUnknown
 Whether the sprite is flipped vertically or not. More...
 
bool getDontDraw (void)
 Whether the sprite is flipped vertically or not. More...
 
void setDontDraw (bool var)
 Whether the sprite is flipped vertically or not. More...
 
float getTlVertexMod (void)
 Whether the sprite is flipped vertically or not. More...
 
void setTlVertexMod (float var)
 Whether the sprite is flipped vertically or not. More...
 
float getTrVertexMod (void)
 Whether the sprite is flipped vertically or not. More...
 
void setTrVertexMod (float var)
 Whether the sprite is flipped vertically or not. More...
 
float getBlVertexMod (void)
 Whether the sprite is flipped vertically or not. More...
 
void setBlVertexMod (float var)
 Whether the sprite is flipped vertically or not. More...
 
float getBrVertexMod (void)
 Whether the sprite is flipped vertically or not. More...
 
void setBrVertexMod (float var)
 Whether the sprite is flipped vertically or not. More...
 

Creators

static CCSpritecreate ()
 Creates an empty sprite without texture. More...
 
static CCSpritecreate (const char *pszFileName)
 Creates a sprite with an image filename. More...
 
static CCSpritecreate (const char *pszFileName, const CCRect &rect)
 Creates a sprite with an image filename and a rect. More...
 
static CCSpritecreateWithTexture (CCTexture2D *pTexture)
 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...
 
static CCSpritecreateWithTexture (CCTexture2D *pTexture, const CCRect &rect)
 Creates a sprite with a texture and a rect. More...
 
static CCSpritecreateWithSpriteFrame (CCSpriteFrame *pSpriteFrame)
 Creates a sprite with an sprite frame. More...
 
static CCSpritecreateWithSpriteFrameName (const char *pszSpriteFrameName)
 Creates a sprite with an sprite frame name. More...
 

Initializers

 CCSprite (void)
 Default constructor ctor. More...
 
virtual ~CCSprite (void)
 Default destructor NA NA. More...
 
virtual bool init (void)
 Initializes an empty sprite with nothing init. More...
 
virtual bool initWithTexture (CCTexture2D *pTexture)
 Initializes a sprite with a texture. More...
 
virtual bool initWithTexture (CCTexture2D *pTexture, const CCRect &rect)
 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...
 
virtual bool initWithSpriteFrame (CCSpriteFrame *pSpriteFrame)
 Initializes a sprite with an SpriteFrame. More...
 
virtual bool initWithSpriteFrameName (const char *pszSpriteFrameName)
 Initializes a sprite with an sprite frame name. More...
 
virtual bool initWithFile (const char *pszFilename)
 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...
 
virtual void setChildColor (const ccColor3B &)
 
virtual void setChildOpacity (GLubyte)
 

Functions inherited from CCTextureProtocol

virtual void setTexture (CCTexture2D *texture)
 NA. More...
 
virtual CCTexture2DgetTexture (void)
 NA. More...
 
void setBlendFunc (ccBlendFunc blendFunc)
 NA. More...
 
ccBlendFunc getBlendFunc (void)
 NA. More...
 

Functions inherited from CCNode

virtual void setScaleX (float fScaleX)
 NA. More...
 
virtual void setScaleY (float fScaleY)
 NA. More...
 
virtual void setPosition (const CCPoint &pos)
 NA. More...
 
virtual void setRotation (float fRotation)
 NA. More...
 
virtual void setRotationX (float fRotationX)
 NA. More...
 
virtual void setRotationY (float fRotationY)
 NA. More...
 
virtual void setSkewX (float sx)
 NA. More...
 
virtual void setSkewY (float sy)
 NA. More...
 
virtual void removeChild (CCNode *pChild, bool bCleanup)
 NA. More...
 
virtual void removeAllChildrenWithCleanup (bool bCleanup)
 NA. More...
 
virtual void reorderChild (CCNode *pChild, int zOrder)
 NA. More...
 
virtual void addChild (CCNode *pChild)
 NA. More...
 
virtual void addChild (CCNode *pChild, int zOrder)
 NA. More...
 
virtual void addChild (CCNode *pChild, int zOrder, int tag)
 NA. More...
 
virtual void sortAllChildren ()
 NA. More...
 
virtual void setScale (float fScale)
 NA. More...
 
virtual void setVertexZ (float fVertexZ)
 NA. More...
 
virtual void setAnchorPoint (const CCPoint &anchor)
 NA. More...
 
virtual void ignoreAnchorPointForPosition (bool value)
 NA. More...
 
virtual void setVisible (bool bVisible)
 NA. More...
 
virtual void draw (void)
 NA. More...
 

Functions inherited from CCNodeRGBA

virtual void setColor (const ccColor3B &color3)
 Changes the color with R,G,B bytes. More...
 
virtual void updateDisplayedColor (const ccColor3B &parentColor)
 recursive method that updates display color More...
 
virtual void setOpacity (GLubyte opacity)
 Changes the opacity. More...
 
virtual void setOpacityModifyRGB (bool modify)
 Changes the OpacityModifyRGB property. More...
 
virtual bool isOpacityModifyRGB (void)
 Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity) More...
 
virtual void updateDisplayedOpacity (GLubyte parentOpacity)
 recursive method that updates the displayed opacity. More...
 

BatchNode methods

virtual void updateTransform (void)
 Updates the quad according the rotation, position, scale values. More...
 
virtual CCSpriteBatchNodegetBatchNode (void)
 Returns the batch node object if this sprite is rendered by CCSpriteBatchNode. More...
 
virtual void setBatchNode (CCSpriteBatchNode *pobSpriteBatchNode)
 Sets the batch node to sprite. More...
 
virtual void refreshTextureRect (void)
 

Texture methods

virtual void setTextureRect (const CCRect &rect)
 Updates the texture rect of the CCSprite in points. More...
 
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...
 
virtual void setVertexRect (const CCRect &rect)
 Sets the vertex rect. More...
 

Frames methods

virtual void setDisplayFrame (CCSpriteFrame *pNewFrame)
 Sets a new display frame to the CCSprite. More...
 
virtual bool isFrameDisplayed (CCSpriteFrame *pFrame)
 Returns whether or not a CCSpriteFrame is being displayed. More...
 
virtual CCSpriteFramedisplayFrame (void)
 Returns the current displayed frame. More...
 

Animation methods

virtual void setDisplayFrameWithAnimationName (const char *animationName, int frameIndex)
 Changes the display frame with animation name and index. More...
 

Sprite Properties' setter/getters

virtual bool isDirty (void)
 Whether or not the Sprite needs to be updated in the Atlas. More...
 
virtual void setDirty (bool bDirty)
 Makes the Sprite to be updated in the Atlas. More...
 
ccV3F_C4B_T2F_Quad getQuad (void)
 Returns the quad (tex coords, vertex coords and color) information. More...
 
bool isTextureRectRotated (void)
 Returns whether or not the texture rectangle is rotated. More...
 
unsigned int getAtlasIndex (void)
 Returns the index used on the TextureAtlas. More...
 
void setAtlasIndex (unsigned int uAtlasIndex)
 Sets the index used on the TextureAtlas. More...
 
const CCRectgetTextureRect (void)
 Returns the rect of the CCSprite in points. More...
 
CCTextureAtlasgetTextureAtlas (void)
 Gets the weak reference of the CCTextureAtlas when the sprite is rendered using via CCSpriteBatchNode. More...
 
void setTextureAtlas (CCTextureAtlas *pobTextureAtlas)
 Sets the weak reference of the CCTextureAtlas when the sprite is rendered using via CCSpriteBatchNode. More...
 
const CCPointgetOffsetPosition (void)
 Gets the offset position of the sprite. More...
 
bool isFlipX (void)
 Returns the flag which indicates whether the sprite is flipped horizontally or not. More...
 
void setFlipX (bool bFlipX)
 Sets whether the sprite should be flipped horizontally or not. More...
 
bool isFlipY (void)
 Return the flag which indicates whether the sprite is flipped vertically or not. More...
 
void setFlipY (bool bFlipY)
 Sets whether the sprite should be flipped vertically or not. More...
 
virtual void setTextureCoords (const CCRect &rect)
 

Detailed Description

Macro Definition Documentation

◆ CCSpriteIndexNotInitialized

#define CCSpriteIndexNotInitialized   0xffffffff

◆ kDefaultSpriteBatchCapacity

#define kDefaultSpriteBatchCapacity   29

Function Documentation

◆ CCSprite()

CCSprite ( void  )

Default constructor ctor.

◆ ~CCSprite()

virtual ~CCSprite ( void  )
virtual

Default destructor NA NA.

◆ addChild() [1/3]

virtual void addChild ( CCNode pChild)
virtual

NA.

Reimplemented from CCNode.

◆ addChild() [2/3]

virtual void addChild ( CCNode pChild,
int  zOrder 
)
virtual

NA.

Reimplemented from CCNode.

◆ addChild() [3/3]

virtual void addChild ( CCNode pChild,
int  zOrder,
int  tag 
)
virtual

NA.

Reimplemented from CCNode.

◆ create() [1/3]

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.

◆ create() [2/3]

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
pszFileNameThe string which indicates a path to image file, e.g., "scene1/monster.png".
Returns
A valid sprite object that is marked as autoreleased.

◆ create() [3/3]

static CCSprite * create ( const char *  pszFileName,
const CCRect rect 
)
static

Creates a sprite with an image filename and a rect.

Parameters
pszFileNameThe string wich indicates a path to image file, e.g., "scene1/monster.png"
rectOnly the contents inside rect of pszFileName's texture will be applied for this sprite.
Returns
A valid sprite object that is marked as autoreleased.

◆ createWithSpriteFrame()

static CCSprite * createWithSpriteFrame ( CCSpriteFrame pSpriteFrame)
static

Creates a sprite with an sprite frame.

Parameters
pSpriteFrameA sprite frame which involves a texture and a rect
Returns
A valid sprite object that is marked as autoreleased.

◆ createWithSpriteFrameName()

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
pszSpriteFrameNameA null terminated string which indicates the sprite frame name.
Returns
A valid sprite object that is marked as autoreleased.

◆ createWithTexture() [1/2]

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
pTextureA pointer to a CCTexture2D object.
Returns
A valid sprite object that is marked as autoreleased.

◆ createWithTexture() [2/2]

static CCSprite * createWithTexture ( CCTexture2D pTexture,
const CCRect rect 
)
static

Creates a sprite with a texture and a rect.

After creation, the offset will be (0,0).

Parameters
pTextureA pointer to an existing CCTexture2D object. You can use a CCTexture2D object for many sprites.
rectOnly the contents inside the rect of this texture will be applied for this sprite.
Returns
A valid sprite object that is marked as autoreleased.

◆ displayFrame()

virtual CCSpriteFrame * displayFrame ( void  )
virtual

Returns the current displayed frame.

NA

◆ draw()

virtual void draw ( void  )
virtual

NA.

Reimplemented from CCNode.

Reimplemented in CCTextFieldTTF.

◆ getAtlasIndex()

unsigned int getAtlasIndex ( void  )
inline

Returns the index used on the TextureAtlas.

◆ getBatchNode()

virtual CCSpriteBatchNode * getBatchNode ( void  )
virtual

Returns the batch node object if this sprite is rendered by CCSpriteBatchNode.

Returns
The CCSpriteBatchNode object if this sprite is rendered by CCSpriteBatchNode, NULL if the sprite isn't used batch node.

◆ getBlendFunc()

ccBlendFunc getBlendFunc ( void  )
inlinevirtual

NA.

Implements CCBlendProtocol.

◆ getBlVertexMod()

float getBlVertexMod ( void  )

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ getBrVertexMod()

float getBrVertexMod ( void  )

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ getDontDraw()

bool getDontDraw ( void  )

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ getOffsetPosition()

const CCPoint & getOffsetPosition ( void  )
inline

Gets the offset position of the sprite.

Calculated automatically by editors like Zwoptex.

◆ getQuad()

ccV3F_C4B_T2F_Quad getQuad ( void  )
inline

Returns the quad (tex coords, vertex coords and color) information.

NA

◆ getTexture()

virtual CCTexture2D * getTexture ( void  )
virtual

NA.

Implements CCTextureProtocol.

◆ getTextureAtlas()

CCTextureAtlas * getTextureAtlas ( void  )
inline

Gets the weak reference of the CCTextureAtlas when the sprite is rendered using via CCSpriteBatchNode.

◆ getTextureRect()

const CCRect & getTextureRect ( void  )
inline

Returns the rect of the CCSprite in points.

◆ getTlVertexMod()

float getTlVertexMod ( void  )

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ getTrVertexMod()

float getTrVertexMod ( void  )

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ ignoreAnchorPointForPosition()

virtual void ignoreAnchorPointForPosition ( bool  value)
virtual

NA.

Reimplemented from CCNode.

◆ init()

virtual bool init ( void  )
virtual

Initializes an empty sprite with nothing init.

Reimplemented from CCNodeRGBA.

Reimplemented in CCLabelTTF.

◆ initWithFile() [1/2]

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
pszFilenameThe path to an image file in local file system
Returns
true if the sprite is initialized properly, false otherwise. init

◆ initWithFile() [2/2]

virtual bool initWithFile ( const char *  pszFilename,
const CCRect 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
pszFilenameThe path to an image file in local file system.
rectThe rectangle assigned the content area from texture.
Returns
true if the sprite is initialized properly, false otherwise. init

◆ initWithSpriteFrame()

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
pSpriteFrameA CCSpriteFrame object. It should includes a valid texture and a rect
Returns
true if the sprite is initialized properly, false otherwise.

◆ initWithSpriteFrameName()

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
pszSpriteFrameNameA key string that can fected a volid CCSpriteFrame from CCSpriteFrameCache
Returns
true if the sprite is initialized properly, false otherwise.

◆ initWithTexture() [1/3]

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
pTextureA pointer to an existing CCTexture2D object. You can use a CCTexture2D object for many sprites.
Returns
true if the sprite is initialized properly, false otherwise.

◆ initWithTexture() [2/3]

virtual bool initWithTexture ( CCTexture2D pTexture,
const CCRect rect 
)
virtual

Initializes a sprite with a texture and a rect.

After initialization, the offset will be (0,0).

Parameters
pTextureA pointer to an exisiting CCTexture2D object. You can use a CCTexture2D object for many sprites.
rectOnly the contents inside rect of this texture will be applied for this sprite.
Returns
true if the sprite is initialized properly, false otherwise.

◆ initWithTexture() [3/3]

virtual bool initWithTexture ( CCTexture2D pTexture,
const CCRect rect,
bool  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
pTextureA CCTexture2D object whose texture will be applied to this sprite.
rectA rectangle assigned the contents of texture.
rotatedWhether or not the texture rectangle is rotated.
Returns
true if the sprite is initialized properly, false otherwise.

◆ isDirty()

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.

◆ isFlipX()

bool isFlipX ( void  )

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. isFlippedX

◆ isFlipY()

bool isFlipY ( void  )

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. isFlippedY

◆ isFrameDisplayed()

virtual bool isFrameDisplayed ( CCSpriteFrame pFrame)
virtual

Returns whether or not a CCSpriteFrame is being displayed.

◆ isOpacityModifyRGB()

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.

◆ isTextureRectRotated()

bool isTextureRectRotated ( void  )
inline

Returns whether or not the texture rectangle is rotated.

◆ refreshTextureRect()

virtual void refreshTextureRect ( void  )
virtual
Remarks
Added by RobTop. See RT_ADD for more info.

◆ removeAllChildrenWithCleanup()

virtual void removeAllChildrenWithCleanup ( bool  bCleanup)
virtual

NA.

Reimplemented from CCNode.

◆ removeChild()

virtual void removeChild ( CCNode pChild,
bool  bCleanup 
)
virtual

NA.

Reimplemented from CCNode.

◆ reorderChild()

virtual void reorderChild ( CCNode pChild,
int  zOrder 
)
virtual

NA.

Reimplemented from CCNode.

◆ setAnchorPoint()

virtual void setAnchorPoint ( const CCPoint anchor)
virtual

NA.

Reimplemented from CCNode.

◆ setAtlasIndex()

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

◆ setBatchNode()

virtual void setBatchNode ( CCSpriteBatchNode pobSpriteBatchNode)
virtual

Sets the batch node to sprite.

Warning
This method is not recommended for game developers. Sample code for using batch node
CCSpriteBatchNode *batch = CCSpriteBatchNode::create("Images/grossini_dance_atlas.png", 15);
CCSprite *sprite = CCSprite::createWithTexture(batch->getTexture(), CCRectMake(0, 0, 57, 57));
batch->addChild(sprite);
layer->addChild(batch);
CCSpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL...
Definition: CCSpriteBatchNode.h:64
virtual void addChild(CCNode *child)
Adds a child to the container with z-order as 0.
virtual CCTexture2D * getTexture(void)
Returns the currently used texture.
CCSprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_graphics) )
Definition: CCSprite.h:86
static CCNode * create(void)
Allocates and initializes a node.
#define CCRectMake(x, y, width, height)
Definition: CCGeometry.h:336
static CCSprite * createWithTexture(CCTexture2D *pTexture)
Creates a sprite with an exsiting texture contained in a CCTexture2D object After creation,...

◆ setBlendFunc()

void setBlendFunc ( ccBlendFunc  blendFunc)
inlinevirtual

NA.

Implements CCBlendProtocol.

◆ setBlVertexMod()

void setBlVertexMod ( float  var)

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ setBrVertexMod()

void setBrVertexMod ( float  var)

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ setChildColor()

virtual void setChildColor ( const ccColor3B )
virtual
Remarks
Added by RobTop. See RT_ADD for more info.

◆ setChildOpacity()

virtual void setChildOpacity ( GLubyte  )
virtual
Remarks
Added by RobTop. See RT_ADD for more info.

◆ setColor()

virtual void setColor ( const ccColor3B color)
virtual

Changes the color with R,G,B bytes.

Parameters
colorExample: ccc3(255,100,0) means R=255, G=100, B=0

Reimplemented from CCNodeRGBA.

◆ setDirty()

virtual void setDirty ( bool  bDirty)
inlinevirtual

Makes the Sprite to be updated in the Atlas.

◆ setDirtyRecursively()

virtual void setDirtyRecursively ( bool  bValue)
protectedvirtual

◆ setDisplayFrame()

virtual void setDisplayFrame ( CCSpriteFrame pNewFrame)
virtual

Sets a new display frame to the CCSprite.

◆ setDisplayFrameWithAnimationName()

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

◆ setDontDraw()

void setDontDraw ( bool  var)

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ setFlipX()

void setFlipX ( bool  bFlipX)

Sets whether the sprite should be flipped horizontally or not.

Parameters
bFlipXtrue if the sprite should be flipped horizaontally, false otherwise.

◆ setFlipY()

void setFlipY ( bool  bFlipY)

Sets whether the sprite should be flipped vertically or not.

Parameters
bFlipYtrue if the sprite should be flipped vertically, flase otherwise.

◆ setOpacity()

virtual void setOpacity ( GLubyte  opacity)
virtual

Changes the opacity.

Parameters
valueGoes from 0 to 255, where 255 means fully opaque and 0 means fully transparent.

Reimplemented from CCNodeRGBA.

◆ setOpacityModifyRGB()

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
bValuetrue 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.

◆ setPosition()

virtual void setPosition ( const CCPoint pos)
virtual

NA.

Reimplemented from CCNode.

◆ setReorderChildDirtyRecursively()

virtual void setReorderChildDirtyRecursively ( void  )
protectedvirtual

◆ setRotation()

virtual void setRotation ( float  fRotation)
virtual

NA.

Reimplemented from CCNode.

◆ setRotationX()

virtual void setRotationX ( float  fRotationX)
virtual

NA.

Reimplemented from CCNode.

◆ setRotationY()

virtual void setRotationY ( float  fRotationY)
virtual

NA.

Reimplemented from CCNode.

◆ setScale()

virtual void setScale ( float  fScale)
virtual

NA.

Reimplemented from CCNode.

◆ setScaleX()

virtual void setScaleX ( float  fScaleX)
virtual

NA.

Reimplemented from CCNode.

◆ setScaleY()

virtual void setScaleY ( float  fScaleY)
virtual

NA.

Reimplemented from CCNode.

◆ setSkewX()

virtual void setSkewX ( float  sx)
virtual

NA.

Reimplemented from CCNode.

◆ setSkewY()

virtual void setSkewY ( float  sy)
virtual

NA.

Reimplemented from CCNode.

◆ setTexture()

virtual void setTexture ( CCTexture2D texture)
virtual

NA.

Implements CCTextureProtocol.

◆ setTextureAtlas()

void setTextureAtlas ( CCTextureAtlas pobTextureAtlas)
inline

Sets the weak reference of the CCTextureAtlas when the sprite is rendered using via CCSpriteBatchNode.

◆ setTextureCoords()

virtual void setTextureCoords ( const CCRect rect)
protectedvirtual
Remarks
Added by RobTop. See RT_ADD for more info.

◆ setTextureRect() [1/2]

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.

◆ setTextureRect() [2/2]

virtual void setTextureRect ( const CCRect rect,
bool  rotated,
const CCSize 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.

◆ setTlVertexMod()

void setTlVertexMod ( float  var)

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ setTrVertexMod()

void setTrVertexMod ( float  var)

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ setVertexRect()

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.

◆ setVertexZ()

virtual void setVertexZ ( float  fVertexZ)
virtual

NA.

Reimplemented from CCNode.

◆ setVisible()

virtual void setVisible ( bool  bVisible)
virtual

NA.

Reimplemented from CCNode.

◆ sortAllChildren()

virtual void sortAllChildren ( )
virtual

NA.

Reimplemented from CCNode.

◆ updateBlendFunc()

virtual void updateBlendFunc ( void  )
protectedvirtual

◆ updateColor()

void updateColor ( void  )
protected

◆ updateDisplayedColor()

virtual void updateDisplayedColor ( const ccColor3B color)
virtual

recursive method that updates display color

Reimplemented from CCNodeRGBA.

◆ updateDisplayedOpacity()

virtual void updateDisplayedOpacity ( GLubyte  opacity)
virtual

recursive method that updates the displayed opacity.

Reimplemented from CCNodeRGBA.

◆ updateTransform()

virtual void updateTransform ( void  )
virtual

Updates the quad according the rotation, position, scale values.

Reimplemented from CCNode.

Variable Documentation

◆ m_achPadding

char m_achPadding[ 16]
Warning
This field is unknown and may contain data of any type. Do not use.

◆ m_bDirty

bool m_bDirty
protected

Used batch node (weak reference)

◆ m_bDontDraw

bool m_bDontDraw
protected

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_bFlipX

bool m_bFlipX
protected

◆ m_bFlipY

bool m_bFlipY
protected

Whether the sprite is flipped horizaontally or not.

◆ m_bHasChildren

bool m_bHasChildren
protected

Whether all of the sprite's children needs to be updated.

◆ m_bOpacityModifyRGB

bool m_bOpacityModifyRGB
protected

◆ m_bRectRotated

bool m_bRectRotated
protected

Retangle of CCTexture2D.

◆ m_bRecursiveDirty

bool m_bRecursiveDirty
protected

Whether the sprite needs to be updated.

◆ m_bShouldBeHidden

bool m_bShouldBeHidden
protected

Whether the sprite contains children.

◆ m_bUnknown

bool m_bUnknown

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_fBlVertexMod

float m_fBlVertexMod
protected

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_fBrVertexMod

float m_fBrVertexMod
protected

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_fTlVertexMod

float m_fTlVertexMod
protected

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_fTrVertexMod

float m_fTrVertexMod
protected

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_nUnknown

int m_nUnknown

Whether the sprite is flipped vertically or not.

Remarks
Added by RobTop. See RT_ADD for more info.

◆ m_obOffsetPosition

CCPoint m_obOffsetPosition
protected

Whether the texture is rotated.

◆ m_obRect

CCRect m_obRect
protected

CCTexture2D object that is used to render the sprite.

◆ m_obUnflippedOffsetPositionFromCenter

CCPoint m_obUnflippedOffsetPositionFromCenter
protected

◆ m_pobBatchNode

CCSpriteBatchNode* m_pobBatchNode
protected

Absolute (real) Index on the SpriteSheet.

◆ m_pobTexture

CCTexture2D* m_pobTexture
protected

It's required for CCTextureProtocol inheritance.

◆ m_pobTextureAtlas

CCTextureAtlas* m_pobTextureAtlas
protected

◆ m_sBlendFunc

ccBlendFunc m_sBlendFunc
protected

◆ m_sQuad

ccV3F_C4B_T2F_Quad m_sQuad
protected

◆ m_transformToBatch

CCAffineTransform m_transformToBatch
protected

should not be drawn because one of the ancestors is not visible

◆ m_uAtlasIndex

unsigned int m_uAtlasIndex
protected

CCSpriteBatchNode texture atlas (weak reference)