Skip to main content

CCSprite

CCSprite

Cocos2D

Inheritance: System.Object → Cocos2D.CCNode

Implements: Cocos2D.ICCSelectorProtocol, Cocos2D.ICCFocusable, Cocos2D.ICCTargetedTouchDelegate, Cocos2D.ICCStandardTouchDelegate, Cocos2D.ICCTouchDelegate, Cocos2D.ICCKeypadDelegate, Cocos2D.ICCKeyboardDelegate, Cocos2D.ICCRGBAProtocol, System.Collections.Generic.IComparer{Cocos2D.CCNode}, Cocos2D.ICCTextureProtocol, Cocos2D.ICCBlendProtocol

Constructors

CCSprite()

CCSprite()()

CCSprite(CCRect)

CCSprite(CCRect)(Cocos2D.CCRect rect)
Parameters:
rect (Cocos2D.CCRect)

CCSprite(CCSize)

CCSprite(CCSize)(Cocos2D.CCSize size)
Parameters:
size (Cocos2D.CCSize)

CCSprite(CCSpriteFrame)

CCSprite(CCSpriteFrame)(Cocos2D.CCSpriteFrame pSpriteFrame)
Parameters:
pSpriteFrame (Cocos2D.CCSpriteFrame)

CCSprite(CCTexture2D)

CCSprite(CCTexture2D)(Cocos2D.CCTexture2D texture)
Parameters:
texture (Cocos2D.CCTexture2D)

CCSprite(CCTexture2D, CCRect)

CCSprite(CCTexture2D, CCRect)(Cocos2D.CCTexture2D texture, Cocos2D.CCRect rect)
Parameters:
texture (Cocos2D.CCTexture2D)
rect (Cocos2D.CCRect)

CCSprite(string)

CCSprite(string)(System.String fileName)
Parameters:
fileName (System.String)

CCSprite(string, CCRect)

CCSprite(string, CCRect)(System.String fileName, Cocos2D.CCRect rect)
Parameters:
fileName (System.String)
rect (Cocos2D.CCRect)

Fields

m_bDirty(System.Boolean)
m_bFlipX(System.Boolean)
m_bFlipY(System.Boolean)
m_bHasChildren(System.Boolean)
m_bOpacityModifyRGB(System.Boolean)
m_bRectRotated(System.Boolean)
m_bRecursiveDirty(System.Boolean)
m_bShouldBeHidden(System.Boolean)
m_obOffsetPosition(Cocos2D.CCPoint)
m_obRect(Cocos2D.CCRect)
m_obUnflippedOffsetPositionFromCenter(Cocos2D.CCPoint)
m_pobBatchNode(Cocos2D.CCSpriteBatchNode)
m_pobTexture(Cocos2D.CCTexture2D)
m_pobTextureAtlas(Cocos2D.CCTextureAtlas)
m_sBlendFunc(Cocos2D.CCBlendFunc)
m_transformToBatch(Cocos2D.CCAffineTransform)
m_uAtlasIndex(System.Int32)

Properties

AnchorPoint(Cocos2D.CCPoint)

returns the Anchor Point of the node as a value [0,1], where 1 is 100% of the dimension and 0 is 0%.

AtlasIndex(System.Int32)
BatchNode(Cocos2D.CCSpriteBatchNode)
BlendFunc(Cocos2D.CCBlendFunc)

gets or sets the source blending function for the texture

Color(Cocos2D.CCColor3B)

Gets or sets the color

ContentSize(Cocos2D.CCSize)
Dirty(System.Boolean)
DisplayFrame(Cocos2D.CCSpriteFrame)
FlipX(System.Boolean)
FlipY(System.Boolean)
HalfTexelOffset(System.Boolean)
IgnoreAnchorPointForPosition(System.Boolean)
IsAntialiased(System.Boolean)
IsOpacityModifyRGB(System.Boolean)

sets the premultipliedAlphaOpacity property. If set to NO then opacity will be applied as: glColor(R,G,B,opacity); If set to YES then oapcity will be applied as: glColor(opacity, opacity, opacity, opacity ); Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO @since v0.8

IsTextureRectRotated(System.Boolean)
OffsetPosition(Cocos2D.CCPoint)
Opacity(System.Byte)

Gets or sets the Opacity @warning If the the texture has premultiplied alpha then, the R, G and B channels will be modifed. Values goes from 0 to 255, where 255 means fully opaque.

Position(Cocos2D.CCPoint)

Sets and gets the position of the node. For Menus, this is the center of the menu. For layers, this is the lower left corner of the layer.

Quad(Cocos2D.CCV3F_C4B_T2F_Quad)
Rotation(System.Single)

Rotation of the sprite, about the Z axis, in Degrees.

RotationX(System.Single)

Rotation of the sprite, about the X axis, in Degrees.

RotationY(System.Single)

Rotation of the sprite, about the Y axis, in Degrees.

Scale(System.Single)

The general scale that applies to both X and Y directions.

ScaleX(System.Single)

Scale of the node in the X direction (left to right)

ScaleY(System.Single)

Scale of the node in the Y direction (top to bottom)

SkewX(System.Single)
SkewY(System.Single)
SpriteFrame(Cocos2D.CCSpriteFrame)
Texture(Cocos2D.CCTexture2D)

gets or sets a new texture. it will be retained

TextureRect(Cocos2D.CCRect)
TextureRectInPixels(Cocos2D.CCRect)
UntrimmedSizeInPixels(Cocos2D.CCSize)
VertexZ(System.Single)
Visible(System.Boolean)

This returns true if the node is visible and the parent is visible. Otherwise, it returns false.

Methods

AddChild(CCNode, int, int)

AddChild(CCNode, int, int)(Cocos2D.CCNode child, System.Int32 zOrder, System.Int32 tag)
Parameters:
child (Cocos2D.CCNode)
zOrder (System.Int32)
tag (System.Int32)
Example

Deserialize(Stream)

Deserialize(Stream)(System.IO.Stream stream)

Tells the screen to deserialize its state from the given stream.

Parameters:
stream (System.IO.Stream)
Example

Draw()

Draw()()

This is called from the Visit() method. This is where you DRAW your node. Only draw stuff from this method call.

Example

Init()

System.Boolean Init()()
Returns:
System.Boolean
Example

InitWithFile(string)

System.Boolean InitWithFile(string)(System.String fileName)
Parameters:
fileName (System.String)
Returns:
System.Boolean

InitWithFile(string, CCRect)

System.Boolean InitWithFile(string, CCRect)(System.String fileName, Cocos2D.CCRect rect)
Parameters:
fileName (System.String)
rect (Cocos2D.CCRect)
Returns:
System.Boolean

InitWithSpriteFrame(CCSpriteFrame)

System.Boolean InitWithSpriteFrame(CCSpriteFrame)(Cocos2D.CCSpriteFrame pSpriteFrame)
Parameters:
pSpriteFrame (Cocos2D.CCSpriteFrame)
Returns:
System.Boolean

InitWithTexture(CCTexture2D)

System.Boolean InitWithTexture(CCTexture2D)(Cocos2D.CCTexture2D texture)
Parameters:
texture (Cocos2D.CCTexture2D)
Returns:
System.Boolean

InitWithTexture(CCTexture2D, CCRect)

System.Boolean InitWithTexture(CCTexture2D, CCRect)(Cocos2D.CCTexture2D texture, Cocos2D.CCRect rect)
Parameters:
texture (Cocos2D.CCTexture2D)
rect (Cocos2D.CCRect)
Returns:
System.Boolean

InitWithTexture(CCTexture2D, CCRect, bool)

System.Boolean InitWithTexture(CCTexture2D, CCRect, bool)(Cocos2D.CCTexture2D pTexture, Cocos2D.CCRect rect, System.Boolean rotated)
Parameters:
pTexture (Cocos2D.CCTexture2D)
rect (Cocos2D.CCRect)
rotated (System.Boolean)
Returns:
System.Boolean

IsSpriteFrameDisplayed(CCSpriteFrame)

System.Boolean IsSpriteFrameDisplayed(CCSpriteFrame)(Cocos2D.CCSpriteFrame frame)
Parameters:
frame (Cocos2D.CCSpriteFrame)
Returns:
System.Boolean

OnExit()

OnExit()()
Example

RemoveAllChildren(bool)

RemoveAllChildren(bool)(System.Boolean cleanup)
Parameters:
cleanup (System.Boolean)
Example

RemoveChild(CCNode, bool)

RemoveChild(CCNode, bool)(Cocos2D.CCNode child, System.Boolean cleanup)
Parameters:
child (Cocos2D.CCNode)
cleanup (System.Boolean)
Example

ReorderChild(CCNode, int)

ReorderChild(CCNode, int)(Cocos2D.CCNode child, System.Int32 zOrder)
Parameters:
child (Cocos2D.CCNode)
zOrder (System.Int32)
Example

ScaleTo(CCSize)

ScaleTo(CCSize)(Cocos2D.CCSize size)

Scales the sprite to have the given size.

Parameters:
size (Cocos2D.CCSize)
Example

Serialize(Stream)

Serialize(Stream)(System.IO.Stream stream)

Tells the screen to serialize its state into the given stream.

Parameters:
stream (System.IO.Stream)
Example

SetDirtyRecursively(bool)

SetDirtyRecursively(bool)(System.Boolean bValue)
Parameters:
bValue (System.Boolean)

SetDisplayFrameWithAnimationName(string, int)

SetDisplayFrameWithAnimationName(string, int)(System.String animationName, System.Int32 frameIndex)
Parameters:
animationName (System.String)
frameIndex (System.Int32)

SetPosition(float, float)

SetPosition(float, float)(System.Single x, System.Single y)
Parameters:
x (System.Single)
y (System.Single)
Example

SetReorderChildDirtyRecursively()

SetReorderChildDirtyRecursively()()

SetTextureRect(CCRect)

SetTextureRect(CCRect)(Cocos2D.CCRect rect)
Parameters:
rect (Cocos2D.CCRect)

SetTextureRect(CCRect, bool, CCSize)

SetTextureRect(CCRect, bool, CCSize)(Cocos2D.CCRect value, System.Boolean rotated, Cocos2D.CCSize untrimmedSize)
Parameters:
value (Cocos2D.CCRect)
rotated (System.Boolean)
untrimmedSize (Cocos2D.CCSize)

SetVertexRect(CCRect)

SetVertexRect(CCRect)(Cocos2D.CCRect rect)
Parameters:
rect (Cocos2D.CCRect)

SortAllChildren()

SortAllChildren()()
Example

UpdateBlendFunc()

UpdateBlendFunc()()

UpdateDisplayedColor(CCColor3B)

UpdateDisplayedColor(CCColor3B)(Cocos2D.CCColor3B parentColor)

recursive method that updates display color

Parameters:
parentColor (Cocos2D.CCColor3B)
Example

UpdateDisplayedOpacity(byte)

UpdateDisplayedOpacity(byte)(System.Byte parentOpacity)

recursive method that updates the displayed opacity.

Parameters:
parentOpacity (System.Byte)
Example

UpdateTransform()

UpdateTransform()()
Example

VisitRenderer(ref CCAffineTransform)

VisitRenderer(ref CCAffineTransform)(Cocos2D.CCAffineTransform worldTransform)
Parameters:
worldTransform (Cocos2D.CCAffineTransform)
Example