Home | History | Annotate | Download | only in flame
      1 package com.badlogic.gdx.tools.flame;
      2 
      3 import java.awt.GridBagConstraints;
      4 import java.awt.event.ActionEvent;
      5 import java.awt.event.ActionListener;
      6 
      7 import javax.swing.JCheckBox;
      8 import javax.swing.SwingConstants;
      9 
     10 import com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter;
     11 
     12 /** @author Inferno */
     13 public class RegularEmitterPanel extends EditorPanel<RegularEmitter> {
     14 
     15 	CountPanel countPanel;
     16 	RangedNumericPanel 	delayPanel,
     17 								durationPanel;
     18 	ScaledNumericPanel	emissionPanel,
     19 								lifePanel,
     20 								lifeOffsetPanel;
     21 	JCheckBox continuousCheckbox;
     22 
     23 	public RegularEmitterPanel (FlameMain particleEditor3D, RegularEmitter emitter) {
     24 		super(particleEditor3D, "Regular Emitter", "This is a generic emitter used to generate particles regularly.");
     25 		initializeComponents(emitter);
     26 		setValue(null);
     27 	}
     28 
     29 	private void initializeComponents(RegularEmitter emitter){
     30 		continuousCheckbox = new JCheckBox("Continuous");
     31 		continuousCheckbox.setSelected(emitter.isContinuous());
     32 		continuousCheckbox.addActionListener(new ActionListener() {
     33 			public void actionPerformed (ActionEvent event) {
     34 				RegularEmitter emitter = (RegularEmitter) editor.getEmitter().emitter;
     35 				emitter.setContinuous(continuousCheckbox.isSelected());
     36 			}
     37 		});
     38 		continuousCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
     39 
     40 		int i =0;
     41 		addContent(i++, 0, continuousCheckbox, GridBagConstraints.WEST, GridBagConstraints.NONE);
     42 		addContent(i++, 0, countPanel = new CountPanel(editor, "Count", "Min number of particles at all times, max number of particles allowed.", emitter.minParticleCount, emitter.maxParticleCount));
     43 		addContent(i++, 0, delayPanel = new RangedNumericPanel(editor, emitter.getDelay(), "Delay", "Time from beginning of effect to emission start, in milliseconds.", false));
     44 		addContent(i++, 0, durationPanel = new RangedNumericPanel(editor, emitter.getDuration(), "Duration", "Time particles will be emitted, in milliseconds."));
     45 		addContent(i++, 0, emissionPanel = new ScaledNumericPanel(editor, emitter.getEmission(), "Duration", "Emission","Number of particles emitted per second."));
     46 		addContent(i++, 0, lifePanel = new ScaledNumericPanel(editor, emitter.getLife(), "Duration", "Life", "Time particles will live, in milliseconds."));
     47 		addContent(i++, 0, lifeOffsetPanel = new ScaledNumericPanel(editor, emitter.getLifeOffset(), "Duration", "Life Offset","Particle starting life consumed, in milliseconds.", false));
     48 	}
     49 
     50 }
     51