cocos2d-iphone
1.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
|
#import <CCTextureAtlas.h>
Public Member Functions | |
(id) | - initWithFile:capacity: |
(id) | - initWithTexture:capacity: |
(void) | - updateQuad:atIndex: |
(void) | - insertQuad:atIndex: |
(void) | - insertQuads:atIndex:amount: |
(void) | - insertQuadFromIndex:atIndex: |
(void) | - insertQuadsFromIndex:amount:atIndex: |
(void) | - removeQuadAtIndex: |
(void) | - removeQuadsAtIndex:amount: |
(void) | - removeAllQuads |
(BOOL) | - resizeCapacity: |
(void) | - increaseTotalQuadsWith: |
(void) | - moveQuadsFromIndex:to: |
(void) | - fillWithEmptyQuadsFromIndex:amount: |
(void) | - drawNumberOfQuads: |
(void) | - drawNumberOfQuads:fromIndex: |
(void) | - drawQuads |
Static Public Member Functions | |
(id) | + textureAtlasWithFile:capacity: |
(id) | + textureAtlasWithTexture:capacity: |
Protected Attributes | |
NSUInteger | totalQuads_ |
NSUInteger | capacity_ |
ccV3F_C4B_T2F_Quad * | quads_ |
GLushort * | indices_ |
CCTexture2D * | texture_ |
Properties | |
NSUInteger | totalQuads |
NSUInteger | capacity |
CCTexture2D * | texture |
ccV3F_C4B_T2F_Quad * | quads |
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
- (void) drawNumberOfQuads: | (NSUInteger) | n |
draws n quads n can't be greater than the capacity of the Atlas
- (void) drawNumberOfQuads: | (NSUInteger) | n | |
fromIndex: | (NSUInteger) | start | |
draws n quads from an index (offset). n + start can't be greater than the capacity of the atlas
- (void) drawQuads |
draws all the Atlas's Quads
- (void) fillWithEmptyQuadsFromIndex: | (NSUInteger) | index | |
amount: | (NSUInteger) | amount | |
Ensures that after a realloc quads are still empty Used internally by CCParticleBatchNode
- (void) increaseTotalQuadsWith: | (NSUInteger) | amount |
Used internally by CCParticleBatchNode don't use this unless you know what you're doing
- (id) initWithFile: | (NSString *) | file | |
capacity: | (NSUInteger) | 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)
- (id) initWithTexture: | (CCTexture2D *) | tex | |
capacity: | (NSUInteger) | 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)
- (void) insertQuad: | (ccV3F_C4B_T2F_Quad *) | quad | |
atIndex: | (NSUInteger) | index | |
Inserts a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1
- (void) insertQuadFromIndex: | (NSUInteger) | fromIndex | |
atIndex: | (NSUInteger) | newIndex | |
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
- (void) insertQuads: | (ccV3F_C4B_T2F_Quad *) | quads | |
atIndex: | (NSUInteger) | index | |
amount: | (NSUInteger) | amount | |
Inserts a c array of quads at a given index index must be between 0 and the atlas capacity - 1 this method doesn't enlarge the array when amount + index > totalQuads
- (void) insertQuadsFromIndex: | (NSUInteger) | oldIndex | |
amount: | (NSUInteger) | amount | |
atIndex: | (NSUInteger) | newIndex | |
Inserts a amount of quads from oldIndex at newIndex, while moving quads at newIndex - oldIndex back accordingly
- (void) moveQuadsFromIndex: | (NSUInteger) | index | |
to: | (NSUInteger) | newIndex | |
Moves quads from index till totalQuads to the newIndex Used internally by CCParticleBatchNode This method doesn't enlarge the array if newIndex + quads to be moved > capacity
- (void) removeAllQuads |
removes all Quads. The TextureAtlas capacity remains untouched. No memory is freed. The total number of quads to be drawn will be 0
- (void) removeQuadAtIndex: | (NSUInteger) | 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
- (void) removeQuadsAtIndex: | (NSUInteger) | index | |
amount: | (NSUInteger) | amount | |
removes a amount of quads starting from index
- (BOOL) resizeCapacity: | (NSUInteger) | n |
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) textureAtlasWithFile: | (NSString *) | file | |
capacity: | (NSUInteger) | capacity | |
creates a TextureAtlas with an filename and with an initial capacity for Quads. The TextureAtlas capacity can be increased in runtime.
+ (id) textureAtlasWithTexture: | (CCTexture2D *) | tex | |
capacity: | (NSUInteger) | 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.
- (void) updateQuad: | (ccV3F_C4B_T2F_Quad *) | quad | |
atIndex: | (NSUInteger) | index | |
updates a Quad (texture, vertex and color) at a certain index index must be between 0 and the atlas capacity - 1
- (NSUInteger) capacity [read, assign] |
quantity of quads that can be stored with the current texture atlas size
- (ccV3F_C4B_T2F_Quad*) quads [read, write, assign] |
Quads that are going to be rendered
- (CCTexture2D*) texture [read, write, retain] |
Texture of the texture atlas
- (NSUInteger) totalQuads [read, assign] |
quantity of quads that are going to be drawn