com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UdacityScreen.java    From ud405 with MIT License 6 votes vote down vote up
@Override
public void render(float delta) {

    // TODO: Make this UDACITY_BLUE instead
    clearScreen(UDACITY_ORANGE);

    batch.begin();
    batch.draw(logo,
            (Gdx.graphics.getWidth() - LOGO_WIDTH) / 2,
            (Gdx.graphics.getHeight() - logoHeight) / 2,
            LOGO_WIDTH,
            logoHeight);
    for (int i = effects.size - 1; i >= 0; i--) {
        PooledEffect effect = effects.get(i);
        effect.draw(batch, delta);
        if (effect.isComplete()) {
            effect.free();
            effects.removeIndex(i);
        }
    }
    batch.end();
}
 
Example #2
Source File: UdacityScreen.java    From ud406 with MIT License 6 votes vote down vote up
@Override
public void render(float delta) {
    clearScreen(UDACITY_ORANGE);
    batch.begin();
    // TODO: Investigate the .draw() method on SpriteBatch
    batch.draw(logo,
            (Gdx.graphics.getWidth() - LOGO_WIDTH) / 2,
            (Gdx.graphics.getHeight() - logoHeight) / 2,
            LOGO_WIDTH,
            logoHeight);
    // TODO: Why are we iterating backwards?
    for (int i = effects.size - 1; i >= 0; i--) {
        PooledEffect effect = effects.get(i);
        effect.draw(batch, delta);
        if (effect.isComplete()) {
            effect.free();
            effects.removeIndex(i);
        }
    }
    batch.end();
}
 
Example #3
Source File: Particle.java    From Norii with Apache License 2.0 5 votes vote down vote up
Particle(final TiledMapPosition pos, final PooledEffect pe, final ParticleType type) {
	super();
	this.pos = pos;
	active = true;
	this.type = type;
	particleEffect = pe;
}
 
Example #4
Source File: ParticleMaker.java    From Norii with Apache License 2.0 4 votes vote down vote up
private static Particle createPooledParticle(final ParticleType particletype, final TiledMapPosition pos, final ParticlePool particlePool) {
	final PooledEffect particle = particlePool.getParticleEffect();
	particle.setPosition(pos.getTileX(), pos.getTileY());
	particle.scaleEffect(Map.UNIT_SCALE);
	return new Particle(pos, particle, particletype);
}
 
Example #5
Source File: ParticlePool.java    From Norii with Apache License 2.0 4 votes vote down vote up
public PooledEffect getParticleEffect() {
	return particleEffectPool.obtain();
}
 
Example #6
Source File: Particle.java    From Norii with Apache License 2.0 4 votes vote down vote up
public PooledEffect getParticleEffect() {
	return particleEffect;
}
 
Example #7
Source File: UdacityScreen.java    From ud405 with MIT License 4 votes vote down vote up
private void spawnParticleEffect(int x, int y) {
    PooledEffect effect = touchEffectPool.obtain();
    effect.setPosition(x, Gdx.graphics.getHeight() - y);
    effects.add(effect);
}
 
Example #8
Source File: UdacityScreen.java    From ud406 with MIT License 4 votes vote down vote up
private void spawnParticleEffect(int x, int y) {
    PooledEffect effect = touchEffectPool.obtain();
    effect.setPosition(x, Gdx.graphics.getHeight() - y);
    effects.add(effect);
}