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

#import <CCParticleBatchNode.h>

Inheritance diagram for CCParticleBatchNode:
Collaboration diagram for CCParticleBatchNode:

Instance Methods

(id) - initWithTexture:capacity:
 
(id) - initWithFile:capacity:
 
(void) - addChild:z:tag:
 
(void) - insertChild:inAtlasAtIndex:
 
(void) - removeChild:cleanup:
 
(void) - disableParticle:
 
 Instance Methods inherited from CCNode
(id) - init
 
(void) - onEnter
 
(void) - onEnterTransitionDidFinish
 
(void) - onExit
 
(void) - onExitTransitionDidStart
 
(void) - addChild:
 
(void) - addChild:z:
 
(void) - addChild:z:tag:
 
(void) - removeFromParent
 
(void) - removeFromParentAndCleanup:
 
(void) - removeChild:
 
(void) - removeChild:cleanup:
 
(void) - removeChildByTag:
 
(void) - removeChildByTag:cleanup:
 
(void) - removeAllChildren
 
(void) - removeAllChildrenWithCleanup:
 
(CCNode *) - getChildByTag:
 
(void) - reorderChild:z:
 
(void) - sortAllChildren
 
(void) - cleanup
 
(void) - draw
 
(void) - visit
 
(void) - transform
 
(void) - transformAncestors
 
(CGRect) - boundingBox
 
(CCAction *) - runAction:
 
(void) - stopAllActions
 
(void) - stopAction:
 
(void) - stopActionByTag:
 
(CCAction *) - getActionByTag:
 
(NSUInteger) - numberOfRunningActions
 
(void) - scheduleUpdate
 
(void) - scheduleUpdateWithPriority:
 
(void) - unscheduleUpdate
 
(void) - schedule:
 
(void) - schedule:interval:
 
(void) - schedule:interval:repeat:delay:
 
(void) - scheduleOnce:delay:
 
(void) - unschedule:
 
(void) - unscheduleAllSelectors
 
(void) - resumeSchedulerAndActions
 
(void) - pauseSchedulerAndActions
 
(void) - update:
 
(CGAffineTransform) - nodeToParentTransform
 
(CGAffineTransform) - parentToNodeTransform
 
(CGAffineTransform) - nodeToWorldTransform
 
(CGAffineTransform) - worldToNodeTransform
 
(CGPoint) - convertToNodeSpace:
 
(CGPoint) - convertToWorldSpace:
 
(CGPoint) - convertToNodeSpaceAR:
 
(CGPoint) - convertToWorldSpaceAR:
 
(CGPoint) - convertTouchToNodeSpace:
 
(CGPoint) - convertTouchToNodeSpaceAR:
 
(void) - setIsRelativeAnchorPoint:
 
(BOOL) - DEPRECATED_ATTRIBUTE
 
(void) - setZOrder:
 
 Instance Methods inherited from <CCTextureProtocol>
(CCTexture2D *) - texture
 
(void) - setTexture:
 
 Instance Methods inherited from <CCBlendProtocol>
(void) - setBlendFunc:
 
(ccBlendFunc- blendFunc
 

Class Methods

(id) + batchNodeWithTexture:
 
(id) + batchNodeWithFile:
 
(id) + batchNodeWithTexture:capacity:
 
(id) + batchNodeWithFile:capacity:
 
 Class Methods inherited from CCNode
(id) + node
 

Protected Attributes

CCTextureAtlas_textureAtlas
 
ccBlendFunc _blendFunc
 
 Protected Attributes inherited from CCNode
float _rotationX
 
float _rotationY
 
float _scaleX
 
float _scaleY
 
float _vertexZ
 
CGPoint _position
 
float _skewX
 
float _skewY
 
CGPoint _anchorPointInPoints
 
CGPoint _anchorPoint
 
CGSize _contentSize
 
CGAffineTransform _transform
 
CGAffineTransform _inverse
 
BOOL _isTransformDirty
 
BOOL _isInverseDirty
 
CCCamera_camera
 
CCGridBase_grid
 
NSInteger _zOrder
 
CCArray_children
 
CCNode_parent
 
NSInteger _tag
 
void * _userData
 
id _userObject
 
CCGLProgram_shaderProgram
 
ccGLServerState _glServerState
 
NSUInteger _orderOfArrival
 
CCScheduler_scheduler
 
CCActionManager_actionManager
 
BOOL _isRunning
 
BOOL _visible
 
BOOL _ignoreAnchorPointForPosition
 
BOOL _isReorderChildDirty
 

Properties

CCTextureAtlastextureAtlas
 
ccBlendFunc blendFunc
 
 Properties inherited from CCNode
NSInteger zOrder
 
float vertexZ
 
float skewX
 
float skewY
 
float rotation
 
float rotationX
 
float rotationY
 
float scale
 
float scaleX
 
float scaleY
 
CGPoint position
 
CCCameracamera
 
CCArraychildren
 
CCGridBasegrid
 
BOOL visible
 
CGPoint anchorPoint
 
CGPoint anchorPointInPoints
 
CGSize contentSize
 
BOOL isRunning
 
CCNodeparent
 
BOOL ignoreAnchorPointForPosition
 
NSInteger tag
 
void * userData
 
id userObject
 
CCGLProgramshaderProgram
 
NSUInteger orderOfArrival
 
ccGLServerState glServerState
 
CCActionManageractionManager
 
CCSchedulerscheduler
 

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

Method 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

+ (id) batchNodeWithTexture: (CCTexture2D *)  tex

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
readwritenonatomicassign

the blend function used for drawing the quads

- (CCTextureAtlas*) textureAtlas
readwritenonatomicretain

the texture atlas used for drawing the quads


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