Search in sources :

Example 6 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class MapParticles method init.

public void init() {
    map.put(null, new ArrayList<>());
    for (DAY_TIME sub : DAY_TIME.values()) {
        map.put(sub, new ArrayList<>());
    }
    load();
    for (MAP_EMITTER_GROUP sub : MAP_EMITTER_GROUP.values()) {
        boolean displayed = false;
        for (DAY_TIME time : sub.times) {
            if (time == this.time) {
                displayed = true;
                break;
            }
        // same check for weather perhaps
        }
        if (sub.points != null)
            for (MAP_POINTS point : sub.points) {
                for (int i = 0; i < sub.number; i++) {
                    int mod = (i % 2 == 0) ? 1 : -1;
                    int offsetX = mod * sub.distance * i;
                    mod = (i % 3 == 0) ? 1 : -1;
                    int offsetY = mod * sub.distance * i;
                    EmitterActor emitter = create(sub.sfxPath, point.x + offsetX, point.y + offsetY, time);
                    if (displayed) {
                        this.displayed.add(emitter);
                    }
                }
            }
    }
    initialized = true;
}
Also used : MAP_POINTS(eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_POINTS) DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 7 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class EditorParticleMaster method removeClosest.

public void removeClosest(int x, int y) {
    float minDistance = Float.MAX_VALUE;
    Actor actor = null;
    DequeImpl<Actor> list = new DequeImpl<>(particles.getEmitterMap().get(time));
    list.addAll(map.get(time));
    for (Actor sub : list) {
        if (sub instanceof EmitterActor) {
            float distance = new Vector2(x, y).dst(new Vector2(sub.getX(), sub.getY()));
            if (distance < minDistance) {
                minDistance = distance;
                actor = sub;
            }
        }
    // can we not attach click listeners to emtiterActors?!
    }
    removeEmitter((EmitterActor) actor, time);
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) Actor(com.badlogic.gdx.scenes.scene2d.Actor) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) DequeImpl(main.system.datatypes.DequeImpl)

Example 8 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class EditorParticleMaster method save.

public void save(DAY_TIME time) {
    Set<EmitterActor> emitterActors = new LinkedHashSet<>(map.get(time));
    try {
        emitterActors.addAll(particles.getEmitterMap().get(time));
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    String contents = "";
    for (EmitterActor sub : emitterActors) {
        String s = sub.getPath() + StringMaster.wrapInParenthesis(new Coordinates(true, (int) sub.getX(), (int) sub.getY()).toString()) + ";\n";
        contents += s;
    }
    String s;
    if (time == null)
        s = "all";
    else
        s = time.toString();
    String path = getPath() + s + ".txt";
    FileManager.write(contents, path);
}
Also used : Coordinates(main.game.bf.Coordinates) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 9 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class EditorParticleMaster method removeLast.

public void removeLast() {
    if (stack.isEmpty())
        return;
    EmitterActor last = stack.pop();
    removeEmitter(last, time);
}
Also used : EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 10 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class MapObjStage method removeClosest.

public void removeClosest(int x, int y) {
    float minDistance = Float.MAX_VALUE;
    Actor actor = null;
    for (Actor sub : getRoot().getChildren()) {
        if (sub instanceof EmitterActor) {
            float distance = new Vector2(x, y).dst(new Vector2(sub.getX(), sub.getY()));
            if (distance < minDistance) {
                minDistance = distance;
                actor = sub;
            }
        }
    }
    GuiEventManager.trigger(MapEvent.REMOVE_MAP_OBJ, actor);
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) Actor(com.badlogic.gdx.scenes.scene2d.Actor) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Aggregations

EmitterActor (eidolons.libgdx.anims.particles.EmitterActor)17 Vector2 (com.badlogic.gdx.math.Vector2)3 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 DAY_TIME (main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)2 Coordinates (main.game.bf.Coordinates)2 Batch (com.badlogic.gdx.graphics.g2d.Batch)1 ParticleEmitter (com.badlogic.gdx.graphics.g2d.ParticleEmitter)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 CompositeAnim (eidolons.libgdx.anims.CompositeAnim)1 EMITTER_VALUE_GROUP (eidolons.libgdx.anims.particles.EmitterPresetMaster.EMITTER_VALUE_GROUP)1 MAP_POINTS (eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_POINTS)1 ActiveObj (main.entity.obj.ActiveObj)1 FileChooser (main.swing.generic.components.editors.FileChooser)1 DequeImpl (main.system.datatypes.DequeImpl)1