Package org.newdawn.slick.particles

Examples of org.newdawn.slick.particles.ParticleSystem


  public ParticleActor() {
  }

  public ParticleActor(float x, float y) {
    super(x, y);
    particleSystem = new ParticleSystem("particle.png");
    particleSystem.addEmitter(new FireEmitter());
 
View Full Code Here


    super.paint(g);
  }

  public void update(int time) {
    if(fire==null){
      fire = new ParticleSystem("particle.png",20);
      FireEmitter f=new FireEmitter(0,0,5);     
      fire.addEmitter(f)
    }
    super.update(time);
    fire.update(time);
View Full Code Here

   *
   * @param additive
   *            True if the particle system should be set to additive
   */
  public void clearSystem(boolean additive) {
    system = new ParticleSystem("org/newdawn/slick/data/particle.tga", 2000);
    if (additive) {
      system.setBlendingMode(ParticleSystem.BLEND_ADDITIVE);
    }
    system.setRemoveCompletedEmitters(false);
  }
View Full Code Here

  public void init(GameContainer container) throws SlickException {
    container.getInput().addListener(listener);
    container.setShowFPS(false);
   
    system = new ParticleSystem("org/newdawn/slick/data/particle.tga", 2000);
    system.setBlendingMode(ParticleSystem.BLEND_ADDITIVE);
    system.setRemoveCompletedEmitters(false);

    for (int i = 0; i < waiting.size(); i++) {
      system.addEmitter((ParticleEmitter) waiting.get(i));
View Full Code Here

    if (resp == JFileChooser.APPROVE_OPTION) {
      File file = chooser.getSelectedFile();
      File path = file.getParentFile();
     
      try {
        ParticleSystem system = ParticleIO.loadConfiguredSystem(file);
        game.setSystem(system);
        emitters.clear();
       
        for (int i=0;i<system.getEmitterCount();i++) {
          final ConfigurableEmitter emitter = (ConfigurableEmitter) system.getEmitter(i);
         
          if (emitter.getImageName() != null) {
            File possible = new File(path, emitter.getImageName());
            if (possible.exists()) {
              emitter.setImageName(possible.getAbsolutePath());
            } else {
              chooser.setDialogTitle("Locate the image: "+emitter.getImageName());
              FileFilter filter = new FileFilter() {
                public boolean accept(File f) {
                  if (f.isDirectory()) {
                    return true;
                  }
                 
                  return (f.getName().equals(emitter.getImageName()));
                }
 
                public String getDescription() {
                  return emitter.getImageName();
                }
              };
             
              chooser.addChoosableFileFilter(filter);
              resp = chooser.showOpenDialog(this);
              if (resp == JFileChooser.APPROVE_OPTION) {
                File image = chooser.getSelectedFile();
                emitter.setImageName(image.getAbsolutePath());
                path = image.getParentFile();
              }
              chooser.setDialogTitle("Open");
              chooser.resetChoosableFileFilters();
              chooser.addChoosableFileFilter(xmlFileFilter);
            }
          }
         
          emitters.add(emitter);
        }
        additive.setSelected(system.getBlendingMode() == ParticleSystem.BLEND_ADDITIVE);
        pointsEnabled.setSelected(system.usePoints());
       
        emitters.setSelected(0);
      } catch (IOException e) {
        Log.error(e);
        JOptionPane.showMessageDialog(this, e.getMessage());
View Full Code Here

  }
 
  private void createSystem() {
    if(this.system == null) {
      try {
        this.system = new ParticleSystem(ResourceManager.getInstance().getImage("particle.png"), 200);
        this.system.addEmitter(this.factory.createParticleEmitter());
        this.factory = null;
      } catch(ResourceError e) {
        Log.error(e);
      }
View Full Code Here

  }

  private void createSystem() {
    if (this.system == null) {
      try {
        this.system = new ParticleSystem(ResourceManager.getInstance()
            .getImage("textures/particle.png"), 200);
        this.system.addEmitter(this.factory.createParticleEmitter());
        this.factory = null;
      } catch (ResourceError e) {
        Log.error(e);
View Full Code Here

  }

  public ParticlesEntity(float x, float y, Image particle,
      ConfigurableEmitter emitter, int maxParticles) {
    super(x, y);
    system = new ParticleSystem(particle);
    if (emitter != null)
      system.addEmitter(emitter.duplicate());
  }
View Full Code Here

  public ParticleLayer() {
    this(null);
  }
 
  public ParticleLayer(String img) {
    fParticles = new ParticleSystem(PointClikiGame.resourceManager().image(img));
    fUpdater = new Minion<TimeEvent>(0) {
      @Override
      public long run(Dispatcher<TimeEvent> dispatcher, String type, TimeEvent event) {
        fParticles.update(event.delta());
        return Minion.CONTINUE;
View Full Code Here

    if (resp == JFileChooser.APPROVE_OPTION) {
      File file = chooser.getSelectedFile();
      File path = file.getParentFile();
     
      try {
        ParticleSystem system = ParticleIO.loadConfiguredSystem(file);
        game.setSystem(system);
        emitters.clear();
       
        for (int i=0;i<system.getEmitterCount();i++) {
          final ConfigurableEmitter emitter = (ConfigurableEmitter) system.getEmitter(i);
         
          if (emitter.getImageName() != null) {
            File possible = new File(path, emitter.getImageName());
            if (possible.exists()) {
              emitter.setImageName(possible.getAbsolutePath());
            } else {
              chooser.setDialogTitle("Locate the image: "+emitter.getImageName());
              FileFilter filter = new FileFilter() {
                public boolean accept(File f) {
                  if (f.isDirectory()) {
                    return true;
                  }
                 
                  return (f.getName().equals(emitter.getImageName()));
                }
 
                public String getDescription() {
                  return emitter.getImageName();
                }
              };
             
              chooser.addChoosableFileFilter(filter);
              resp = chooser.showOpenDialog(this);
              if (resp == JFileChooser.APPROVE_OPTION) {
                File image = chooser.getSelectedFile();
                emitter.setImageName(image.getAbsolutePath());
                path = image.getParentFile();
              }
              chooser.setDialogTitle("Open");
              chooser.resetChoosableFileFilters();
              chooser.addChoosableFileFilter(xmlFileFilter);
            }
          }
         
          emitters.add(emitter);
        }
        additive.setSelected(system.getBlendingMode() == ParticleSystem.BLEND_ADDITIVE);
        pointsEnabled.setSelected(system.usePoints());
       
        emitters.setSelected(0);
      } catch (IOException e) {
        Log.error(e);
        JOptionPane.showMessageDialog(this, e.getMessage());
View Full Code Here

TOP

Related Classes of org.newdawn.slick.particles.ParticleSystem

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.