class CountPanel extends EditorPanel {\r
JSpinner maxSpinner, minSpinner;\r
\r
- public CountPanel (final ParticleEditor editor) {\r
- super("Count", null);\r
+ public CountPanel (final ParticleEditor editor, String name, String description) {\r
+ super(null, name, description);\r
\r
initializeComponents();\r
\r
\r
class EditorPanel extends JPanel {\r
private final String name;\r
+ private final String description;\r
private final ParticleValue value;\r
private JPanel titlePanel;\r
JToggleButton activeButton;\r
JToggleButton advancedButton;\r
JPanel advancedPanel;\r
private boolean hasAdvanced;\r
+ JLabel descriptionLabel;\r
\r
- public EditorPanel (String name, ParticleValue value) {\r
+ public EditorPanel (ParticleValue value, String name, String description) {\r
this.name = name;\r
this.value = value;\r
+ this.description = description;\r
\r
initializeComponents();\r
\r
contentPanel.setVisible(activeButton.isSelected());\r
advancedPanel.setVisible(activeButton.isSelected() && advancedButton.isSelected());\r
advancedButton.setVisible(activeButton.isSelected() && hasAdvanced);\r
+ descriptionLabel.setText(activeButton.isSelected() ? description : "");\r
if (value != null) value.setActive(activeButton.isSelected());\r
}\r
\r
titlePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));\r
{\r
JLabel label = new JLabel(name);\r
- titlePanel.add(label, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,\r
+ titlePanel.add(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,\r
new Insets(3, 6, 3, 6), 0, 0));\r
label.setFont(label.getFont().deriveFont(Font.BOLD));\r
}\r
{\r
+ descriptionLabel = new JLabel(description);\r
+ titlePanel.add(descriptionLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,\r
+ GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));\r
+ }\r
+ {\r
advancedButton = new JToggleButton("Advanced");\r
- titlePanel.add(advancedButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,\r
+ titlePanel.add(advancedButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,\r
GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));\r
advancedButton.setVisible(false);\r
}\r
{\r
activeButton = new JToggleButton("Active");\r
- titlePanel.add(activeButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,\r
+ titlePanel.add(activeButton, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,\r
GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));\r
}\r
}\r
JPanel colorPanel;\r
private ColorSlider hueSlider;\r
\r
- public GradientPanel (String name, GradientColorValue value) {\r
- super(name, value);\r
+ public GradientPanel (GradientColorValue value, String name, String description) {\r
+ super(value, name, description);\r
this.value = value;\r
\r
initializeComponents();\r
JLabel heightLabel;\r
String lastDir;\r
\r
- public ImagePanel (final ParticleEditor editor) {\r
- super("Image", null);\r
+ public ImagePanel (final ParticleEditor editor, String name, String description) {\r
+ super(null, name, description);\r
JPanel contentPanel = getContentPanel();\r
{\r
JButton openButton = new JButton("Open");\r
private final NumericValue value;\r
JSpinner valueSpinner;\r
\r
- public NumericPanel (String name, final NumericValue value) {\r
- super(name, value);\r
+ public NumericPanel (final NumericValue value, String name, String description) {\r
+ super(value, name, description);\r
this.value = value;\r
\r
initializeComponents();\r
JCheckBox additiveCheckbox;\r
JCheckBox behindCheckbox;\r
\r
- public OptionsPanel (final ParticleEditor editor) {\r
- super("Options", null);\r
+ public OptionsPanel (final ParticleEditor editor, String name, String description) {\r
+ super(null, name, description);\r
\r
initializeComponents();\r
\r
\r
void reloadRows () {\r
EventQueue.invokeLater(new Runnable() {\r
-\r
public void run () {\r
editRowsPanel.removeAll();\r
- addEditorRow(new NumericPanel("Pixels per meter", pixelsPerMeter));\r
- addEditorRow(new NumericPanel("Zoom level", zoomLevel));\r
+ addEditorRow(new NumericPanel(pixelsPerMeter, "Pixels per meter", ""));\r
+ addEditorRow(new NumericPanel(zoomLevel, "Zoom level", ""));\r
\r
rowsPanel.removeAll();\r
ParticleEmitter emitter = getEmitter();\r
- addRow(new ImagePanel(ParticleEditor.this));\r
- addRow(new RangedNumericPanel("Delay", emitter.getDelay()));\r
- addRow(new RangedNumericPanel("Duration", emitter.getDuration()));\r
- addRow(new CountPanel(ParticleEditor.this));\r
- addRow(new ScaledNumericPanel("Emission", "Duration", emitter.getEmission()));\r
- addRow(new ScaledNumericPanel("Life", "Duration", emitter.getLife()));\r
- addRow(new ScaledNumericPanel("Life Offset", "Duration", emitter.getLifeOffset()));\r
- addRow(new RangedNumericPanel("X Offset", emitter.getXOffsetValue()));\r
- addRow(new RangedNumericPanel("Y Offset", emitter.getYOffsetValue()));\r
- addRow(new SpawnPanel(emitter.getSpawnShape(), ParticleEditor.this));\r
- addRow(new ScaledNumericPanel("Spawn Width", "Duration", emitter.getSpawnWidth()));\r
- addRow(new ScaledNumericPanel("Spawn Height", "Duration", emitter.getSpawnHeight()));\r
- addRow(new ScaledNumericPanel("Size", "Life", emitter.getScale()));\r
- addRow(new ScaledNumericPanel("Velocity", "Life", emitter.getVelocity()));\r
- addRow(new ScaledNumericPanel("Angle", "Life", emitter.getAngle()));\r
- addRow(new ScaledNumericPanel("Rotation", "Life", emitter.getRotation()));\r
- addRow(new ScaledNumericPanel("Wind", "Life", emitter.getWind()));\r
- addRow(new ScaledNumericPanel("Gravity", "Life", emitter.getGravity()));\r
- addRow(new GradientPanel("Tint", emitter.getTint()));\r
- addRow(new PercentagePanel("Transparency", "Life", emitter.getTransparency()));\r
- addRow(new OptionsPanel(ParticleEditor.this));\r
+ addRow(new ImagePanel(ParticleEditor.this, "Image", ""));\r
+ addRow(new CountPanel(ParticleEditor.this, "Count",\r
+ "Min number of particles at all times, max number of particles allowed."));\r
+ addRow(new RangedNumericPanel(emitter.getDelay(), "Delay",\r
+ "Time from beginning of effect to emission start, in milliseconds."));\r
+ addRow(new RangedNumericPanel(emitter.getDuration(), "Duration", "Time particles will be emitted, in milliseconds."));\r
+ addRow(new ScaledNumericPanel(emitter.getEmission(), "Duration", "Emission",\r
+ "Number of particles emitted per second."));\r
+ addRow(new ScaledNumericPanel(emitter.getLife(), "Duration", "Life", "Time particles will live, in milliseconds."));\r
+ addRow(new ScaledNumericPanel(emitter.getLifeOffset(), "Duration", "Life Offset",\r
+ "Particle starting life consumed, in milliseconds."));\r
+ addRow(new RangedNumericPanel(emitter.getXOffsetValue(), "X Offset",\r
+ "Amount to offset a particle's starting X location, in world units."));\r
+ addRow(new RangedNumericPanel(emitter.getYOffsetValue(), "Y Offset",\r
+ "Amount to offset a particle's starting Y location, in world units."));\r
+ addRow(new SpawnPanel(ParticleEditor.this, emitter.getSpawnShape(), "Spawn", "Shape used to spawn particles."));\r
+ addRow(new ScaledNumericPanel(emitter.getSpawnWidth(), "Duration", "Spawn Width",\r
+ "Width of the spawn shape, in world units."));\r
+ addRow(new ScaledNumericPanel(emitter.getSpawnHeight(), "Duration", "Spawn Height",\r
+ "Height of the spawn shape, in world units."));\r
+ addRow(new ScaledNumericPanel(emitter.getScale(), "Life", "Size", "Particle size, in world units."));\r
+ addRow(new ScaledNumericPanel(emitter.getVelocity(), "Life", "Velocity", "Particle speed, in world units per second."));\r
+ addRow(new ScaledNumericPanel(emitter.getAngle(), "Life", "Angle", "Particle emission angle, in degrees."));\r
+ addRow(new ScaledNumericPanel(emitter.getRotation(), "Life", "Rotation", "Particle rotation, in degrees."));\r
+ addRow(new ScaledNumericPanel(emitter.getWind(), "Life", "Wind", "Wind strength, in world units per second."));\r
+ addRow(new ScaledNumericPanel(emitter.getGravity(), "Life", "Gravity", "Gravity strength, in world units per second."));\r
+ addRow(new GradientPanel(emitter.getTint(), "Tint", ""));\r
+ addRow(new PercentagePanel(emitter.getTransparency(), "Life", "Transparency", ""));\r
+ addRow(new OptionsPanel(ParticleEditor.this, "Options", ""));\r
for (Component component : rowsPanel.getComponents())\r
if (component instanceof EditorPanel) ((EditorPanel)component).update(ParticleEditor.this);\r
rowsPanel.repaint();\r
JButton expandButton;\r
Chart chart;\r
\r
- public PercentagePanel (String name, String chartTitle, final ScaledNumericValue value) {\r
- super(name, value);\r
+ public PercentagePanel (final ScaledNumericValue value, String chartTitle, String name, String description) {\r
+ super(value, name, description);\r
this.value = value;\r
\r
initializeComponents(chartTitle);\r
JButton rangeButton;\r
JLabel label;\r
\r
- public RangedNumericPanel (String name, final RangedNumericValue value) {\r
- super(name, value);\r
+ public RangedNumericPanel (final RangedNumericValue value, String name, String description) {\r
+ super(value, name, description);\r
this.value = value;\r
\r
initializeComponents();\r
JButton lowRangeButton;\r
JButton highRangeButton;\r
\r
- public ScaledNumericPanel (String name, String chartTitle, final ScaledNumericValue value) {\r
- super(name, value);\r
+ public ScaledNumericPanel (final ScaledNumericValue value, String chartTitle, String name, String description) {\r
+ super(value, name, description);\r
this.value = value;\r
\r
initializeComponents(chartTitle);\r
JComboBox sideCombo;\r
JLabel sideLabel;\r
\r
- public SpawnPanel (final SpawnShapeValue spawnShapeValue, final ParticleEditor editor) {\r
- super("Spawn", null);\r
+ public SpawnPanel (final ParticleEditor editor, final SpawnShapeValue spawnShapeValue, String name, String description) {\r
+ super(null, name, description);\r
\r
initializeComponents();\r
\r
float percent = durationTimer / (float)duration;\r
int updateFlags = this.updateFlags;\r
\r
- float offsetTime = lifeOffset + lifeOffsetDiff * lifeOffsetValue.getScale(percent);\r
- particle.life = particle.currentLife = life + (int)(lifeDiff * lifeValue.getScale(percent));\r
+ particle.currentLife = particle.life = life + (int)(lifeDiff * lifeValue.getScale(percent));\r
\r
if (velocityValue.active) {\r
particle.velocity = velocityValue.newLowValue();\r
\r
float spriteHeight = sprite.getHeight();\r
particle.setBounds(x - spriteWidth / 2, y - spriteHeight / 2, spriteWidth, spriteHeight);\r
+\r
+ int offsetTime = (int)(lifeOffset + lifeOffsetDiff * lifeOffsetValue.getScale(percent));\r
+ if (offsetTime > 0) {\r
+ if (offsetTime >= particle.currentLife) offsetTime = particle.currentLife - 1;\r
+ updateParticle(particle, offsetTime / 1000f, offsetTime);\r
+ }\r
}\r
\r
private boolean updateParticle (Particle particle, float delta, int deltaMillis) {\r
}\r
\r
public boolean isActive () {\r
- return active;\r
+ return alwaysActive || active;\r
}\r
\r
public void setActive (boolean active) {\r