cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
CCParticleBatchNode Class Reference

#import <CCParticleBatchNode.h>

+ Inheritance diagram for CCParticleBatchNode:
+ Collaboration diagram for CCParticleBatchNode:

List of all members.

Public Member Functions

(id) - initWithTexture:capacity:
(id) - initWithFile:capacity:
(void) - addChild:z:tag:
(void) - insertChild:inAtlasAtIndex:
(void) - removeChild:cleanup:
(void) - disableParticle:

Static Public Member Functions

(id) + batchNodeWithTexture:
(id) + batchNodeWithFile:
(id) + batchNodeWithTexture:capacity:
(id) + batchNodeWithFile:capacity:

Protected Attributes

CCTextureAtlas_textureAtlas
ccBlendFunc _blendFunc

Properties

CCTextureAtlastextureAtlas
ccBlendFunc blendFunc

Detailed Description

CCParticleBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw").

A CCParticleBatchNode can reference one and only one texture (one image file, one texture atlas). Only the CCParticleSystems that are contained in that texture can be added to the CCSpriteBatchNode. All CCParticleSystems added to a CCSpriteBatchNode are drawn in one OpenGL ES draw call. If the CCParticleSystems are not added to a CCParticleBatchNode then an OpenGL ES draw call will be needed for each one, which is less efficient.

Limitations:

  • At the moment only CCParticleSystemQuad is supported
  • All systems need to be drawn with the same parameters, blend function, aliasing, texture

Most efficient usage

  • Initialize the ParticleBatchNode with the texture and enough capacity for all the particle systems
  • Initialize all particle systems and add them as child to the batch node
    Since:
    v1.1

Member Function Documentation

- (void) addChild: (CCParticleSystem *)  child
z: (NSInteger)  z
tag: (NSInteger)  aTag 

Add a child into the CCParticleBatchNode

+ (id) batchNodeWithFile: (NSString *)  imageFile

initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a default capacity of 500 particles

+ (id) batchNodeWithFile: (NSString *)  fileImage
capacity: (NSUInteger)  capacity 

initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles

initializes the particle system with CCTexture2D, a default capacity of 500

+ (id) batchNodeWithTexture: (CCTexture2D *)  tex
capacity: (NSUInteger)  capacity 

initializes the particle system with CCTexture2D, a capacity of particles, which particle system to use

- (void) disableParticle: (NSUInteger)  particleIndex

disables a particle by inserting a 0'd quad into the texture atlas

- (id) initWithFile: (NSString *)  fileImage
capacity: (NSUInteger)  capacity 

initializes the particle system with the name of a file on disk (for a list of supported formats look at the CCTexture2D class), a capacity of particles

- (id) initWithTexture: (CCTexture2D *)  tex
capacity: (NSUInteger)  capacity 

initializes the particle system with CCTexture2D, a capacity of particles

- (void) insertChild: (CCParticleSystem *)  pSystem
inAtlasAtIndex: (NSUInteger)  index 

Inserts a child into the CCParticleBatchNode

- (void) removeChild: (CCParticleSystem *)  pSystem
cleanup: (BOOL)  doCleanUp 

remove child from the CCParticleBatchNode


Property Documentation

- (ccBlendFunc) blendFunc [read, write, assign]

the blend function used for drawing the quads

- (CCTextureAtlas*) textureAtlas [read, write, retain]

the texture atlas used for drawing the quads


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