Package com.badlogic.gdx
Class ParticleEffect
java.lang.Object
com.badlogic.gdx.ParticleEffect
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
- Direct Known Subclasses:
ParticleEffectPool.PooledEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.badlogic.gdx.math.collision.BoundingBoxfloatbooleanfloatfloat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddispose()Disposes the texture for each sprite for each ParticleEmitter.voiddraw(com.badlogic.gdx.graphics.g2d.Batch spriteBatch) voiddraw(com.badlogic.gdx.graphics.g2d.Batch spriteBatch, float delta) findEmitter(String name) Returns the emitter with the specified name, or null.voidflipY()com.badlogic.gdx.math.collision.BoundingBoxReturns the bounding box for all active particles. z axis will always be zero.com.badlogic.gdx.utils.Array<ParticleEmitter> booleanvoidload(com.badlogic.gdx.files.FileHandle effectFile, com.badlogic.gdx.files.FileHandle imagesDir) voidload(com.badlogic.gdx.files.FileHandle effectFile, com.badlogic.gdx.graphics.g2d.TextureAtlas atlas) voidload(com.badlogic.gdx.files.FileHandle effectFile, com.badlogic.gdx.graphics.g2d.TextureAtlas atlas, String atlasPrefix) voidloadEmitterImages(com.badlogic.gdx.files.FileHandle imagesDir) voidloadEmitterImages(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas) voidloadEmitterImages(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas, String atlasPrefix) voidloadEmitters(com.badlogic.gdx.files.FileHandle effectFile) com.badlogic.gdx.graphics.TextureloadTexture(com.badlogic.gdx.files.FileHandle file) protected ParticleEmitternewEmitter(ParticleEmitter emitter) protected ParticleEmitternewEmitter(BufferedReader reader) voidAllocates all emitters particles.voidreset()Resets the effect so it can be started again like a new effect.voidreset(boolean resetScaling) Resets the effect so it can be started again like a new effect.voidreset(boolean resetScaling, boolean start) Resets the effect so it can be started again like a new effect.voidvoidscaleEffect(float scaleFactor) Permanently scales all the size and motion parameters of all the emitters in this effect.voidscaleEffect(float scaleFactor, float motionScaleFactor) Permanently scales all the size and motion parameters of all the emitters in this effect.voidscaleEffect(float xSizeScaleFactor, float ySizeScaleFactor, float motionScaleFactor) Permanently scales all the size and motion parameters of all the emitters in this effect.voidsetDuration(int duration) voidsetEmittersCleanUpBlendFunction(boolean cleanUpBlendFunction) Sets thecleansUpBlendFunctionparameter on allParticleEmitterscurrently in this ParticleEffect.voidsetFlip(boolean flipX, boolean flipY) voidsetPosition(float x, float y) voidstart()voidupdate(float delta)
-
Field Details
-
bounds
public com.badlogic.gdx.math.collision.BoundingBox bounds -
ownsTexture
public boolean ownsTexture -
xSizeScale
public float xSizeScale -
ySizeScale
public float ySizeScale -
motionScale
public float motionScale
-
-
Constructor Details
-
ParticleEffect
public ParticleEffect() -
ParticleEffect
-
-
Method Details
-
start
public void start() -
reset
public void reset()Resets the effect so it can be started again like a new effect. Any changes to scale are reverted. Seereset(boolean). -
reset
public void reset(boolean resetScaling) Resets the effect so it can be started again like a new effect.- Parameters:
resetScaling- Whether to restore the original size and motion parameters if they were scaled. Repeated scaling and resetting may introduce error.
-
reset
public void reset(boolean resetScaling, boolean start) Resets the effect so it can be started again like a new effect.- Parameters:
resetScaling- Whether to restore the original size and motion parameters if they were scaled. Repeated scaling and resetting may introduce error.start- Whether to start the effect after resetting.
-
update
public void update(float delta) -
draw
public void draw(com.badlogic.gdx.graphics.g2d.Batch spriteBatch) -
draw
public void draw(com.badlogic.gdx.graphics.g2d.Batch spriteBatch, float delta) -
allowCompletion
public void allowCompletion() -
isComplete
public boolean isComplete() -
setDuration
public void setDuration(int duration) -
setPosition
public void setPosition(float x, float y) -
setFlip
public void setFlip(boolean flipX, boolean flipY) -
flipY
public void flipY() -
getEmitters
-
findEmitter
Returns the emitter with the specified name, or null. -
preAllocateParticles
public void preAllocateParticles()Allocates all emitters particles. SeeParticleEmitter.preAllocateParticles() -
save
- Throws:
IOException
-
load
public void load(com.badlogic.gdx.files.FileHandle effectFile, com.badlogic.gdx.files.FileHandle imagesDir) -
load
public void load(com.badlogic.gdx.files.FileHandle effectFile, com.badlogic.gdx.graphics.g2d.TextureAtlas atlas) -
load
public void load(com.badlogic.gdx.files.FileHandle effectFile, com.badlogic.gdx.graphics.g2d.TextureAtlas atlas, String atlasPrefix) -
loadEmitters
public void loadEmitters(com.badlogic.gdx.files.FileHandle effectFile) -
loadEmitterImages
public void loadEmitterImages(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas) -
loadEmitterImages
-
loadEmitterImages
public void loadEmitterImages(com.badlogic.gdx.files.FileHandle imagesDir) -
newEmitter
- Throws:
IOException
-
newEmitter
-
loadTexture
public com.badlogic.gdx.graphics.Texture loadTexture(com.badlogic.gdx.files.FileHandle file) -
dispose
public void dispose()Disposes the texture for each sprite for each ParticleEmitter.- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
getBoundingBox
public com.badlogic.gdx.math.collision.BoundingBox getBoundingBox()Returns the bounding box for all active particles. z axis will always be zero. -
scaleEffect
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 aParticleEffectPool, the scale will be reset when it is returned to the pool. -
scaleEffect
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 aParticleEffectPool, the scale will be reset when it is returned to the pool. -
scaleEffect
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 aParticleEffectPool, the scale will be reset when it is returned to the pool. -
setEmittersCleanUpBlendFunction
public void setEmittersCleanUpBlendFunction(boolean cleanUpBlendFunction) Sets thecleansUpBlendFunctionparameter on allParticleEmitterscurrently in this ParticleEffect.IMPORTANT: 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.
-