Search in sources :

Example 6 with ParticleEffect

use of com.badlogic.gdx.graphics.g2d.ParticleEffect in project libgdx by libgdx.

the class ParticleEmittersTest method create.

@Override
public void create() {
    spriteBatch = new SpriteBatch();
    effect = new ParticleEffect();
    effect.load(Gdx.files.internal("data/singleTextureAllAdditive.p"), Gdx.files.internal("data"));
    effect.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
    effectPool = new ParticleEffectPool(effect, 20, 20);
    setupUI();
    InputProcessor inputProcessor = new InputAdapter() {

        public boolean touchDragged(int x, int y, int pointer) {
            if (latestEffect != null)
                latestEffect.setPosition(x, Gdx.graphics.getHeight() - y);
            return false;
        }

        public boolean touchDown(int x, int y, int pointer, int newParam) {
            latestEffect = effectPool.obtain();
            latestEffect.setEmittersCleanUpBlendFunction(!skipCleanup.isChecked());
            latestEffect.setPosition(x, Gdx.graphics.getHeight() - y);
            effects.add(latestEffect);
            return false;
        }
    };
    InputMultiplexer multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(ui);
    multiplexer.addProcessor(inputProcessor);
    Gdx.input.setInputProcessor(multiplexer);
}
Also used : ParticleEffect(com.badlogic.gdx.graphics.g2d.ParticleEffect) InputMultiplexer(com.badlogic.gdx.InputMultiplexer) InputAdapter(com.badlogic.gdx.InputAdapter) ParticleEffectPool(com.badlogic.gdx.graphics.g2d.ParticleEffectPool) InputProcessor(com.badlogic.gdx.InputProcessor) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch)

Aggregations

ParticleEffect (com.badlogic.gdx.graphics.g2d.ParticleEffect)6 InputProcessor (com.badlogic.gdx.InputProcessor)2 ParticleEmitter (com.badlogic.gdx.graphics.g2d.ParticleEmitter)2 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)2 InputAdapter (com.badlogic.gdx.InputAdapter)1 InputMultiplexer (com.badlogic.gdx.InputMultiplexer)1 Animation (com.badlogic.gdx.graphics.g2d.Animation)1 ParticleEffectPool (com.badlogic.gdx.graphics.g2d.ParticleEffectPool)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Body (com.badlogic.gdx.physics.box2d.Body)1 Array (com.badlogic.gdx.utils.Array)1 EngineGDX (ilargia.egdx.impl.EngineGDX)1 PhysicsManagerGDX (ilargia.egdx.impl.managers.PhysicsManagerGDX)1 Bounds (ilargia.egdx.logicbricks.data.Bounds)1 GameEntity (ilargia.egdx.logicbricks.gen.game.GameEntity)1 SensorEntity (ilargia.egdx.logicbricks.gen.sensor.SensorEntity)1 BodyBuilder (ilargia.egdx.util.BodyBuilder)1 File (java.io.File)1