Package com.badlogic.gdx.graphics.g2d

Examples of com.badlogic.gdx.graphics.g2d.ParticleEffect


* @author Clément
*/
public class ParticleEffectGDX {

    public ParticleEffectGDX(String effectFile, String imageDir) {
        m_particleEffect = new ParticleEffect();
        FileHandle ef = Gdx.files.absolute(new File(effectFile).getAbsolutePath());
        FileHandle id = Gdx.files.absolute(new File(imageDir).getAbsolutePath());
        m_particleEffect.load(ef, id);
    }
View Full Code Here


        FileHandle id = Gdx.files.absolute(new File(imageDir).getAbsolutePath());
        m_particleEffect.load(ef, id);
    }

    public ParticleEffect createEffect() {
        return new ParticleEffect(m_particleEffect);
    }
View Full Code Here

    super(resolver);
  }

  @Override
  public ParticleEffect load (AssetManager am, String fileName, FileHandle file, ParticleEffectParameter param) {
    ParticleEffect effect = new ParticleEffect();
    if (param != null && param.atlasFile != null)
      effect.load(file, am.get(param.atlasFile, TextureAtlas.class), param.atlasPrefix);
    else if (param != null && param.imagesDir != null)
      effect.load(file, param.imagesDir);
    else
      effect.load(file, file.parent());
    return effect;
  }
View Full Code Here

    dialog.setVisible(true);
    final String file = dialog.getFile();
    final String dir = dialog.getDirectory();
    if (dir == null || file == null || file.trim().length() == 0) return;
    lastDir = dir;
    ParticleEffect effect = new ParticleEffect();
    try {
      effect.loadEmitters(Gdx.files.absolute(new File(dir, file).getAbsolutePath()));
      editor.effect = effect;
      emitterTableModel.getDataVector().removeAllElements();
      editor.particleData.clear();
    } catch (Exception ex) {
      System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());
      ex.printStackTrace();
      JOptionPane.showMessageDialog(editor, "Error opening effect.");
      return;
    }
    for (ParticleEmitter emitter : effect.getEmitters()) {
      emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
      emitterTableModel.addRow(new Object[] {emitter.getName(), true});
    }
    editIndex = 0;
    emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
View Full Code Here

    dialog.setVisible(true);
    final String file = dialog.getFile();
    final String dir = dialog.getDirectory();
    if (dir == null || file == null || file.trim().length() == 0) return;
    lastDir = dir;
    ParticleEffect effect = new ParticleEffect();
    try {
      effect.loadEmitters(Gdx.files.absolute(new File(dir, file).getAbsolutePath()));
      editor.effect = effect;
      emitterTableModel.getDataVector().removeAllElements();
      editor.particleData.clear();
    } catch (Exception ex) {
      System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());
      ex.printStackTrace();
      JOptionPane.showMessageDialog(editor, "Error opening effect.");
      return;
    }
    for (ParticleEmitter emitter : effect.getEmitters()) {
      emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
      emitterTableModel.addRow(new Object[] {emitter.getName(), true});
    }
    editIndex = 0;
    emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
View Full Code Here

    dialog.setVisible(true);
    final String file = dialog.getFile();
    final String dir = dialog.getDirectory();
    if (dir == null || file == null || file.trim().length() == 0) return;
    lastDir = dir;
    ParticleEffect effect = new ParticleEffect();
    try {
      effect.loadEmitters(Gdx.files.absolute(new File(dir, file).getAbsolutePath()));
      editor.effect = effect;
      emitterTableModel.getDataVector().removeAllElements();
      editor.particleData.clear();
    } catch (Exception ex) {
      System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());
      ex.printStackTrace();
      JOptionPane.showMessageDialog(editor, "Error opening effect.");
      return;
    }
    for (ParticleEmitter emitter : effect.getEmitters()) {
      emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
      emitterTableModel.addRow(new Object[] {emitter.getName(), true});
    }
    editIndex = 0;
    emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
View Full Code Here

    super(resolver);
  }

  @Override
  public ParticleEffect load (AssetManager am, String fileName, FileHandle file, ParticleEffectParameter param) {
    ParticleEffect effect = new ParticleEffect();
    if (param != null && param.atlasFile != null)
      effect.load(file, am.get(param.atlasFile, TextureAtlas.class), param.atlasPrefix);
    else if (param != null && param.imagesDir != null)
      effect.load(file, param.imagesDir);
    else
      effect.load(file, file.parent());
    return effect;
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.g2d.ParticleEffect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.