Class ParticleEmitter


  • public class ParticleEmitter
    extends java.lang.Object
    • Field Detail

      • duration

        public float duration
      • durationTimer

        public float durationTimer
    • Constructor Detail

      • ParticleEmitter

        public ParticleEmitter()
      • ParticleEmitter

        public ParticleEmitter​(java.io.BufferedReader reader)
                        throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • setMaxParticleCount

        public void setMaxParticleCount​(int maxParticleCount)
      • addParticle

        public void addParticle()
      • addParticles

        public void addParticles​(int count)
      • update

        public void update​(float delta)
      • draw

        public void draw​(Batch batch)
      • draw

        public void draw​(Batch batch,
                         float delta)
        Updates and draws the particles. This is slightly more efficient than calling update(float) and draw(Batch) separately.
      • start

        public void start()
      • reset

        public void reset()
      • setPosition

        public void setPosition​(float x,
                                float y)
      • setSprites

        public void setSprites​(Array<Sprite> sprites)
      • preAllocateParticles

        public void preAllocateParticles()
        Allocates max particles emitter can hold. Usually called early on to avoid allocation on updates. setSprites(Array) must have been set before calling this method
      • allowCompletion

        public void allowCompletion()
        Ignores the continuous setting until the emitter is started again. This allows the emitter to stop smoothly.
      • getName

        public java.lang.String getName()
      • setName

        public void setName​(java.lang.String name)
      • isAttached

        public boolean isAttached()
      • setAttached

        public void setAttached​(boolean attached)
      • isContinuous

        public boolean isContinuous()
      • setContinuous

        public void setContinuous​(boolean continuous)
      • isAligned

        public boolean isAligned()
      • setAligned

        public void setAligned​(boolean aligned)
      • isAdditive

        public boolean isAdditive()
      • setAdditive

        public void setAdditive​(boolean additive)
      • cleansUpBlendFunction

        public boolean cleansUpBlendFunction()
        Returns:
        Whether this ParticleEmitter automatically returns the Batch's blend function to the alpha-blending default (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) when done drawing.
      • setCleansUpBlendFunction

        public void setCleansUpBlendFunction​(boolean cleansUpBlendFunction)
        Set whether to automatically return the Batch's blend function to the alpha-blending default (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) when done drawing. Is true by default. If set to false, the Batch's blend function is left as it was for drawing this ParticleEmitter, which prevents the Batch from being flushed repeatedly if consecutive ParticleEmitters with the same additive or pre-multiplied alpha state are drawn in a row.

        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.

        Parameters:
        cleansUpBlendFunction -
      • isBehind

        public boolean isBehind()
      • setBehind

        public void setBehind​(boolean behind)
      • isPremultipliedAlpha

        public boolean isPremultipliedAlpha()
      • setPremultipliedAlpha

        public void setPremultipliedAlpha​(boolean premultipliedAlpha)
      • getMinParticleCount

        public int getMinParticleCount()
      • setMinParticleCount

        public void setMinParticleCount​(int minParticleCount)
      • getMaxParticleCount

        public int getMaxParticleCount()
      • isComplete

        public boolean isComplete()
      • getPercentComplete

        public float getPercentComplete()
      • getX

        public float getX()
      • getY

        public float getY()
      • getActiveCount

        public int getActiveCount()
      • getImagePaths

        public Array<java.lang.String> getImagePaths()
      • setImagePaths

        public void setImagePaths​(Array<java.lang.String> imagePaths)
      • setFlip

        public void setFlip​(boolean flipX,
                            boolean flipY)
      • flipY

        public void flipY()
      • getBoundingBox

        public BoundingBox getBoundingBox()
        Returns the bounding box for all active particles. z axis will always be zero.
      • scaleSize

        public void scaleSize​(float scale)
        Permanently scales the size of the emitter by scaling all its ranged values related to size.
      • scaleSize

        public void scaleSize​(float scaleX,
                              float scaleY)
        Permanently scales the size of the emitter by scaling all its ranged values related to size.
      • scaleMotion

        public void scaleMotion​(float scale)
        Permanently scales the speed of the emitter by scaling all its ranged values related to motion.
      • matchSize

        public void matchSize​(ParticleEmitter template)
        Sets all size-related ranged values to match those of the template emitter.
      • matchXSize

        public void matchXSize​(ParticleEmitter template)
        Sets all horizontal size-related ranged values to match those of the template emitter.
      • matchYSize

        public void matchYSize​(ParticleEmitter template)
        Sets all vertical size-related ranged values to match those of the template emitter.
      • matchMotion

        public void matchMotion​(ParticleEmitter template)
        Sets all motion-related ranged values to match those of the template emitter.
      • save

        public void save​(java.io.Writer output)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • load

        public void load​(java.io.BufferedReader reader)
                  throws java.io.IOException
        Throws:
        java.io.IOException