gdx-studio

#libgdx#java#desktop

git clone https://git.pyrossh.dev/gdx-studio

An IDE for creating Games using libgdx and Java supported on all platforms Android, iOS, Desktop


src_libs/com/badlogic/gdx/tools/particleeditor/OptionsPanel.java
a62d533 1
/*******************************************************************************
a62d533 2
 * Copyright 2011 See AUTHORS file.
a62d533 3
 * 
a62d533 4
 * Licensed under the Apache License, Version 2.0 (the "License");
a62d533 5
 * you may not use this file except in compliance with the License.
a62d533 6
 * You may obtain a copy of the License at
a62d533 7
 * 
a62d533 8
 *   http://www.apache.org/licenses/LICENSE-2.0
a62d533 9
 * 
a62d533 10
 * Unless required by applicable law or agreed to in writing, software
a62d533 11
 * distributed under the License is distributed on an "AS IS" BASIS,
a62d533 12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a62d533 13
 * See the License for the specific language governing permissions and
a62d533 14
 * limitations under the License.
a62d533 15
 ******************************************************************************/
a62d533 16
a62d533 17
package com.badlogic.gdx.tools.particleeditor;
a62d533 18
a62d533 19
import java.awt.GridBagConstraints;
a62d533 20
import java.awt.Insets;
a62d533 21
import java.awt.event.ActionEvent;
a62d533 22
import java.awt.event.ActionListener;
a62d533 23
a62d533 24
import javax.swing.JCheckBox;
a62d533 25
import javax.swing.JLabel;
a62d533 26
import javax.swing.JPanel;
a62d533 27
import javax.swing.event.ChangeEvent;
a62d533 28
import javax.swing.event.ChangeListener;
a62d533 29
a62d533 30
import com.badlogic.gdx.graphics.g2d.ParticleEmitter;
a62d533 31
a62d533 32
class OptionsPanel extends EditorPanel {
a62d533 33
	JCheckBox attachedCheckBox;
a62d533 34
	JCheckBox continuousCheckbox;
a62d533 35
	JCheckBox alignedCheckbox;
a62d533 36
	JCheckBox additiveCheckbox;
a62d533 37
	JCheckBox behindCheckbox;
a62d533 38
a62d533 39
	public OptionsPanel (final ParticlePanel editor, String name, String description) {
a62d533 40
		super(null, name, description);
a62d533 41
a62d533 42
		initializeComponents();
a62d533 43
a62d533 44
		attachedCheckBox.addActionListener(new ActionListener() {
a62d533 45
			public void actionPerformed (ActionEvent event) {
a62d533 46
				editor.getEmitter().setAttached(attachedCheckBox.isSelected());
a62d533 47
			}
a62d533 48
		});
a62d533 49
a62d533 50
		continuousCheckbox.setSelected(editor.getEmitter().isContinuous());
a62d533 51
		continuousCheckbox.addActionListener(new ActionListener() {
a62d533 52
			public void actionPerformed (ActionEvent event) {
a62d533 53
				editor.getEmitter().setContinuous(continuousCheckbox.isSelected());
a62d533 54
			}
a62d533 55
		});
a62d533 56
a62d533 57
		alignedCheckbox.addChangeListener(new ChangeListener() {
a62d533 58
			public void stateChanged (ChangeEvent event) {
a62d533 59
				editor.getEmitter().setAligned(alignedCheckbox.isSelected());
a62d533 60
			}
a62d533 61
		});
a62d533 62
a62d533 63
		additiveCheckbox.addChangeListener(new ChangeListener() {
a62d533 64
			public void stateChanged (ChangeEvent event) {
a62d533 65
				editor.getEmitter().setAdditive(additiveCheckbox.isSelected());
a62d533 66
			}
a62d533 67
		});
a62d533 68
a62d533 69
		behindCheckbox.addChangeListener(new ChangeListener() {
a62d533 70
			public void stateChanged (ChangeEvent event) {
a62d533 71
				editor.getEmitter().setBehind(behindCheckbox.isSelected());
a62d533 72
			}
a62d533 73
		});
a62d533 74
a62d533 75
		ParticleEmitter emitter = editor.getEmitter();
a62d533 76
		attachedCheckBox.setSelected(emitter.isAttached());
a62d533 77
		continuousCheckbox.setSelected(emitter.isContinuous());
a62d533 78
		alignedCheckbox.setSelected(emitter.isAligned());
a62d533 79
		additiveCheckbox.setSelected(emitter.isAdditive());
a62d533 80
		behindCheckbox.setSelected(emitter.isBehind());
a62d533 81
	}
a62d533 82
a62d533 83
	private void initializeComponents () {
a62d533 84
		JPanel contentPanel = getContentPanel();
a62d533 85
		{
a62d533 86
			JLabel label = new JLabel("Additive:");
a62d533 87
			contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
a62d533 88
				new Insets(6, 0, 0, 0), 0, 0));
a62d533 89
		}
a62d533 90
		{
a62d533 91
			additiveCheckbox = new JCheckBox();
a62d533 92
			contentPanel.add(additiveCheckbox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
a62d533 93
				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
a62d533 94
		}
a62d533 95
		{
a62d533 96
			JLabel label = new JLabel("Attached:");
a62d533 97
			contentPanel.add(label, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
a62d533 98
				new Insets(6, 0, 0, 0), 0, 0));
a62d533 99
		}
a62d533 100
		{
a62d533 101
			attachedCheckBox = new JCheckBox();
a62d533 102
			contentPanel.add(attachedCheckBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST,
a62d533 103
				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
a62d533 104
		}
a62d533 105
		{
a62d533 106
			JLabel label = new JLabel("Continuous:");
a62d533 107
			contentPanel.add(label, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
a62d533 108
				new Insets(6, 0, 0, 0), 0, 0));
a62d533 109
		}
a62d533 110
		{
a62d533 111
			continuousCheckbox = new JCheckBox();
a62d533 112
			contentPanel.add(continuousCheckbox, new GridBagConstraints(1, 3, 1, 1, 0, 0, GridBagConstraints.WEST,
a62d533 113
				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
a62d533 114
		}
a62d533 115
		{
a62d533 116
			JLabel label = new JLabel("Aligned:");
a62d533 117
			contentPanel.add(label, new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
a62d533 118
				new Insets(6, 0, 0, 0), 0, 0));
a62d533 119
		}
a62d533 120
		{
a62d533 121
			alignedCheckbox = new JCheckBox();
a62d533 122
			contentPanel.add(alignedCheckbox, new GridBagConstraints(1, 4, 1, 1, 0, 0, GridBagConstraints.WEST,
a62d533 123
				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
a62d533 124
		}
a62d533 125
		{
a62d533 126
			JLabel label = new JLabel("Behind:");
a62d533 127
			contentPanel.add(label, new GridBagConstraints(0, 5, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
a62d533 128
				new Insets(6, 0, 0, 0), 0, 0));
a62d533 129
		}
a62d533 130
		{
a62d533 131
			behindCheckbox = new JCheckBox();
a62d533 132
			contentPanel.add(behindCheckbox, new GridBagConstraints(1, 5, 1, 1, 0, 0, GridBagConstraints.WEST,
a62d533 133
				GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
a62d533 134
		}
a62d533 135
	}
a62d533 136
}