cocos2d-iphone  1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
CCTextureAtlas Interface Reference

#include <CCTextureAtlas.h>

+ Collaboration diagram for CCTextureAtlas:

List of all members.

Public Member Functions

id initWithFile:capacity: (NSString *file,[capacity] NSUInteger capacity)
id initWithTexture:capacity: (CCTexture2D *tex,[capacity] NSUInteger capacity)
void updateQuad:atIndex: (ccV3F_C4B_T2F_Quad *quad,[atIndex] NSUInteger index)
void insertQuad:atIndex: (ccV3F_C4B_T2F_Quad *quad,[atIndex] NSUInteger index)
void insertQuadFromIndex:atIndex: (NSUInteger fromIndex,[atIndex] NSUInteger newIndex)
void removeQuadAtIndex: (NSUInteger index)
void removeAllQuads ()
BOOL resizeCapacity: (NSUInteger n)
void drawNumberOfQuads: (NSUInteger n)
void drawNumberOfQuads:fromIndex: (NSUInteger n,[fromIndex] NSUInteger start)
void drawQuads ()

Static Public Member Functions

id textureAtlasWithFile:capacity: (NSString *file,[capacity] NSUInteger capacity)
id textureAtlasWithTexture:capacity: (CCTexture2D *tex,[capacity] NSUInteger capacity)

Protected Attributes

NSUInteger totalQuads_
NSUInteger capacity_
ccV3F_C4B_T2F_Quadquads_
GLushort * indices_
CCTexture2Dtexture_

Properties

NSUInteger totalQuads
NSUInteger capacity
CCTexture2Dtexture
ccV3F_C4B_T2F_Quadquads

Detailed Description

A class that implements a Texture Atlas. Supported features: The atlas file can be a PVRTC, PNG or any other fomrat supported by Texture2D Quads can be udpated in runtime Quads can be added in runtime Quads can be removed in runtime Quads can be re-ordered in runtime The TextureAtlas capacity can be increased or decreased in runtime OpenGL component: V3F, C4B, T2F. The quads are rendered using an OpenGL ES VBO. To render the quads using an interleaved vertex array list, you should modify the ccConfig.h file


Member Function Documentation

void CCTextureAtlas::drawNumberOfQuads: ( NSUInteger  n) [virtual]

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

void CCTextureAtlas::drawNumberOfQuads:fromIndex: ( NSUInteger  n,
[fromIndex] NSUInteger  start 
) [virtual]

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

Since:
v1.0
void CCTextureAtlas::drawQuads ( ) [virtual]

draws all the Atlas's Quads

id CCTextureAtlas::initWithFile:capacity: ( NSString *  file,
[capacity] NSUInteger  capacity 
) [virtual]

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)

id CCTextureAtlas::initWithTexture:capacity: ( CCTexture2D tex,
[capacity] NSUInteger  capacity 
) [virtual]

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)

void CCTextureAtlas::insertQuad:atIndex: ( ccV3F_C4B_T2F_Quad quad,
[atIndex] NSUInteger  index 
) [virtual]

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

Since:
v0.8
void CCTextureAtlas::insertQuadFromIndex:atIndex: ( NSUInteger  fromIndex,
[atIndex] NSUInteger  newIndex 
) [virtual]

Removes the quad that is located at a certain index and inserts it at a new index This operation is faster than removing and inserting in a quad in 2 different steps

Since:
v0.7.2
void CCTextureAtlas::removeAllQuads ( ) [virtual]

removes all Quads. The TextureAtlas capacity remains untouched. No memory is freed. The total number of quads to be drawn will be 0

Since:
v0.7.2
void CCTextureAtlas::removeQuadAtIndex: ( NSUInteger  index) [virtual]

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
BOOL CCTextureAtlas::resizeCapacity: ( NSUInteger  n) [virtual]

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.

id CCTextureAtlas::textureAtlasWithFile:capacity: ( NSString *  file,
[capacity] NSUInteger  capacity 
) [static, virtual]

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

id CCTextureAtlas::textureAtlasWithTexture:capacity: ( CCTexture2D tex,
[capacity] NSUInteger  capacity 
) [static, virtual]

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.

void CCTextureAtlas::updateQuad:atIndex: ( ccV3F_C4B_T2F_Quad quad,
[atIndex] NSUInteger  index 
) [virtual]

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

Since:
v0.8

Property Documentation

NSUInteger CCTextureAtlas::capacity [read, assign]

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

ccV3F_C4B_T2F_Quad* CCTextureAtlas::quads [read, write, assign]

Quads that are going to be rendered

CCTexture2D* CCTextureAtlas::texture [read, write, retain]

Texture of the texture atlas

NSUInteger CCTextureAtlas::totalQuads [read, assign]

quantity of quads that are going to be drawn


The documentation for this interface was generated from the following file: