Search in sources :

Example 11 with ParticleEmitter

use of com.badlogic.gdx.graphics.g2d.ParticleEmitter in project Eidolons by IDemiurge.

the class Anim method getTimeToFinish.

private float getTimeToFinish() {
    float time = 0;
    for (EmitterActor e : emitterList) {
        for (ParticleEmitter emitter : e.getEffect().getEmitters()) {
            float timeLeft = emitter.getDuration().getLowMax() / 1000 * Math.max(0, emitter.getPercentComplete());
            if (timeLeft > time) {
                time = timeLeft;
            }
        }
    }
    float gracePeriod = 0.25f;
    time = time + time * gracePeriod;
    LogMaster.log(LogMaster.ANIM_DEBUG, this + " adding TimeToFinish: " + time);
    return time;
}
Also used : ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 12 with ParticleEmitter

use of com.badlogic.gdx.graphics.g2d.ParticleEmitter in project Eidolons by IDemiurge.

the class ParticleEffect method offset.

public void offset(float offset, EMITTER_VALS_SCALED value) {
    for (ParticleEmitter e : getEmitters()) {
        Emitter emitter = (Emitter) e;
        emitter.offset(offset, value.name().toLowerCase());
    }
}
Also used : ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter) ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter)

Example 13 with ParticleEmitter

use of com.badlogic.gdx.graphics.g2d.ParticleEmitter in project Eidolons by IDemiurge.

the class ParticleEffect method set.

public void set(String valName, String value) {
    for (ParticleEmitter e : getEmitters()) {
        Emitter emitter = (Emitter) e;
        emitter.set(valName, value.toLowerCase());
    }
}
Also used : ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter) ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter)

Example 14 with ParticleEmitter

use of com.badlogic.gdx.graphics.g2d.ParticleEmitter in project Eidolons by IDemiurge.

the class ParticleEffect method loadEmitters.

public void loadEmitters(FileHandle effectFile) {
    InputStream input = effectFile.read();
    getEmitters().clear();
    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new InputStreamReader(input), 512);
        while (true) {
            ParticleEmitter emitter = (checkSprite(effectFile)) ? new SpriteEmitter(reader) : new Emitter(reader);
            getEmitters().add(emitter);
            if (reader.readLine() == null) {
                break;
            }
            if (reader.readLine() == null) {
                break;
            }
        }
    } catch (IOException ex) {
        throw new GdxRuntimeException("Error loading effect: " + effectFile, ex);
    } finally {
        StreamUtils.closeQuietly(reader);
    }
}
Also used : ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter) GdxRuntimeException(com.badlogic.gdx.utils.GdxRuntimeException) ParticleEmitter(com.badlogic.gdx.graphics.g2d.ParticleEmitter) InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException)

Aggregations

ParticleEmitter (com.badlogic.gdx.graphics.g2d.ParticleEmitter)14 ParticleEffect (com.badlogic.gdx.graphics.g2d.ParticleEffect)3 File (java.io.File)3 Array (com.badlogic.gdx.utils.Array)2 InputProcessor (com.badlogic.gdx.InputProcessor)1 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)1 EmitterActor (eidolons.libgdx.anims.particles.EmitterActor)1 BufferedReader (java.io.BufferedReader)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 Writer (java.io.Writer)1 URI (java.net.URI)1 FreePaint (var3d.net.center.freefont.FreePaint)1