#import <CCSpriteSheet.h>
Inherits CCNode, and CCTextureProtocol-p.
Inherited by CCBitmapFontAtlas, and CCTMXLayer.
Public Member Functions | |
| (id) | - initWithTexture:capacity: |
| (id) | - initWithFile:capacity: |
| (CCSprite *) | - createSpriteWithRect: |
| (void) | - initSprite:rect: |
| (void) | - removeChildAtIndex:cleanup: |
| (void) | - removeChild:cleanup: |
Static Public Member Functions | |
| (id) | + spriteSheetWithTexture: |
| (id) | + spriteSheetWithTexture:capacity: |
| (id) | + spriteSheetWithFile: |
| (id) | + spriteSheetWithFile:capacity: |
Properties | |
| CCTextureAtlas * | textureAtlas |
| ccBlendFunc | blendFunc |
| CCArray * | descendants |
CCSpriteSheet is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw").
A CCSpriteSheet can reference one and only one texture (one image file, one texture atlas). Only the CCSprites that are contained in that texture can be added to the CCSpriteSheet. All CCSprites added to a CCSpriteSheet are drawn in one OpenGL ES draw call. If the CCSprites are not added to a CCSpriteSheet then an OpenGL ES draw call will be needed for each one, which is less efficient.
Limitations:
Definition at line 52 of file CCSpriteSheet.h.
| - (CCSprite*) createSpriteWithRect: | (CGRect) | DEPRECATED_ATTRIBUTE |
creates an sprite with a rect in the CCSpriteSheet. It's the same as:
| - (void) initSprite: | (CCSprite *) | sprite | ||
| rect: | (CGRect) | DEPRECATED_ATTRIBUTE | ||
initializes a previously created sprite with a rect. This sprite will have the same texture as the CCSpriteSheet. It's the same as:
| - (id) initWithFile: | (NSString *) | fileImage | ||
| capacity: | (NSUInteger) | capacity | ||
initializes a CCSpriteSheet with a file image (.png, .jpeg, .pvr, etc) and a capacity of children. The capacity will be increased in 33% in runtime if it run out of space. The file will be loaded using the TextureMgr.
| - (id) initWithTexture: | (CCTexture2D *) | tex | ||
| capacity: | (NSUInteger) | capacity | ||
initializes a CCSpriteSheet with a texture2d and capacity of children. The capacity will be increased in 33% in runtime if it run out of space.
| - (void) removeChild: | (CCSprite *) | sprite | ||
| cleanup: | (BOOL) | doCleanup | ||
removes a child given a reference. It will also cleanup the running actions depending on the cleanup parameter.
| - (void) removeChildAtIndex: | (NSUInteger) | index | ||
| cleanup: | (BOOL) | doCleanup | ||
removes a child given a certain index. It will also cleanup the running actions depending on the cleanup parameter.
| + (id) spriteSheetWithFile: | (NSString *) | fileImage |
creates a CCSpriteSheet with a file image (.png, .jpeg, .pvr, etc) with a default capacity of 29 children. The capacity will be increased in 33% in runtime if it run out of space. The file will be loaded using the TextureMgr.
| + (id) spriteSheetWithFile: | (NSString *) | fileImage | ||
| capacity: | (NSUInteger) | capacity | ||
creates a CCSpriteSheet with a file image (.png, .jpeg, .pvr, etc) and capacity of children. The capacity will be increased in 33% in runtime if it run out of space. The file will be loaded using the TextureMgr.
| + (id) spriteSheetWithTexture: | (CCTexture2D *) | tex |
creates a CCSpriteSheet with a texture2d and a default capacity of 29 children. The capacity will be increased in 33% in runtime if it run out of space.
| + (id) spriteSheetWithTexture: | (CCTexture2D *) | tex | ||
| capacity: | (NSUInteger) | capacity | ||
creates a CCSpriteSheet with a texture2d and capacity of children. The capacity will be increased in 33% in runtime if it run out of space.
- (ccBlendFunc) blendFunc [read, write, assign] |
conforms to CCTextureProtocol protocol
Definition at line 66 of file CCSpriteSheet.h.
- (CCArray*) descendants [read, assign] |
descendants (children, gran children, etc)
Definition at line 69 of file CCSpriteSheet.h.
- (CCTextureAtlas*) textureAtlas [read, write, retain] |
returns the TextureAtlas that is used
Definition at line 63 of file CCSpriteSheet.h.