APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.graphics.g2d

public Class ParticleEffect

extends Object
implements Disposable
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.utils.Disposable
Known Direct Subclasses
com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect
Imports
java.io.BufferedReader, .File, .IOException, .InputStream, .InputStreamReader, .Writer, com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.graphics.Texture, com.badlogic.gdx.math.collision.BoundingBox, com.badlogic.gdx.utils.Array, .Disposable, .GdxRuntimeException, .ObjectMap, .StreamUtils

See http://www.badlogicgames.com/wordpress/?p=12555
Author
mzechner

Field Summary

Modifier and TypeField and Description
private BoundingBox
private final Array<ParticleEmitter>
protected float
private boolean
protected float
protected float

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Disposes the texture for each sprite for each ParticleEmitter.

public void
draw(Batch spriteBatch)

public void
draw(Batch spriteBatch, float delta)

public ParticleEmitter
findEmitter(String name)

Returns the emitter with the specified name, or null.

public void
public BoundingBox
getBoundingBox()

Returns the bounding box for all active particles.

public Array<ParticleEmitter>
public boolean
public void
load(FileHandle effectFile, FileHandle imagesDir)

public void
load(FileHandle effectFile, TextureAtlas atlas)

public void
load(FileHandle effectFile, TextureAtlas atlas, String atlasPrefix)

public void
public void
public void
public void
protected Texture
protected ParticleEmitter
protected ParticleEmitter
public void
preAllocateParticles()

Allocates all emitters particles.

public void
reset()

Resets the effect so it can be started again like a new effect.

public void
reset(boolean
Whether to restore the original size and motion parameters if they were scaled. Repeated scaling and resetting may introduce error.
resetScaling
)

Resets the effect so it can be started again like a new effect.

public void
reset(boolean
Whether to restore the original size and motion parameters if they were scaled. Repeated scaling and resetting may introduce error.
resetScaling
,
boolean
Whether to start the effect after resetting.
start
)

Resets the effect so it can be started again like a new effect.

public void
save(Writer output)

public void
scaleEffect(float scaleFactor)

Permanently scales all the size and motion parameters of all the emitters in this effect.

public void
scaleEffect(float scaleFactor, float motionScaleFactor)

Permanently scales all the size and motion parameters of all the emitters in this effect.

public void
scaleEffect(float xSizeScaleFactor, float ySizeScaleFactor, float motionScaleFactor)

Permanently scales all the size and motion parameters of all the emitters in this effect.

public void
setDuration(int duration)

public void
setEmittersCleanUpBlendFunction(boolean cleanUpBlendFunction)

Sets the cleansUpBlendFunction parameter on all ParticleEmitters currently in this ParticleEffect.

public void
setFlip(boolean flipX, boolean flipY)

public void
setPosition(float x, float y)

public void
public void
update(float delta)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

boundsback to summary
private BoundingBox bounds
emittersback to summary
private final Array<ParticleEmitter> emitters
motionScaleback to summary
protected float motionScale
ownsTextureback to summary
private boolean ownsTexture
xSizeScaleback to summary
protected float xSizeScale
ySizeScaleback to summary
protected float ySizeScale

Constructor Detail

ParticleEffectback to summary
public ParticleEffect()
ParticleEffectback to summary
public ParticleEffect(ParticleEffect effect)

Method Detail

allowCompletionback to summary
public void allowCompletion()
disposeback to summary
public void dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Disposes the texture for each sprite for each ParticleEmitter.

drawback to summary
public void draw(Batch spriteBatch)
drawback to summary
public void draw(Batch spriteBatch, float delta)
findEmitterback to summary
public ParticleEmitter findEmitter(String name)

Returns the emitter with the specified name, or null.

flipYback to summary
public void flipY()
getBoundingBoxback to summary
public BoundingBox getBoundingBox()

Returns the bounding box for all active particles. z axis will always be zero.

getEmittersback to summary
public Array<ParticleEmitter> getEmitters()
isCompleteback to summary
public boolean isComplete()
loadback to summary
public void load(FileHandle effectFile, FileHandle imagesDir)
loadback to summary
public void load(FileHandle effectFile, TextureAtlas atlas)
loadback to summary
public void load(FileHandle effectFile, TextureAtlas atlas, String atlasPrefix)
loadEmitterImagesback to summary
public void loadEmitterImages(TextureAtlas atlas)
loadEmitterImagesback to summary
public void loadEmitterImages(TextureAtlas atlas, String atlasPrefix)
loadEmitterImagesback to summary
public void loadEmitterImages(FileHandle imagesDir)
loadEmittersback to summary
public void loadEmitters(FileHandle effectFile)
loadTextureback to summary
protected Texture loadTexture(FileHandle file)
newEmitterback to summary
protected ParticleEmitter newEmitter(BufferedReader reader) throws IOException
newEmitterback to summary
protected ParticleEmitter newEmitter(ParticleEmitter emitter)
preAllocateParticlesback to summary
public void preAllocateParticles()

Allocates all emitters particles. See com.badlogic.gdx.graphics.g2d.ParticleEmitter#preAllocateParticles()

resetback to summary
public void reset()

Resets the effect so it can be started again like a new effect. Any changes to scale are reverted. See reset(boolean).

resetback to summary
public void reset(boolean resetScaling)

Resets the effect so it can be started again like a new effect.

Parameters
resetScaling:boolean

Whether to restore the original size and motion parameters if they were scaled. Repeated scaling and resetting may introduce error.

resetback to summary
public void reset(boolean resetScaling, boolean start)

Resets the effect so it can be started again like a new effect.

Parameters
resetScaling:boolean

Whether to restore the original size and motion parameters if they were scaled. Repeated scaling and resetting may introduce error.

start:boolean

Whether to start the effect after resetting.

saveback to summary
public void save(Writer output) throws IOException
scaleEffectback to summary
public void scaleEffect(float scaleFactor)

Permanently scales all the size and motion parameters of all the emitters in this effect. If this effect originated from a ParticleEffectPool, the scale will be reset when it is returned to the pool.

scaleEffectback to summary
public void scaleEffect(float scaleFactor, float motionScaleFactor)

Permanently scales all the size and motion parameters of all the emitters in this effect. If this effect originated from a ParticleEffectPool, the scale will be reset when it is returned to the pool.

scaleEffectback to summary
public void scaleEffect(float xSizeScaleFactor, float ySizeScaleFactor, float motionScaleFactor)

Permanently scales all the size and motion parameters of all the emitters in this effect. If this effect originated from a ParticleEffectPool, the scale will be reset when it is returned to the pool.

setDurationback to summary
public void setDuration(int duration)
setEmittersCleanUpBlendFunctionback to summary
public void setEmittersCleanUpBlendFunction(boolean cleanUpBlendFunction)

Sets the cleansUpBlendFunction parameter on all ParticleEmitters currently in this ParticleEffect.

Important Note

If set to false and if the next object to use this Batch expects alpha blending, you are responsible for setting the Batch's blend function to (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) before that next object is drawn.

setFlipback to summary
public void setFlip(boolean flipX, boolean flipY)
setPositionback to summary
public void setPosition(float x, float y)
startback to summary
public void start()
updateback to summary
public void update(float delta)