Class CCParticleBatchNode

#include <Geode/cocos/particle_nodes/CCParticleBatchNode.h>
classCCParticleBatchNode:publiccocos2d::CCNode,publiccocos2d::CCTextureProtocol{ ... }

Since v1.1

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
Examples0
Public static methods2
staticcocos2d::CCParticleBatchNode*createWithTexture(,
uintcapacity
)

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

staticcocos2d::CCParticleBatchNode*create(
charconst*fileImage
,
uintcapacity
)

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

Public member functions19
boolinitWithTexture(,
uintcapacity
)

initializes the particle system with CCTexture2D, a capacity of particles

boolinitWithFile(
charconst*fileImage
,
uintcapacity
)

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

virtualvoidaddChild()

Add a child into the CCParticleBatchNode

virtualvoidaddChild(,
intzOrder
)
No description provided
virtualvoidaddChild(,
intzOrder
,
inttag
)
No description provided
voidinsertChild(,
uintindex
)

Inserts a child into the CCParticleBatchNode

virtualvoidremoveChild(,
boolcleanup
)

remove child from the CCParticleBatchNode

virtualvoidreorderChild(,
intzOrder
)
No description provided
voidremoveChildAtIndex(
uintindex
,
booldoCleanup
)
No description provided
virtualvoidremoveAllChildrenWithCleanup(
booldoCleanup
)
No description provided
voiddisableParticle(
uintparticleIndex
)

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

virtualvoiddraw()
No description provided
virtualcocos2d::CCTexture2D*getTexture()
No description provided
virtualvoidsetTexture()
No description provided
virtualvoidsetBlendFunc()
No description provided
virtualcocos2d::ccBlendFuncgetBlendFunc()

returns the blending function used for the texture

virtualvoidvisit()
No description provided
virtualcocos2d::CCTextureAtlas*getTextureAtlas()const

the texture atlas used for drawing the quads

virtualvoidsetTextureAtlas()

the texture atlas used for drawing the quads

Fields0
Protected member functions0
Protected fields1
;

the texture atlas used for drawing the quads