cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
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 | |
CCTextureAtlas * | m_pobTextureAtlas |
unsigned int | m_uAtlasIndex |
CCSpriteBatchNode texture atlas (weak reference) More... | |
CCSpriteBatchNode * | m_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 |
CCTexture2D * | m_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 CCSprite * | create () |
Creates an empty sprite without texture. More... | |
static CCSprite * | create (const char *pszFileName) |
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... | |
static CCSprite * | createWithTexture (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 CCSprite * | createWithTexture (CCTexture2D *pTexture, const CCRect &rect) |
Creates a sprite with a texture and a rect. More... | |
static CCSprite * | createWithSpriteFrame (CCSpriteFrame *pSpriteFrame) |
Creates a sprite with an sprite frame. More... | |
static CCSprite * | createWithSpriteFrameName (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 CCTexture2D * | getTexture (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 CCSpriteBatchNode * | getBatchNode (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 CCSpriteFrame * | displayFrame (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 CCRect & | getTextureRect (void) |
Returns the rect of the CCSprite in points. More... | |
CCTextureAtlas * | getTextureAtlas (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 CCPoint & | getOffsetPosition (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) |
#define CCSpriteIndexNotInitialized 0xffffffff |
#define kDefaultSpriteBatchCapacity 29 |
CCSprite | ( | void | ) |
Default constructor ctor.
|
virtual |
Default destructor NA NA.
|
virtual |
NA.
Reimplemented from CCNode.
|
static |
Creates an empty sprite without texture.
You can call setTexture method subsequently.
|
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).
pszFileName | The string which indicates a path to image file, e.g., "scene1/monster.png". |
Creates a sprite with an image filename and a rect.
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. |
|
static |
Creates a sprite with an sprite frame.
pSpriteFrame | A sprite frame which involves a texture and a rect |
|
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.
pszSpriteFrameName | A null terminated string which indicates the sprite frame name. |
|
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).
pTexture | A pointer to a CCTexture2D object. |
|
static |
Creates a sprite with a texture and a rect.
After creation, the offset will be (0,0).
pTexture | A pointer to an existing CCTexture2D object. You can use a CCTexture2D object for many sprites. |
rect | Only the contents inside the rect of this texture will be applied for this sprite. |
|
virtual |
Returns the current displayed frame.
NA
|
virtual |
|
inline |
Returns the index used on the TextureAtlas.
|
virtual |
Returns the batch node object if this sprite is rendered by CCSpriteBatchNode.
|
inlinevirtual |
NA.
Implements CCBlendProtocol.
float getBlVertexMod | ( | void | ) |
Whether the sprite is flipped vertically or not.
float getBrVertexMod | ( | void | ) |
Whether the sprite is flipped vertically or not.
bool getDontDraw | ( | void | ) |
Whether the sprite is flipped vertically or not.
|
inline |
Gets the offset position of the sprite.
Calculated automatically by editors like Zwoptex.
|
inline |
Returns the quad (tex coords, vertex coords and color) information.
NA
|
virtual |
NA.
Implements CCTextureProtocol.
|
inline |
Gets the weak reference of the CCTextureAtlas when the sprite is rendered using via CCSpriteBatchNode.
float getTlVertexMod | ( | void | ) |
Whether the sprite is flipped vertically or not.
float getTrVertexMod | ( | void | ) |
Whether the sprite is flipped vertically or not.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
Initializes an empty sprite with nothing init.
Reimplemented from CCNodeRGBA.
Reimplemented in CCLabelTTF.
|
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).
pszFilename | The path to an image file in local file system |
|
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).
pszFilename | The path to an image file in local file system. |
rect | The rectangle assigned the content area from texture. |
|
virtual |
Initializes a sprite with an SpriteFrame.
The texture and rect in SpriteFrame will be applied on this sprite
pSpriteFrame | A CCSpriteFrame object. It should includes a valid texture and a rect |
|
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.
pszSpriteFrameName | A key string that can fected a volid CCSpriteFrame from CCSpriteFrameCache |
|
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).
pTexture | A pointer to an existing CCTexture2D object. You can use a CCTexture2D object for many sprites. |
|
virtual |
Initializes a sprite with a texture and a rect.
After initialization, the offset will be (0,0).
pTexture | A pointer to an exisiting CCTexture2D object. You can use a CCTexture2D object for many sprites. |
rect | Only the contents inside rect of this texture will be applied for this sprite. |
|
virtual |
Initializes a sprite with a texture and a rect in points, optionally rotated.
After initialization, the offset will be (0,0).
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. |
|
inlinevirtual |
Whether or not the Sprite needs to be updated in the Atlas.
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);
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);
|
virtual |
Returns whether or not a CCSpriteFrame is being displayed.
|
virtual |
Returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity)
Reimplemented from CCNodeRGBA.
|
inline |
Returns whether or not the texture rectangle is rotated.
|
virtual |
|
virtual |
NA.
Reimplemented from CCNode.
|
inline |
Sets the index used on the TextureAtlas.
|
virtual |
Sets the batch node to sprite.
|
inlinevirtual |
NA.
Implements CCBlendProtocol.
void setBlVertexMod | ( | float | var | ) |
Whether the sprite is flipped vertically or not.
void setBrVertexMod | ( | float | var | ) |
Whether the sprite is flipped vertically or not.
|
virtual |
|
virtual |
|
virtual |
Changes the color with R,G,B bytes.
color | Example: ccc3(255,100,0) means R=255, G=100, B=0 |
Reimplemented from CCNodeRGBA.
|
inlinevirtual |
Makes the Sprite to be updated in the Atlas.
|
protectedvirtual |
|
virtual |
Sets a new display frame to the CCSprite.
|
virtual |
Changes the display frame with animation name and index.
The animation name will be get from the CCAnimationCache
void setDontDraw | ( | bool | var | ) |
Whether the sprite is flipped vertically or not.
void setFlipX | ( | bool | bFlipX | ) |
Sets whether the sprite should be flipped horizontally or not.
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.
bFlipY | true if the sprite should be flipped vertically, flase otherwise. |
|
virtual |
Changes the opacity.
value | Goes from 0 to 255, where 255 means fully opaque and 0 means fully transparent. |
Reimplemented from CCNodeRGBA.
|
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.
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.
|
protectedvirtual |
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Implements CCTextureProtocol.
|
inline |
Sets the weak reference of the CCTextureAtlas when the sprite is rendered using via CCSpriteBatchNode.
|
protectedvirtual |
|
virtual |
Updates the texture rect of the CCSprite in points.
It will call setTextureRect:rotated:untrimmedSize with rotated = NO, and utrimmedSize = rect.size.
|
virtual |
Sets the texture rect, rectRotated and untrimmed size of the CCSprite in points.
It will update the texture coordinates and the vertex rectangle.
void setTlVertexMod | ( | float | var | ) |
Whether the sprite is flipped vertically or not.
void setTrVertexMod | ( | float | var | ) |
Whether the sprite is flipped vertically or not.
|
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 |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
virtual |
NA.
Reimplemented from CCNode.
|
protectedvirtual |
|
protected |
|
virtual |
recursive method that updates display color
Reimplemented from CCNodeRGBA.
|
virtual |
recursive method that updates the displayed opacity.
Reimplemented from CCNodeRGBA.
|
virtual |
Updates the quad according the rotation, position, scale values.
Reimplemented from CCNode.
char m_achPadding[ 16] |
|
protected |
Used batch node (weak reference)
|
protected |
Whether the sprite is flipped vertically or not.
|
protected |
|
protected |
Whether the sprite is flipped horizaontally or not.
|
protected |
Whether all of the sprite's children needs to be updated.
|
protected |
|
protected |
Retangle of CCTexture2D.
|
protected |
Whether the sprite needs to be updated.
|
protected |
Whether the sprite contains children.
bool m_bUnknown |
Whether the sprite is flipped vertically or not.
|
protected |
Whether the sprite is flipped vertically or not.
|
protected |
Whether the sprite is flipped vertically or not.
|
protected |
Whether the sprite is flipped vertically or not.
|
protected |
Whether the sprite is flipped vertically or not.
int m_nUnknown |
Whether the sprite is flipped vertically or not.
|
protected |
Whether the texture is rotated.
|
protected |
CCTexture2D object that is used to render the sprite.
|
protected |
|
protected |
Absolute (real) Index on the SpriteSheet.
|
protected |
It's required for CCTextureProtocol inheritance.
|
protected |
|
protected |
|
protected |
|
protected |
should not be drawn because one of the ancestors is not visible
|
protected |
CCSpriteBatchNode texture atlas (weak reference)