Class CCParticleSystem

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

Particle System base class. Attributes of a Particle System:

  • emission rate of the particles
  • Gravity Mode (Mode A):
  • gravity
  • direction
  • speed +- variance
  • tangential acceleration +- variance
  • radial acceleration +- variance
  • Radius Mode (Mode B):
  • startRadius +- variance
  • endRadius +- variance
  • rotate +- variance
  • Properties common to all modes:
  • life +- life variance
  • start spin +- variance
  • end spin +- variance
  • start size +- variance
  • end size +- variance
  • start color +- variance
  • end color +- variance
  • life +- variance
  • blending function
  • texture cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/). ‘Radius Mode’ in Particle Designer uses a fixed emit rate of 30 hz. Since that can’t be guaranteed in cocos2d, cocos2d uses a another approach, but the results are almost identical. cocos2d supports all the variables used by Particle Designer plus a bit more:
  • spinning particles (supported when using CCParticleSystemQuad)
  • tangential acceleration (Gravity mode)
  • radial acceleration (Gravity mode)
  • radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only) It is possible to customize any of the above mentioned properties in runtime. Example:
Examples1
emitter.radialAccel = 15;
emitter.startSpin = 0;
Public static methods2
staticcocos2d::CCParticleSystem*create(
charconst*plistFile
)

Since v2.0

creates an initializes a CCParticleSystem from a plist file. This plist files can be created manually or with Particle Designer: http://particledesigner.71squared.com/

staticcocos2d::CCParticleSystem*createWithTotalParticles(
uintnumberOfParticles
)

//! create a system with a fixed number of particles

Public member functions165
virtualcocos2d::CCParticleBatchNode*getBatchNode()
No description provided
virtualvoidsetBatchNode()
No description provided
uintgetAtlasIndex()const
No description provided
voidsetAtlasIndex(
uintvar
)
No description provided
virtualuintgetParticleCount()
No description provided
virtualfloatgetDuration()
No description provided
virtualvoidsetDuration()
No description provided
virtualcocos2d::CCPointconst&getSourcePosition()
No description provided
virtualvoidsetSourcePosition()
No description provided
virtualcocos2d::CCPointconst&getPosVar()
No description provided
virtualvoidsetPosVar()
No description provided
virtualfloatgetLife()
No description provided
virtualvoidsetLife()
No description provided
virtualfloatgetLifeVar()
No description provided
virtualvoidsetLifeVar()
No description provided
virtualfloatgetAngle()
No description provided
virtualvoidsetAngle()
No description provided
virtualfloatgetAngleVar()
No description provided
virtualvoidsetAngleVar()
No description provided
virtualcocos2d::CCPointconst&getGravity()

//////////////////////////////////////////////////////////////////////////

virtualvoidsetGravity()
No description provided
virtualfloatgetSpeed()
No description provided
virtualvoidsetSpeed(
floatspeed
)
No description provided
virtualfloatgetSpeedVar()
No description provided
virtualvoidsetSpeedVar(
floatspeed
)
No description provided
virtualfloatgetTangentialAccel()
No description provided
virtualvoidsetTangentialAccel()
No description provided
virtualfloatgetTangentialAccelVar()
No description provided
virtualvoidsetTangentialAccelVar()
No description provided
virtualfloatgetRadialAccel()
No description provided
virtualvoidsetRadialAccel()
No description provided
virtualfloatgetRadialAccelVar()
No description provided
virtualvoidsetRadialAccelVar()
No description provided
virtualboolgetRotationIsDir()
No description provided
virtualvoidsetRotationIsDir()
No description provided
virtualfloatgetStartRadius()
No description provided
virtualvoidsetStartRadius(
floatstartRadius
)
No description provided
virtualfloatgetStartRadiusVar()
No description provided
virtualvoidsetStartRadiusVar(
floatstartRadiusVar
)
No description provided
virtualfloatgetEndRadius()
No description provided
virtualvoidsetEndRadius(
floatendRadius
)
No description provided
virtualfloatgetEndRadiusVar()
No description provided
virtualvoidsetEndRadiusVar(
floatendRadiusVar
)
No description provided
virtualfloatgetRotatePerSecond()
No description provided
virtualvoidsetRotatePerSecond(
floatdegrees
)
No description provided
virtualfloatgetRotatePerSecondVar()
No description provided
virtualvoidsetRotatePerSecondVar(
floatdegrees
)
No description provided
virtualvoidsetVisible(
boolvisible
)
No description provided
virtualvoidsetScale()
No description provided
virtualvoidsetRotation(
floatnewRotation
)
No description provided
virtualvoidsetScaleX(
floatnewScaleX
)
No description provided
virtualvoidsetScaleY(
floatnewScaleY
)
No description provided
virtualboolisActive()
No description provided
virtualboolisBlendAdditive()
No description provided
virtualvoidsetBlendAdditive(
boolvalue
)
No description provided
virtualfloatgetStartSize()
No description provided
virtualvoidsetStartSize()
No description provided
virtualfloatgetStartSizeVar()
No description provided
virtualvoidsetStartSizeVar()
No description provided
virtualfloatgetEndSize()
No description provided
virtualvoidsetEndSize()
No description provided
virtualfloatgetEndSizeVar()
No description provided
virtualvoidsetEndSizeVar()
No description provided
virtualcocos2d::ccColor4Fconst&getStartColor()
No description provided
virtualvoidsetStartColor()
No description provided
virtualcocos2d::ccColor4Fconst&getStartColorVar()
No description provided
virtualvoidsetStartColorVar()
No description provided
virtualcocos2d::ccColor4Fconst&getEndColor()
No description provided
virtualvoidsetEndColor()
No description provided
virtualcocos2d::ccColor4Fconst&getEndColorVar()
No description provided
virtualvoidsetEndColorVar()
No description provided
virtualfloatgetStartSpin()
No description provided
virtualvoidsetStartSpin()
No description provided
virtualfloatgetStartSpinVar()
No description provided
virtualvoidsetStartSpinVar()
No description provided
virtualfloatgetEndSpin()
No description provided
virtualvoidsetEndSpin()
No description provided
virtualfloatgetEndSpinVar()
No description provided
virtualvoidsetEndSpinVar()
No description provided
virtualfloatgetEmissionRate()
No description provided
virtualvoidsetEmissionRate()
No description provided
virtualuintgetTotalParticles()
No description provided
virtualvoidsetTotalParticles(
uintvar
)
No description provided
virtualcocos2d::CCTexture2D*getTexture()
No description provided
virtualvoidsetTexture()
No description provided
virtualcocos2d::ccBlendFuncgetBlendFunc()
No description provided
virtualvoidsetBlendFunc()
No description provided
virtualboolgetOpacityModifyRGB()
No description provided
virtualvoidsetOpacityModifyRGB(
boolvar
)
No description provided
virtualcocos2d::tCCPositionTypegetPositionType()
No description provided
virtualvoidsetPositionType()
No description provided
virtualboolisAutoRemoveOnFinish()
No description provided
virtualvoidsetAutoRemoveOnFinish(
boolvar
)
No description provided
virtualintgetEmitterMode()
No description provided
virtualvoidsetEmitterMode(
intvar
)
No description provided
virtualboolinit()

initializes a CCParticleSystem

boolinitWithFile(
charconst*plistFile
,)

Since v0.99.3

initializes a CCParticleSystem from a plist file. This plist files can be created manually or with Particle Designer: http://particledesigner.71squared.com/

boolinitWithDictionary(,)

Since v0.99.3

initializes a CCQuadParticleSystem from a CCDictionary.

boolinitWithDictionary(,
charconst*dirname
,)

Since v2.1

initializes a particle system from a NSDictionary and the path from where to load the png

virtualboolinitWithTotalParticles(
uintnumberOfParticles
,)

//! Initializes a system with a fixed number of particles

booladdParticle()

//! Add a particle to the emitter

voidinitParticle()

//! Initializes a particle

voidstopSystem()

//! stop emitting particles. Running particles will continue to run until they die

voidresetSystem()

//! Kill all living particles.

voidresumeSystem()
No description provided
boolisFull()

//! whether or not the system is full

virtualvoidupdateQuadWithParticle(,)

//! should be overridden by subclasses

virtualvoidpostStep()

//! should be overridden by subclasses

virtualvoidupdate()
No description provided
virtualvoidupdateWithNoTime()
No description provided
voidsaveDefaults()
No description provided
voidloadDefaults()
No description provided
voidloadScaledDefaults()
No description provided
voidcalculateWorldSpace()
No description provided
boolgetDontCleanupOnFinish()const
No description provided
voidsetDontCleanupOnFinish()
No description provided
boolgetDynamicRotationIsDir()const
No description provided
voidsetDynamicRotationIsDir()
No description provided
boolgetEndRGBVarSync()const
No description provided
voidsetEndRGBVarSync()
No description provided
floatgetFadeInTime()const
No description provided
floatgetFadeInTimeVar()const
No description provided
floatgetFadeOutTime()const
No description provided
floatgetFadeOutTimeVar()const
No description provided
floatgetFrictionPos()const
No description provided
floatgetFrictionPosVar()const
No description provided
floatgetFrictionRot()const
No description provided
floatgetFrictionRotVar()const
No description provided
floatgetFrictionSize()const
No description provided
floatgetFrictionSizeVar()const
No description provided
boolgetOrderSensitive()const
No description provided
floatgetRespawn()const
No description provided
floatgetRespawnVar()const
No description provided
boolgetStartRGBVarSync()const
No description provided
boolgetStartRadiusEqualToEnd()const
No description provided
boolgetStartSizeEqualToEnd()const
No description provided
boolgetStartSpinEqualToEnd()const
No description provided
floatgetTimeElapsed()
No description provided
boolgetUseUniformColorMode()const
No description provided
boolgetWasRemoved()const
No description provided
boolgetUsingSchedule()const
No description provided
voidsetEndAlpha()
No description provided
voidsetFadeInTime()
No description provided
voidsetFadeInTimeVar()
No description provided
voidsetFadeOutTime()
No description provided
voidsetFadeOutTimeVar()
No description provided
voidsetFrictionPos()
No description provided
voidsetFrictionPosVar()
No description provided
voidsetFrictionRot()
No description provided
voidsetFrictionRotVar()
No description provided
voidsetFrictionSize()
No description provided
voidsetFrictionSizeVar()
No description provided
voidsetOrderSensitive()
No description provided
voidsetRespawn()
No description provided
voidsetRespawnVar()
No description provided
voidsetStartAlpha()
No description provided
voidsetStartRGBVarSync()
No description provided
voidsetStartRadiusEqualToEnd()
No description provided
voidsetStartSizeEqualToEnd()
No description provided
voidsetStartSpinEqualToEnd()
No description provided
voidsetUsingSchedule()
No description provided
voidsetWasRemoved()
No description provided
voidtoggleUniformColorMode()
No description provided
voidupdateVisible()
No description provided
virtualvoidupdateEmissionRate()
No description provided
Fields25
boolm_bTransformSystemDirty
;
No description provided
uintm_uAllocatedParticles
;
No description provided
boolm_bIsActive
;

Is the emitter active

floatm_fFadeInTime
;
No description provided
floatm_fFadeInTimeVar
;
No description provided
floatm_fFadeOutTime
;
No description provided
floatm_fFadeOutTimeVar
;
No description provided
floatm_fFrictionPos
;
No description provided
floatm_fFrictionPosVar
;
No description provided
floatm_fFrictionSize
;
No description provided
floatm_fFrictionSizeVar
;
No description provided
floatm_fFrictionRot
;
No description provided
floatm_fFrictionRotVar
;
No description provided
floatm_fRespawn
;
No description provided
floatm_fRespawnVar
;
No description provided
boolm_bStartSpinEqualToEnd
;
No description provided
boolm_bStartSizeEqualToEnd
;
No description provided
boolm_bStartRadiusEqualToEnd
;
No description provided
boolm_bDynamicRotationIsDir
;
No description provided
boolm_bOrderSensitive
;
No description provided
boolm_bStartRGBVarSync
;
No description provided
boolm_bEndRGBVarSync
;
No description provided
boolm_bWasRemoved
;
No description provided
boolm_bUsingSchedule
;
No description provided
boolm_bIsBlendAdditive
;

whether or not the particles are using blend additive. If enabled, the following blending function will be used.

source blend function = GL_SRC_ALPHA;
dest blend function = GL_ONE;
Protected member functions1
virtualvoidupdateBlendFunc()
No description provided
Protected fields44
gd::stringm_sPlistFile
;
No description provided
floatm_fElapsed
;

//! time elapsed since the start of the system (in seconds)

;
No description provided
;
No description provided
;

//! Array of particles

floatm_fEmitCounter
;

//! How many particles can be emitted per second

uintm_uParticleIdx
;

//! particle idx

;
No description provided
uintm_uAtlasIndex
;
No description provided
uintm_uParticleCount
;
No description provided
floatm_fDuration
;
No description provided
cocos2d::CCPointm_tSourcePosition
;
No description provided
;
No description provided
floatm_fLife
;
No description provided
floatm_fLifeVar
;
No description provided
floatm_fAngle
;
No description provided
floatm_fAngleVar
;
No description provided
floatm_fStartSize
;
No description provided
floatm_fStartSizeVar
;
No description provided
floatm_fEndSize
;
No description provided
floatm_fEndSizeVar
;
No description provided
cocos2d::ccColor4Fm_tStartColor
;
No description provided
cocos2d::ccColor4Fm_tStartColorVar
;
No description provided
;
No description provided
cocos2d::ccColor4Fm_tEndColorVar
;
No description provided
floatm_fStartSpin
;
No description provided
floatm_fStartSpinVar
;
No description provided
floatm_fEndSpin
;
No description provided
floatm_fEndSpinVar
;
No description provided
floatm_fEmissionRate
;
No description provided
uintm_uTotalParticles
;
No description provided
;
No description provided
;
No description provided
boolm_bOpacityModifyRGB
;
No description provided
;
No description provided
boolm_bIsAutoRemoveOnFinish
;

Since v0.8

whether or not the node will be auto-removed when it has no particles left. By default it is false.

intm_nEmitterMode
;
No description provided
floatm_fDefaultStartSize
;
No description provided
floatm_fDefaultStartSizeVar
;
No description provided
floatm_fDefaultEndSize2
;
No description provided
floatm_fDefaultEndSize
;
No description provided
floatm_fDefaultModeASpeed
;
No description provided
floatm_fDefaultModeASpeedVar
;
No description provided
cocos2d::CCPointm_tDefaultPosVar
;
No description provided