![]() |
cocos2d-iphone
1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
|
#include <CCSpriteBatchNode.h>
Public Member Functions | |
id | initWithTexture:capacity: (CCTexture2D *tex,[capacity] NSUInteger capacity) |
id | initWithFile:capacity: (NSString *fileImage,[capacity] NSUInteger capacity) |
void | increaseAtlasCapacity () |
void | removeChildAtIndex:cleanup: (NSUInteger index,[cleanup] BOOL doCleanup) |
void | removeChild:cleanup: (CCSprite *sprite,[cleanup] BOOL doCleanup) |
void | insertChild:inAtlasAtIndex: (CCSprite *child,[inAtlasAtIndex] NSUInteger index) |
void | removeSpriteFromAtlas: (CCSprite *sprite) |
NSUInteger | rebuildIndexInOrder:atlasIndex: (CCSprite *parent,[atlasIndex] NSUInteger index) |
NSUInteger | atlasIndexForChild:atZ: (CCSprite *sprite,[atZ] NSInteger z) |
Static Public Member Functions | |
id | batchNodeWithTexture: (CCTexture2D *tex) |
id | batchNodeWithTexture:capacity: (CCTexture2D *tex,[capacity] NSUInteger capacity) |
id | batchNodeWithFile: (NSString *fileImage) |
id | batchNodeWithFile:capacity: (NSString *fileImage,[capacity] NSUInteger capacity) |
Protected Attributes | |
CCTextureAtlas * | textureAtlas_ |
ccBlendFunc | blendFunc_ |
CCArray * | descendants_ |
Properties | |
CCTextureAtlas * | textureAtlas |
ccBlendFunc | blendFunc |
CCArray * | descendants |
CCSpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw").
A CCSpriteBatchNode 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 CCSpriteBatchNode. All CCSprites added to a CCSpriteBatchNode are drawn in one OpenGL ES draw call. If the CCSprites are not added to a CCSpriteBatchNode then an OpenGL ES draw call will be needed for each one, which is less efficient.
Limitations:
id CCSpriteBatchNode::batchNodeWithFile: | ( | NSString * | fileImage | ) | [static, virtual] |
creates a CCSpriteBatchNode 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 CCSpriteBatchNode::batchNodeWithFile:capacity: | ( | NSString * | fileImage, |
[capacity] NSUInteger | capacity | ||
) | [static, virtual] |
creates a CCSpriteBatchNode 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 CCSpriteBatchNode::batchNodeWithTexture: | ( | CCTexture2D * | tex | ) | [static, virtual] |
creates a CCSpriteBatchNode 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 CCSpriteBatchNode::batchNodeWithTexture:capacity: | ( | CCTexture2D * | tex, |
[capacity] NSUInteger | capacity | ||
) | [static, virtual] |
creates a CCSpriteBatchNode with a texture2d and capacity of children. The capacity will be increased in 33% in runtime if it run out of space.
id CCSpriteBatchNode::initWithFile:capacity: | ( | NSString * | fileImage, |
[capacity] NSUInteger | capacity | ||
) | [virtual] |
initializes a CCSpriteBatchNode 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 CCSpriteBatchNode::initWithTexture:capacity: | ( | CCTexture2D * | tex, |
[capacity] NSUInteger | capacity | ||
) | [virtual] |
initializes a CCSpriteBatchNode with a texture2d and capacity of children. The capacity will be increased in 33% in runtime if it run out of space.
void CCSpriteBatchNode::removeChild:cleanup: | ( | CCSprite * | sprite, |
[cleanup] BOOL | doCleanup | ||
) | [virtual] |
removes a child given a reference. It will also cleanup the running actions depending on the cleanup parameter.
void CCSpriteBatchNode::removeChildAtIndex:cleanup: | ( | NSUInteger | index, |
[cleanup] BOOL | doCleanup | ||
) | [virtual] |
removes a child given a certain index. It will also cleanup the running actions depending on the cleanup parameter.
ccBlendFunc CCSpriteBatchNode::blendFunc [read, write, assign] |
conforms to CCTextureProtocol protocol
CCArray* CCSpriteBatchNode::descendants [read, assign] |
descendants (children, gran children, etc)
CCTextureAtlas* CCSpriteBatchNode::textureAtlas [read, write, retain] |
returns the TextureAtlas that is used