Class ParticleEffect

java.lang.Object
com.badlogic.gdx.ParticleEffect
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
Direct Known Subclasses:
ParticleEffectPool.PooledEffect

public class ParticleEffect extends Object implements com.badlogic.gdx.utils.Disposable
  • 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

      public ParticleEffect(ParticleEffect effect)
  • 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. See reset(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

      public com.badlogic.gdx.utils.Array<ParticleEmitter> getEmitters()
    • findEmitter

      public ParticleEmitter findEmitter(String name)
      Returns the emitter with the specified name, or null.
    • preAllocateParticles

      public void preAllocateParticles()
      Allocates all emitters particles. See ParticleEmitter.preAllocateParticles()
    • save

      public void save(Writer output) throws IOException
      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

      public void loadEmitterImages(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas, String atlasPrefix)
    • loadEmitterImages

      public void loadEmitterImages(com.badlogic.gdx.files.FileHandle imagesDir)
    • newEmitter

      protected ParticleEmitter newEmitter(BufferedReader reader) throws IOException
      Throws:
      IOException
    • newEmitter

      protected ParticleEmitter newEmitter(ParticleEmitter emitter)
    • 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:
      dispose in interface com.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 a ParticleEffectPool, 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 a ParticleEffectPool, 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 a ParticleEffectPool, the scale will be reset when it is returned to the pool.
    • setEmittersCleanUpBlendFunction

      public void setEmittersCleanUpBlendFunction(boolean cleanUpBlendFunction)
      Sets the cleansUpBlendFunction parameter on all ParticleEmitters currently 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.