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()

weak reference to the CCSpriteBatchNode that renders the CCSprite

virtualvoidsetBatchNode()

weak reference to the CCSpriteBatchNode that renders the CCSprite

uintgetAtlasIndex()const
No description provided
voidsetAtlasIndex(
uintvar
)
No description provided
virtualuintgetParticleCount()

Quantity of particles that are being simulated at the moment

virtualfloatgetDuration()

How many seconds the emitter will run. -1 means ‘forever’

virtualvoidsetDuration()

How many seconds the emitter will run. -1 means ‘forever’

virtualcocos2d::CCPointconst&getSourcePosition()

sourcePosition of the emitter

virtualvoidsetSourcePosition()

sourcePosition of the emitter

virtualcocos2d::CCPointconst&getPosVar()

Position variance of the emitter

virtualvoidsetPosVar()

Position variance of the emitter

virtualfloatgetLife()

life, and life variation of each particle

virtualvoidsetLife()

life, and life variation of each particle

virtualfloatgetLifeVar()

life variance of each particle

virtualvoidsetLifeVar()

life variance of each particle

virtualfloatgetAngle()

angle and angle variation of each particle

virtualvoidsetAngle()

angle and angle variation of each particle

virtualfloatgetAngleVar()

angle variance of each particle

virtualvoidsetAngleVar()

angle variance of each particle

virtualvoidupdateEmissionRate()
No description provided
virtualcocos2d::CCPointconst&getGravity()
No description provided
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()

start size in pixels of each particle

virtualvoidsetStartSize()

start size in pixels of each particle

virtualfloatgetStartSizeVar()

size variance in pixels of each particle

virtualvoidsetStartSizeVar()

size variance in pixels of each particle

virtualfloatgetEndSize()

end size in pixels of each particle

virtualvoidsetEndSize()

end size in pixels of each particle

virtualfloatgetEndSizeVar()

end size variance in pixels of each particle

virtualvoidsetEndSizeVar()

end size variance in pixels of each particle

virtualcocos2d::ccColor4Fconst&getStartColor()

start color of each particle

virtualvoidsetStartColor()

start color of each particle

virtualcocos2d::ccColor4Fconst&getStartColorVar()

start color variance of each particle

virtualvoidsetStartColorVar()

start color variance of each particle

virtualcocos2d::ccColor4Fconst&getEndColor()

end color and end color variation of each particle

virtualvoidsetEndColor()

end color and end color variation of each particle

virtualcocos2d::ccColor4Fconst&getEndColorVar()

end color variance of each particle

virtualvoidsetEndColorVar()

end color variance of each particle

virtualfloatgetStartSpin()

end color variance of each particle

virtualvoidsetStartSpin()

end color variance of each particle

virtualfloatgetStartSpinVar()

end color variance of each particle

virtualvoidsetStartSpinVar()

end color variance of each particle

virtualfloatgetEndSpin()

end color variance of each particle

virtualvoidsetEndSpin()

end color variance of each particle

virtualfloatgetEndSpinVar()

end color variance of each particle

virtualvoidsetEndSpinVar()

end color variance of each particle

virtualfloatgetEmissionRate()

emission rate of the particles

virtualvoidsetEmissionRate()

emission rate of the particles

virtualuintgetTotalParticles()

maximum particles of the system

virtualvoidsetTotalParticles(
uintvar
)

maximum particles of the system

virtualcocos2d::CCTexture2D*getTexture()

conforms to CocosNodeTexture protocol

virtualvoidsetTexture()

conforms to CocosNodeTexture protocol

virtualcocos2d::ccBlendFuncgetBlendFunc()

conforms to CocosNodeTexture protocol

virtualvoidsetBlendFunc()

conforms to CocosNodeTexture protocol

virtualboolgetOpacityModifyRGB()

does the alpha value modify color

virtualvoidsetOpacityModifyRGB(
boolvar
)

does the alpha value modify color

virtualcocos2d::tCCPositionTypegetPositionType()

Since v0.8

particles movement type: Free or Grouped

virtualvoidsetPositionType()

Since v0.8

particles movement type: Free or Grouped

virtualboolisAutoRemoveOnFinish()
No description provided
virtualvoidsetAutoRemoveOnFinish(
boolvar
)
No description provided
virtualintgetEmitterMode()

Switch between different kind of emitter modes:

  • kCCParticleModeGravity: uses gravity, speed, radial and tangential acceleration
  • kCCParticleModeRadius: uses radius movement + rotation
virtualvoidsetEmitterMode(
intvar
)

Switch between different kind of emitter modes:

  • kCCParticleModeGravity: uses gravity, speed, radial and tangential acceleration
  • kCCParticleModeRadius: uses radius movement + rotation
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
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

;

weak reference to the CCSpriteBatchNode that renders the CCSprite

uintm_uAtlasIndex
;
No description provided
uintm_uParticleCount
;

Quantity of particles that are being simulated at the moment

floatm_fDuration
;

How many seconds the emitter will run. -1 means ‘forever’

cocos2d::CCPointm_tSourcePosition
;

sourcePosition of the emitter

;

Position variance of the emitter

floatm_fLife
;

life, and life variation of each particle

floatm_fLifeVar
;

life variance of each particle

floatm_fAngle
;

angle and angle variation of each particle

floatm_fAngleVar
;

angle variance of each particle

floatm_fStartSize
;

start size in pixels of each particle

floatm_fStartSizeVar
;

size variance in pixels of each particle

floatm_fEndSize
;

end size in pixels of each particle

floatm_fEndSizeVar
;

end size variance in pixels of each particle

cocos2d::ccColor4Fm_tStartColor
;

start color of each particle

cocos2d::ccColor4Fm_tStartColorVar
;

start color variance of each particle

;

end color and end color variation of each particle

cocos2d::ccColor4Fm_tEndColorVar
;

end color variance of each particle

floatm_fStartSpin
;

end color variance of each particle

floatm_fStartSpinVar
;

end color variance of each particle

floatm_fEndSpin
;

end color variance of each particle

floatm_fEndSpinVar
;

end color variance of each particle

floatm_fEmissionRate
;

emission rate of the particles

uintm_uTotalParticles
;

maximum particles of the system

;

conforms to CocosNodeTexture protocol

;

conforms to CocosNodeTexture protocol

boolm_bOpacityModifyRGB
;

does the alpha value modify color

;

Since v0.8

particles movement type: Free or Grouped

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
;

Switch between different kind of emitter modes:

  • kCCParticleModeGravity: uses gravity, speed, radial and tangential acceleration
  • kCCParticleModeRadius: uses radius movement + rotation
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