Skip to main content

CCTextureAtlas

CCTextureAtlas

Cocos2D

A class that implements a Texture Atlas.

Inheritance: System.Object

Constructors

CCTextureAtlas()

CCTextureAtlas()()

Fields

m_pQuads(Cocos2D.CCRawListCocos2D.CCV3F_C4B_T2F_Quad)
m_pTexture(Cocos2D.CCTexture2D)

Properties

Capacity(System.Int32)

quantity of quads that can be stored with the current texture atlas size

IsAntialiased(System.Boolean)
Texture(Cocos2D.CCTexture2D)

Texture of the texture atlas

TotalQuads(System.Int32)

quantity of quads that are going to be drawn

Methods

Create(CCTexture2D, int)

Cocos2D.CCTextureAtlas Create(CCTexture2D, int)(Cocos2D.CCTexture2D texture, System.Int32 capacity)

creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads. The TextureAtlas capacity can be increased in runtime.

Parameters:
texture (Cocos2D.CCTexture2D)
capacity (System.Int32)
Returns:
Cocos2D.CCTextureAtlas
Example

Create(string, int)

Cocos2D.CCTextureAtlas Create(string, int)(System.String file, System.Int32 capacity)

creates a TextureAtlas with an filename and with an initial capacity for Quads. The TextureAtlas capacity can be increased in runtime.

Parameters:
file (System.String)
capacity (System.Int32)
Returns:
Cocos2D.CCTextureAtlas
Example

DrawNumberOfQuads(int)

DrawNumberOfQuads(int)(System.Int32 n)

draws n quads can't be greater than the capacity of the Atlas n

Parameters:
n (System.Int32)
Example

DrawNumberOfQuads(int, int)

DrawNumberOfQuads(int, int)(System.Int32 n, System.Int32 start)

draws n quads from an index (offset). n + start can't be greater than the capacity of the atlas @since v1.0

Parameters:
n (System.Int32)
start (System.Int32)
Example

DrawQuads()

DrawQuads()()

draws all the Atlas's Quads

Example

FillWithEmptyQuadsFromIndex(int, int)

FillWithEmptyQuadsFromIndex(int, int)(System.Int32 index, System.Int32 amount)
Parameters:
index (System.Int32)
amount (System.Int32)

IncreaseTotalQuadsWith(int)

IncreaseTotalQuadsWith(int)(System.Int32 amount)
Parameters:
amount (System.Int32)

InitWithFile(string, int)

System.Boolean InitWithFile(string, int)(System.String file, System.Int32 capacity)

initializes a TextureAtlas with a filename and with a certain capacity for Quads. The TextureAtlas capacity can be increased in runtime. WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)

Parameters:
file (System.String)
capacity (System.Int32)
Returns:
System.Boolean
Example

InitWithTexture(CCTexture2D, int)

System.Boolean InitWithTexture(CCTexture2D, int)(Cocos2D.CCTexture2D texture, System.Int32 capacity)

initializes a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for Quads. The TextureAtlas capacity can be increased in runtime. WARNING: Do not reinitialize the TextureAtlas because it will leak memory (issue #706)

Parameters:
texture (Cocos2D.CCTexture2D)
capacity (System.Int32)
Returns:
System.Boolean
Example

InsertQuad(ref CCV3F_C4B_T2F_Quad, int)

InsertQuad(ref CCV3F_C4B_T2F_Quad, int)(Cocos2D.CCV3F_C4B_T2F_Quad quad, System.Int32 index)

Inserts a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1 @since v0.8

Parameters:
quad (Cocos2D.CCV3F_C4B_T2F_Quad)
index (System.Int32)
Example

InsertQuadFromIndex(int, int)

InsertQuadFromIndex(int, int)(System.Int32 oldIndex, System.Int32 newIndex)
Parameters:
oldIndex (System.Int32)
newIndex (System.Int32)
Example

MoveQuadsFromIndex(int, int)

MoveQuadsFromIndex(int, int)(System.Int32 index, System.Int32 newIndex)
Parameters:
index (System.Int32)
newIndex (System.Int32)

MoveQuadsFromIndex(int, int, int)

MoveQuadsFromIndex(int, int, int)(System.Int32 oldIndex, System.Int32 amount, System.Int32 newIndex)
Parameters:
oldIndex (System.Int32)
amount (System.Int32)
newIndex (System.Int32)

RemoveAllQuads()

RemoveAllQuads()()

RemoveQuadAtIndex(int)

RemoveQuadAtIndex(int)(System.Int32 index)

removes a quad at a given index number. The capacity remains the same, but the total number of quads to be drawn is reduced in 1 @since v0.7.2

Parameters:
index (System.Int32)
Example

RemoveQuadsAtIndex(int, int)

RemoveQuadsAtIndex(int, int)(System.Int32 index, System.Int32 amount)
Parameters:
index (System.Int32)
amount (System.Int32)

ResizeCapacity(int)

System.Boolean ResizeCapacity(int)(System.Int32 newCapacity)

resize the capacity of the CCTextureAtlas. The new capacity can be lower or higher than the current one It returns YES if the resize was successful. If it fails to resize the capacity it will return NO with a new capacity of 0.

Parameters:
newCapacity (System.Int32)
Returns:
System.Boolean
Example

ToString()

System.String ToString()()
Returns:
System.String
Example

UpdateQuad(ref CCV3F_C4B_T2F_Quad, int)

UpdateQuad(ref CCV3F_C4B_T2F_Quad, int)(Cocos2D.CCV3F_C4B_T2F_Quad quad, System.Int32 index)

updates a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1 @since v0.8

Parameters:
quad (Cocos2D.CCV3F_C4B_T2F_Quad)
index (System.Int32)
Example