OSDN Git Service

[added] Particle emitter test.
authornathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Tue, 26 Oct 2010 07:49:47 +0000 (07:49 +0000)
committernathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Tue, 26 Oct 2010 07:49:47 +0000 (07:49 +0000)
32x32 image
300 particles: 41fps droid, 26fps g1
150 particles: 49fps droid, 41fps g1
80 particles: 52fps droid, 55-60fps g1

64x64 image, rotation, color change
150 particles: 31fps droid, 25fps g1
80 particles: 40fps droid, 37fps g1

128x128 image, scaled to 80x80, rotation, color change
150 particles: 13fps droid, 11fps g1
80 particles: 46fps droid, 55-60fps g1

128x128, scaled to 256x256, rotation, color change
10 particles: droid 38fps, g1 37fps
10 particles: droid 46fps, g1 55-60fps

23 files changed:
extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/EffectPanel.java
extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/ParticleEditor.java
gdx/src/com/badlogic/gdx/graphics/particles/ParticleEffect.java
gdx/src/com/badlogic/gdx/graphics/particles/ParticleEmitter.java
tests/gdx-tests-android/assets/data/particle-cloud.png [new file with mode: 0644]
tests/gdx-tests-android/assets/data/particle-fire.png [new file with mode: 0644]
tests/gdx-tests-android/assets/data/particle-star.png [new file with mode: 0644]
tests/gdx-tests-android/assets/data/particle.png [new file with mode: 0644]
tests/gdx-tests-android/assets/data/test.p [new file with mode: 0644]
tests/gdx-tests-desktop/data/particle-cloud.png [new file with mode: 0644]
tests/gdx-tests-desktop/data/particle-fire.png [new file with mode: 0644]
tests/gdx-tests-desktop/data/particle-star.png [new file with mode: 0644]
tests/gdx-tests-desktop/data/particle.png [new file with mode: 0644]
tests/gdx-tests-desktop/data/test.p [new file with mode: 0644]
tests/gdx-tests-desktop/src/com/badlogic/gdx/tests/desktop/JoglTestStarter.java
tests/gdx-tests-lwjgl/data/particle-cloud.png [new file with mode: 0644]
tests/gdx-tests-lwjgl/data/particle-fire.png [new file with mode: 0644]
tests/gdx-tests-lwjgl/data/particle-star.png [new file with mode: 0644]
tests/gdx-tests-lwjgl/data/particle.png [new file with mode: 0644]
tests/gdx-tests-lwjgl/data/test.p [new file with mode: 0644]
tests/gdx-tests-lwjgl/src/com/badlogic/gdx/tests/lwjgl/LwjglTestStarter.java
tests/gdx-tests/src/com/badlogic/gdx/tests/ParticleEmitterTest.java [new file with mode: 0644]
tests/gdx-tests/src/com/badlogic/gdx/tests/utils/GdxTests.java

index e79ba11..527e172 100644 (file)
@@ -81,25 +81,27 @@ class EffectPanel extends JPanel {
                final String dir = dialog.getDirectory();\r
                if (dir == null || file == null || file.trim().length() == 0) return;\r
                lastDir = dir;\r
-               synchronized (editor.effect) {\r
-                       ParticleEffect effect = new ParticleEffect();\r
-                       try {\r
+               ParticleEffect effect = new ParticleEffect();\r
+               try {\r
+                       synchronized (editor.effect) {\r
                                effect.loadEmitters(Gdx.files.getFileHandle(new File(dir, file).getAbsolutePath(), FileType.Absolute));\r
                                editor.effect = effect;\r
                                emitterTableModel.getDataVector().removeAllElements();\r
                                editor.particleData.clear();\r
-                       } catch (Exception ex) {\r
-                               System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());\r
-                               ex.printStackTrace();\r
-                               JOptionPane.showMessageDialog(editor, "Error opening effect.");\r
-                               return;\r
                        }\r
+               } catch (Exception ex) {\r
+                       System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());\r
+                       ex.printStackTrace();\r
+                       JOptionPane.showMessageDialog(editor, "Error opening effect.");\r
+                       return;\r
+               }\r
+               synchronized (editor.effect) {\r
                        for (ParticleEmitter emitter : effect.getEmitters()) {\r
                                emitter.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);\r
                                emitterTableModel.addRow(new Object[] {emitter.getName(), true});\r
                        }\r
+                       editIndex = 0;\r
                }\r
-               editIndex = 0;\r
                emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);\r
                editor.reloadRows();\r
        }\r
index f7d9472..f5bd1ef 100644 (file)
@@ -10,6 +10,8 @@ import java.awt.Graphics;
 import java.awt.GridBagConstraints;\r
 import java.awt.GridBagLayout;\r
 import java.awt.Insets;\r
+import java.awt.event.WindowAdapter;\r
+import java.awt.event.WindowEvent;\r
 import java.io.File;\r
 import java.net.MalformedURLException;\r
 import java.net.URL;\r
@@ -46,7 +48,7 @@ import com.badlogic.gdx.graphics.Texture.TextureFilter;
 import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
 import com.badlogic.gdx.math.Matrix4;\r
 \r
-public class ParticleEditor extends JFrame implements RenderListener, InputListener {\r
+public class ParticleEditor extends JFrame {\r
        LwjglApplication app;\r
        Canvas glCanvas;\r
        JPanel rowsPanel;\r
@@ -55,14 +57,6 @@ public class ParticleEditor extends JFrame implements RenderListener, InputListe
 \r
        ParticleEffect effect = new ParticleEffect();\r
        final HashMap<ParticleEmitter, ParticleData> particleData = new HashMap();\r
-       private float maxActiveTimer;\r
-       private int maxActive, lastMaxActive;\r
-       private boolean mouseDown;\r
-       private int activeCount;\r
-       private BitmapFont font;\r
-       private SpriteBatch spriteBatch;\r
-       private Sprite bgImage; // BOZO - Add setting background image to UI.\r
-       private int mouseX, mouseY;\r
 \r
        public ParticleEditor () {\r
                super("GDX Particle Editor");\r
@@ -82,7 +76,12 @@ public class ParticleEditor extends JFrame implements RenderListener, InputListe
                                                super.setupDisplay();\r
                                        }\r
                                };\r
-                               app.getGraphics().setRenderListener(ParticleEditor.this);\r
+                               app.getGraphics().setRenderListener(new Renderer());\r
+                               addWindowListener(new WindowAdapter() {\r
+                                       public void windowClosed (WindowEvent event) {\r
+                                               app.stop();\r
+                                       }\r
+                               });\r
                        }\r
 \r
                        public Dimension getMinimumSize () {\r
@@ -249,130 +248,145 @@ public class ParticleEditor extends JFrame implements RenderListener, InputListe
                splitPane.setDividerLocation(325);\r
        }\r
 \r
-       public void surfaceCreated () {\r
-               if (spriteBatch != null) return;\r
-               spriteBatch = new SpriteBatch();\r
-\r
-               font = new BitmapFont(Gdx.files.getFileHandle("data/default.fnt", FileType.Internal), Gdx.files.getFileHandle(\r
-                       "data/default.png", FileType.Internal), true);\r
-               effectPanel.newEmitter("Untitled", true);\r
-               // if (resources.openFile("/editor-bg.png") != null) bgImage = new Image(gl, "/editor-bg.png");\r
-\r
-               Gdx.input.addInputListener(this);\r
-       }\r
-\r
-       public void surfaceChanged (int width, int height) {\r
-               int viewWidth = Gdx.graphics.getWidth();\r
-               int viewHeight = Gdx.graphics.getHeight();\r
-\r
-               spriteBatch.setProjectionMatrix(new Matrix4().setToOrtho(0, viewWidth, viewHeight, 0, 0, 1));\r
-\r
-               synchronized (effect) {\r
-                       effect.setPosition(viewWidth / 2, viewHeight / 2);\r
+       class Renderer implements RenderListener, InputListener {\r
+               private float maxActiveTimer;\r
+               private int maxActive, lastMaxActive;\r
+               private boolean mouseDown;\r
+               private int activeCount;\r
+               private int mouseX, mouseY;\r
+               private BitmapFont font;\r
+               private SpriteBatch spriteBatch;\r
+               private Sprite bgImage; // BOZO - Add setting background image to UI.\r
+\r
+               public void surfaceCreated () {\r
+                       if (spriteBatch != null) return;\r
+                       spriteBatch = new SpriteBatch();\r
+\r
+                       font = new BitmapFont(Gdx.files.getFileHandle("data/default.fnt", FileType.Internal), Gdx.files.getFileHandle(\r
+                               "data/default.png", FileType.Internal), true);\r
+                       effectPanel.newEmitter("Untitled", true);\r
+                       // if (resources.openFile("/editor-bg.png") != null) bgImage = new Image(gl, "/editor-bg.png");\r
+\r
+                       Gdx.input.addInputListener(this);\r
                }\r
-       }\r
 \r
-       public void render () {\r
-               synchronized (effect) {\r
+               public void surfaceChanged (int width, int height) {\r
                        int viewWidth = Gdx.graphics.getWidth();\r
                        int viewHeight = Gdx.graphics.getHeight();\r
-                       if (viewWidth != glCanvas.getWidth() || viewHeight != glCanvas.getHeight()) {\r
-                               viewWidth = Math.max(1, glCanvas.getWidth());\r
-                               viewHeight = Math.max(1, glCanvas.getHeight());\r
-                               app.setSize(viewWidth, viewHeight);\r
+\r
+                       spriteBatch.setProjectionMatrix(new Matrix4().setToOrtho(0, viewWidth, viewHeight, 0, 0, 1));\r
+\r
+                       synchronized (effect) {\r
+                               effect.setPosition(viewWidth / 2, viewHeight / 2);\r
                        }\r
+               }\r
 \r
-                       float delta = Gdx.graphics.getDeltaTime();\r
+               public void render () {\r
+                       synchronized (effect) {\r
+                               int viewWidth = Gdx.graphics.getWidth();\r
+                               int viewHeight = Gdx.graphics.getHeight();\r
+                               if (viewWidth != glCanvas.getWidth() || viewHeight != glCanvas.getHeight()) {\r
+                                       viewWidth = Math.max(1, glCanvas.getWidth());\r
+                                       viewHeight = Math.max(1, glCanvas.getHeight());\r
+                                       app.setSize(viewWidth, viewHeight);\r
+                               }\r
 \r
-                       Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r
+                               float delta = Gdx.graphics.getDeltaTime();\r
 \r
-                       spriteBatch.begin();\r
-                       spriteBatch.enableBlending();\r
-                       spriteBatch.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);\r
+                               Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r
 \r
-                       if (bgImage != null) {\r
-                               bgImage.setPosition(viewWidth / 2 - bgImage.getWidth() / 2, viewHeight / 2 - bgImage.getHeight() / 2);\r
-                               bgImage.draw(spriteBatch);\r
-                       }\r
+                               spriteBatch.begin();\r
+                               spriteBatch.enableBlending();\r
+                               spriteBatch.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);\r
 \r
-                       activeCount = 0;\r
-                       for (ParticleEmitter emitter : effect.getEmitters()) {\r
-                               if (emitter.getTexture() == null && emitter.getImagePath() != null) loadImage(emitter);\r
-                               boolean enabled = isEnabled(emitter);\r
-                               if (enabled) {\r
-                                       if (emitter.getTexture() != null) emitter.draw(spriteBatch, delta);\r
-                                       activeCount += emitter.getActiveCount();\r
+                               if (bgImage != null) {\r
+                                       bgImage.setPosition(viewWidth / 2 - bgImage.getWidth() / 2, viewHeight / 2 - bgImage.getHeight() / 2);\r
+                                       bgImage.draw(spriteBatch);\r
                                }\r
-                       }\r
-                       if (effect.isComplete()) effect.start();\r
-\r
-                       maxActive = Math.max(maxActive, activeCount);\r
-                       maxActiveTimer += delta;\r
-                       if (maxActiveTimer > 3) {\r
-                               maxActiveTimer = 0;\r
-                               lastMaxActive = maxActive;\r
-                               maxActive = 0;\r
-                       }\r
 \r
-                       if (mouseDown) {\r
-                               // gl.drawLine(mouseX - 6, mouseY, mouseX + 5, mouseY);\r
-                               // gl.drawLine(mouseX, mouseY - 5, mouseX, mouseY + 6);\r
-                       }\r
+                               activeCount = 0;\r
+                               for (ParticleEmitter emitter : effect.getEmitters()) {\r
+                                       if (emitter.getTexture() == null && emitter.getImagePath() != null) loadImage(emitter);\r
+                                       boolean enabled = isEnabled(emitter);\r
+                                       if (enabled) {\r
+                                               if (emitter.getTexture() != null) emitter.draw(spriteBatch, delta);\r
+                                               activeCount += emitter.getActiveCount();\r
+                                       }\r
+                               }\r
+                               if (effect.isComplete()) effect.start();\r
+\r
+                               maxActive = Math.max(maxActive, activeCount);\r
+                               maxActiveTimer += delta;\r
+                               if (maxActiveTimer > 3) {\r
+                                       maxActiveTimer = 0;\r
+                                       lastMaxActive = maxActive;\r
+                                       maxActive = 0;\r
+                               }\r
+\r
+                               if (mouseDown) {\r
+                                       // gl.drawLine(mouseX - 6, mouseY, mouseX + 5, mouseY);\r
+                                       // gl.drawLine(mouseX, mouseY - 5, mouseX, mouseY + 6);\r
+                               }\r
 \r
-                       font.draw(spriteBatch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 10, Color.WHITE);\r
-                       font.draw(spriteBatch, "Count: " + activeCount, 10, 30, Color.WHITE);\r
-                       font.draw(spriteBatch, "Max: " + lastMaxActive, 10, 50, Color.WHITE);\r
-                       font.draw(spriteBatch, (int)(getEmitter().getPercentComplete() * 100) + "%", 10, 70, Color.WHITE);\r
+                               font.draw(spriteBatch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 10, Color.WHITE);\r
+                               font.draw(spriteBatch, "Count: " + activeCount, 10, 30, Color.WHITE);\r
+                               font.draw(spriteBatch, "Max: " + lastMaxActive, 10, 50, Color.WHITE);\r
+                               font.draw(spriteBatch, (int)(getEmitter().getPercentComplete() * 100) + "%", 10, 70, Color.WHITE);\r
 \r
-                       spriteBatch.end();\r
+                               spriteBatch.end();\r
 \r
-                       // gl.drawLine((int)(viewWidth * getCurrentParticles().getPercentComplete()), viewHeight - 1, viewWidth, viewHeight - 1);\r
+                               // gl.drawLine((int)(viewWidth * getCurrentParticles().getPercentComplete()), viewHeight - 1, viewWidth, viewHeight -\r
+// 1);\r
+                       }\r
                }\r
-       }\r
 \r
-       private void loadImage (ParticleEmitter emitter) {\r
-               final String imagePath = emitter.getImagePath();\r
-               try {\r
-                       emitter.setTexture(Gdx.graphics.newTexture(Gdx.files.getFileHandle(imagePath, FileType.Absolute), TextureFilter.Linear,\r
-                               TextureFilter.Linear, TextureWrap.ClampToEdge, TextureWrap.ClampToEdge));\r
-               } catch (GdxRuntimeException ex) {\r
-                       EventQueue.invokeLater(new Runnable() {\r
-                               public void run () {\r
-                                       JOptionPane.showMessageDialog(ParticleEditor.this, "Error loading image:\n" + imagePath);\r
-                               }\r
-                       });\r
-                       emitter.setImagePath(null);\r
+               private void loadImage (ParticleEmitter emitter) {\r
+                       final String imagePath = emitter.getImagePath();\r
+                       try {\r
+                               emitter.setTexture(Gdx.graphics.newTexture(Gdx.files.getFileHandle(imagePath, FileType.Absolute),\r
+                                       TextureFilter.Linear, TextureFilter.Linear, TextureWrap.ClampToEdge, TextureWrap.ClampToEdge));\r
+                       } catch (GdxRuntimeException ex) {\r
+                               EventQueue.invokeLater(new Runnable() {\r
+                                       public void run () {\r
+                                               JOptionPane.showMessageDialog(ParticleEditor.this, "Error loading image:\n" + imagePath);\r
+                                       }\r
+                               });\r
+                               emitter.setImagePath(null);\r
+                       }\r
                }\r
-       }\r
 \r
-       public boolean keyDown (int keycode) {\r
-               return false;\r
-       }\r
+               public boolean keyDown (int keycode) {\r
+                       return false;\r
+               }\r
 \r
-       public boolean keyUp (int keycode) {\r
-               return false;\r
-       }\r
+               public boolean keyUp (int keycode) {\r
+                       return false;\r
+               }\r
 \r
-       public boolean keyTyped (char character) {\r
-               return false;\r
-       }\r
+               public boolean keyTyped (char character) {\r
+                       return false;\r
+               }\r
 \r
-       public boolean touchDown (int x, int y, int pointer) {\r
-               synchronized (effect) {\r
-                       effect.setPosition(x, y);\r
+               public boolean touchDown (int x, int y, int pointer) {\r
+                       synchronized (effect) {\r
+                               effect.setPosition(x, y);\r
+                       }\r
+                       return false;\r
                }\r
-               return false;\r
-       }\r
 \r
-       public boolean touchUp (int x, int y, int pointer) {\r
-               return false;\r
-       }\r
+               public boolean touchUp (int x, int y, int pointer) {\r
+                       return false;\r
+               }\r
 \r
-       public boolean touchDragged (int x, int y, int pointer) {\r
-               synchronized (effect) {\r
-                       effect.setPosition(x, y);\r
+               public boolean touchDragged (int x, int y, int pointer) {\r
+                       synchronized (effect) {\r
+                               effect.setPosition(x, y);\r
+                       }\r
+                       return false;\r
+               }\r
+\r
+               public void dispose () {\r
                }\r
-               return false;\r
        }\r
 \r
        static class ParticleData {\r
@@ -391,6 +405,10 @@ public class ParticleEditor extends JFrame implements RenderListener, InputListe
                                break;\r
                        }\r
                }\r
+               EventQueue.invokeLater(new Runnable() {\r
+                       public void run () {\r
+                       }\r
+               });\r
                new ParticleEditor();\r
        }\r
 }\r
index ad146bf..9022a0c 100644 (file)
@@ -127,6 +127,7 @@ public class ParticleEffect {
                        ParticleEmitter emitter = emitters.get(i);\r
                        String imagePath = emitter.getImagePath();\r
                        if (imagePath == null) continue;\r
+                       imagePath = imagePath.replace('\\', '/');\r
                        imagePath = imagesDir + new File(imagePath).getName();\r
                        emitter.setTexture(Gdx.graphics.newTexture(Gdx.files.getFileHandle(imagePath, fileType), TextureFilter.Linear,\r
                                TextureFilter.Linear, TextureWrap.ClampToEdge, TextureWrap.ClampToEdge));\r
index 975a304..a555635 100644 (file)
@@ -833,12 +833,12 @@ public class ParticleEmitter {
                        return lowMin + (lowMax - lowMin) * MathUtils.random();\r
                }\r
 \r
-               public void setLow (int value) {\r
+               public void setLow (float value) {\r
                        lowMin = value;\r
                        lowMax = value;\r
                }\r
 \r
-               public void setLow (int min, int max) {\r
+               public void setLow (float min, float max) {\r
                        lowMin = min;\r
                        lowMax = max;\r
                }\r
@@ -890,12 +890,12 @@ public class ParticleEmitter {
                        return highMin + (highMax - highMin) * MathUtils.random();\r
                }\r
 \r
-               public void setHigh (int value) {\r
+               public void setHigh (float value) {\r
                        highMin = value;\r
                        highMax = value;\r
                }\r
 \r
-               public void setHigh (int min, int max) {\r
+               public void setHigh (float min, float max) {\r
                        highMin = min;\r
                        highMax = max;\r
                }\r
diff --git a/tests/gdx-tests-android/assets/data/particle-cloud.png b/tests/gdx-tests-android/assets/data/particle-cloud.png
new file mode 100644 (file)
index 0000000..d375f43
Binary files /dev/null and b/tests/gdx-tests-android/assets/data/particle-cloud.png differ
diff --git a/tests/gdx-tests-android/assets/data/particle-fire.png b/tests/gdx-tests-android/assets/data/particle-fire.png
new file mode 100644 (file)
index 0000000..907b21f
Binary files /dev/null and b/tests/gdx-tests-android/assets/data/particle-fire.png differ
diff --git a/tests/gdx-tests-android/assets/data/particle-star.png b/tests/gdx-tests-android/assets/data/particle-star.png
new file mode 100644 (file)
index 0000000..7da2529
Binary files /dev/null and b/tests/gdx-tests-android/assets/data/particle-star.png differ
diff --git a/tests/gdx-tests-android/assets/data/particle.png b/tests/gdx-tests-android/assets/data/particle.png
new file mode 100644 (file)
index 0000000..632fcc1
Binary files /dev/null and b/tests/gdx-tests-android/assets/data/particle.png differ
diff --git a/tests/gdx-tests-android/assets/data/test.p b/tests/gdx-tests-android/assets/data/test.p
new file mode 100644 (file)
index 0000000..10d8845
--- /dev/null
@@ -0,0 +1,567 @@
+simple
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 10
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 32.0
+highMax: 32.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: false
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 3
+colors0: 1.0
+colors1: 1.0
+colors2: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 4
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 1.0
+scaling3: 0.0
+timelineCount: 4
+timeline0: 0.0
+timeline1: 0.26712328
+timeline2: 0.72602737
+timeline3: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data/particle.png
+
+
+fire
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 10
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.7
+highMax: 1.3
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 40.0
+highMax: 40.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: -180.0
+highMax: 180.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 3
+colors0: 1.0
+colors1: 0.21176471
+colors2: 0.0
+timelineCount: 1
+timeline0: 0.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 4
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 1.0
+scaling3: 0.0
+timelineCount: 4
+timeline0: 0.0
+timeline1: 0.2
+timeline2: 0.6712329
+timeline3: 1.0
+- Options - 
+attached: true
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-fire.png
+
+
+stars
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 0
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 64.0
+highMax: 64.0
+relative: false
+scalingCount: 6
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 0.33333334
+scaling3: 1.0
+scaling4: 0.4509804
+scaling5: 1.0
+timelineCount: 6
+timeline0: 0.0
+timeline1: 0.12328767
+timeline2: 0.28767124
+timeline3: 0.4041096
+timeline4: 0.5753425
+timeline5: 0.70547944
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: -90.0
+highMax: 89.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 9
+colors0: 0.0
+colors1: 0.105882354
+colors2: 1.0
+colors3: 0.0
+colors4: 1.0
+colors5: 0.09803922
+colors6: 1.0
+colors7: 0.0
+colors8: 0.0
+timelineCount: 3
+timeline0: 0.0
+timeline1: 0.63705105
+timeline2: 1.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 5
+scaling0: 1.0
+scaling1: 1.0
+scaling2: 0.0
+scaling3: 0.0
+scaling4: 1.0
+timelineCount: 5
+timeline0: 0.0
+timeline1: 0.25342464
+timeline2: 0.74657536
+timeline3: 0.9315069
+timeline4: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-star.png
+
+
+smoke
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 0
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 3.0
+highMax: 3.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: square
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 480.0
+highMax: 480.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 320.0
+highMax: 320.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 256.0
+highMax: 256.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 10.0
+lowMax: 10.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: 3.0
+highMax: 10.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 6
+colors0: 1.0
+colors1: 0.0
+colors2: 0.0
+colors3: 1.0
+colors4: 0.9843137
+colors5: 0.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 3
+scaling0: 0.0
+scaling1: 0.2631579
+scaling2: 0.0
+timelineCount: 3
+timeline0: 0.0
+timeline1: 0.5068493
+timeline2: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-cloud.png
diff --git a/tests/gdx-tests-desktop/data/particle-cloud.png b/tests/gdx-tests-desktop/data/particle-cloud.png
new file mode 100644 (file)
index 0000000..d375f43
Binary files /dev/null and b/tests/gdx-tests-desktop/data/particle-cloud.png differ
diff --git a/tests/gdx-tests-desktop/data/particle-fire.png b/tests/gdx-tests-desktop/data/particle-fire.png
new file mode 100644 (file)
index 0000000..907b21f
Binary files /dev/null and b/tests/gdx-tests-desktop/data/particle-fire.png differ
diff --git a/tests/gdx-tests-desktop/data/particle-star.png b/tests/gdx-tests-desktop/data/particle-star.png
new file mode 100644 (file)
index 0000000..7da2529
Binary files /dev/null and b/tests/gdx-tests-desktop/data/particle-star.png differ
diff --git a/tests/gdx-tests-desktop/data/particle.png b/tests/gdx-tests-desktop/data/particle.png
new file mode 100644 (file)
index 0000000..632fcc1
Binary files /dev/null and b/tests/gdx-tests-desktop/data/particle.png differ
diff --git a/tests/gdx-tests-desktop/data/test.p b/tests/gdx-tests-desktop/data/test.p
new file mode 100644 (file)
index 0000000..10d8845
--- /dev/null
@@ -0,0 +1,567 @@
+simple
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 10
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 32.0
+highMax: 32.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: false
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 3
+colors0: 1.0
+colors1: 1.0
+colors2: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 4
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 1.0
+scaling3: 0.0
+timelineCount: 4
+timeline0: 0.0
+timeline1: 0.26712328
+timeline2: 0.72602737
+timeline3: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data/particle.png
+
+
+fire
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 10
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.7
+highMax: 1.3
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 40.0
+highMax: 40.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: -180.0
+highMax: 180.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 3
+colors0: 1.0
+colors1: 0.21176471
+colors2: 0.0
+timelineCount: 1
+timeline0: 0.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 4
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 1.0
+scaling3: 0.0
+timelineCount: 4
+timeline0: 0.0
+timeline1: 0.2
+timeline2: 0.6712329
+timeline3: 1.0
+- Options - 
+attached: true
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-fire.png
+
+
+stars
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 0
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 64.0
+highMax: 64.0
+relative: false
+scalingCount: 6
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 0.33333334
+scaling3: 1.0
+scaling4: 0.4509804
+scaling5: 1.0
+timelineCount: 6
+timeline0: 0.0
+timeline1: 0.12328767
+timeline2: 0.28767124
+timeline3: 0.4041096
+timeline4: 0.5753425
+timeline5: 0.70547944
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: -90.0
+highMax: 89.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 9
+colors0: 0.0
+colors1: 0.105882354
+colors2: 1.0
+colors3: 0.0
+colors4: 1.0
+colors5: 0.09803922
+colors6: 1.0
+colors7: 0.0
+colors8: 0.0
+timelineCount: 3
+timeline0: 0.0
+timeline1: 0.63705105
+timeline2: 1.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 5
+scaling0: 1.0
+scaling1: 1.0
+scaling2: 0.0
+scaling3: 0.0
+scaling4: 1.0
+timelineCount: 5
+timeline0: 0.0
+timeline1: 0.25342464
+timeline2: 0.74657536
+timeline3: 0.9315069
+timeline4: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-star.png
+
+
+smoke
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 0
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 3.0
+highMax: 3.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: square
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 480.0
+highMax: 480.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 320.0
+highMax: 320.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 256.0
+highMax: 256.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 10.0
+lowMax: 10.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: 3.0
+highMax: 10.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 6
+colors0: 1.0
+colors1: 0.0
+colors2: 0.0
+colors3: 1.0
+colors4: 0.9843137
+colors5: 0.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 3
+scaling0: 0.0
+scaling1: 0.2631579
+scaling2: 0.0
+timelineCount: 3
+timeline0: 0.0
+timeline1: 0.5068493
+timeline2: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-cloud.png
index d928029..84475a0 100644 (file)
@@ -4,6 +4,8 @@ package com.badlogic.gdx.tests.desktop;
 import java.awt.BorderLayout;\r
 import java.awt.event.ActionEvent;\r
 import java.awt.event.ActionListener;\r
+import java.awt.event.MouseAdapter;\r
+import java.awt.event.MouseEvent;\r
 \r
 import javax.swing.DefaultListSelectionModel;\r
 import javax.swing.JButton;\r
@@ -23,18 +25,23 @@ public class JoglTestStarter {
        static class TestList extends JPanel {\r
                public TestList () {\r
                        setLayout(new BorderLayout());\r
-                       \r
+\r
                        final JList list = new JList(GdxTests.getNames());\r
-                       JButton button = new JButton("Run Test");\r
+                       final JButton button = new JButton("Run Test");\r
                        JScrollPane pane = new JScrollPane(list);\r
 \r
                        DefaultListSelectionModel m = new DefaultListSelectionModel();\r
                        m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
                        m.setLeadAnchorNotificationEnabled(false);\r
-                       list.setSelectionModel(m);                      \r
-                       \r
+                       list.setSelectionModel(m);\r
+\r
+                       list.addMouseListener(new MouseAdapter() {\r
+                               public void mouseClicked (MouseEvent event) {\r
+                                       if (event.getClickCount() == 2) button.doClick();\r
+                               }\r
+                       });\r
+\r
                        button.addActionListener(new ActionListener() {\r
-                               \r
                                @Override public void actionPerformed (ActionEvent e) {\r
                                        String testName = (String)list.getSelectedValue();\r
                                        GdxTest test = GdxTests.newTest(testName);\r
@@ -53,6 +60,8 @@ public class JoglTestStarter {
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
                frame.setContentPane(new TestList());\r
                frame.pack();\r
+               frame.setSize(frame.getWidth(), 600);\r
+               frame.setLocationRelativeTo(null);\r
                frame.setVisible(true);\r
        }\r
 }\r
diff --git a/tests/gdx-tests-lwjgl/data/particle-cloud.png b/tests/gdx-tests-lwjgl/data/particle-cloud.png
new file mode 100644 (file)
index 0000000..d375f43
Binary files /dev/null and b/tests/gdx-tests-lwjgl/data/particle-cloud.png differ
diff --git a/tests/gdx-tests-lwjgl/data/particle-fire.png b/tests/gdx-tests-lwjgl/data/particle-fire.png
new file mode 100644 (file)
index 0000000..907b21f
Binary files /dev/null and b/tests/gdx-tests-lwjgl/data/particle-fire.png differ
diff --git a/tests/gdx-tests-lwjgl/data/particle-star.png b/tests/gdx-tests-lwjgl/data/particle-star.png
new file mode 100644 (file)
index 0000000..7da2529
Binary files /dev/null and b/tests/gdx-tests-lwjgl/data/particle-star.png differ
diff --git a/tests/gdx-tests-lwjgl/data/particle.png b/tests/gdx-tests-lwjgl/data/particle.png
new file mode 100644 (file)
index 0000000..632fcc1
Binary files /dev/null and b/tests/gdx-tests-lwjgl/data/particle.png differ
diff --git a/tests/gdx-tests-lwjgl/data/test.p b/tests/gdx-tests-lwjgl/data/test.p
new file mode 100644 (file)
index 0000000..10d8845
--- /dev/null
@@ -0,0 +1,567 @@
+simple
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 10
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 32.0
+highMax: 32.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: false
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 3
+colors0: 1.0
+colors1: 1.0
+colors2: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 4
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 1.0
+scaling3: 0.0
+timelineCount: 4
+timeline0: 0.0
+timeline1: 0.26712328
+timeline2: 0.72602737
+timeline3: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data/particle.png
+
+
+fire
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 10
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.7
+highMax: 1.3
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 40.0
+highMax: 40.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: -180.0
+highMax: 180.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 3
+colors0: 1.0
+colors1: 0.21176471
+colors2: 0.0
+timelineCount: 1
+timeline0: 0.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 4
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 1.0
+scaling3: 0.0
+timelineCount: 4
+timeline0: 0.0
+timeline1: 0.2
+timeline2: 0.6712329
+timeline3: 1.0
+- Options - 
+attached: true
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-fire.png
+
+
+stars
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 0
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: point
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 64.0
+highMax: 64.0
+relative: false
+scalingCount: 6
+scaling0: 0.0
+scaling1: 1.0
+scaling2: 0.33333334
+scaling3: 1.0
+scaling4: 0.4509804
+scaling5: 1.0
+timelineCount: 6
+timeline0: 0.0
+timeline1: 0.12328767
+timeline2: 0.28767124
+timeline3: 0.4041096
+timeline4: 0.5753425
+timeline5: 0.70547944
+- Velocity - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 80.0
+highMax: 80.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: -90.0
+highMax: 89.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 9
+colors0: 0.0
+colors1: 0.105882354
+colors2: 1.0
+colors3: 0.0
+colors4: 1.0
+colors5: 0.09803922
+colors6: 1.0
+colors7: 0.0
+colors8: 0.0
+timelineCount: 3
+timeline0: 0.0
+timeline1: 0.63705105
+timeline2: 1.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 5
+scaling0: 1.0
+scaling1: 1.0
+scaling2: 0.0
+scaling3: 0.0
+scaling4: 1.0
+timelineCount: 5
+timeline0: 0.0
+timeline1: 0.25342464
+timeline2: 0.74657536
+timeline3: 0.9315069
+timeline4: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-star.png
+
+
+smoke
+- Delay -
+active: false
+- Duration - 
+lowMin: 1.0
+lowMax: 1.0
+- Count - 
+min: 0
+max: 1000
+- Emission - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 10.0
+highMax: 10.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 3.0
+highMax: 3.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Life Offset - 
+active: false
+- X Offset - 
+active: false
+- Y Offset - 
+active: false
+- Spawn Shape - 
+shape: square
+- Spawn Width - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 480.0
+highMax: 480.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Spawn Height - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 320.0
+highMax: 320.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Size - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 256.0
+highMax: 256.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Velocity - 
+active: true
+lowMin: 10.0
+lowMax: 10.0
+highMin: 0.0
+highMax: 0.0
+relative: false
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Angle - 
+active: true
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 360.0
+relative: false
+scalingCount: 1
+scaling0: 1.0
+timelineCount: 1
+timeline0: 0.0
+- Rotation - 
+active: true
+lowMin: 1.0
+lowMax: 360.0
+highMin: 3.0
+highMax: 10.0
+relative: true
+scalingCount: 2
+scaling0: 0.0
+scaling1: 1.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Wind - 
+active: false
+- Gravity - 
+active: false
+- Tint - 
+colorsCount: 6
+colors0: 1.0
+colors1: 0.0
+colors2: 0.0
+colors3: 1.0
+colors4: 0.9843137
+colors5: 0.0
+timelineCount: 2
+timeline0: 0.0
+timeline1: 1.0
+- Transparency - 
+lowMin: 0.0
+lowMax: 0.0
+highMin: 1.0
+highMax: 1.0
+relative: false
+scalingCount: 3
+scaling0: 0.0
+scaling1: 0.2631579
+scaling2: 0.0
+timelineCount: 3
+timeline0: 0.0
+timeline1: 0.5068493
+timeline2: 1.0
+- Options - 
+attached: false
+continuous: true
+aligned: false
+additive: true
+behind: false
+- Image Path -
+data\particle-cloud.png
index 627b0a4..4d6e17f 100644 (file)
@@ -4,6 +4,8 @@ package com.badlogic.gdx.tests.lwjgl;
 import java.awt.BorderLayout;\r
 import java.awt.event.ActionEvent;\r
 import java.awt.event.ActionListener;\r
+import java.awt.event.MouseAdapter;\r
+import java.awt.event.MouseEvent;\r
 \r
 import javax.swing.DefaultListSelectionModel;\r
 import javax.swing.JButton;\r
@@ -21,18 +23,23 @@ public class LwjglTestStarter {
        static class TestList extends JPanel {\r
                public TestList () {\r
                        setLayout(new BorderLayout());\r
-                       \r
+\r
                        final JList list = new JList(GdxTests.getNames());\r
-                       JButton button = new JButton("Run Test");\r
+                       final JButton button = new JButton("Run Test");\r
                        JScrollPane pane = new JScrollPane(list);\r
 \r
                        DefaultListSelectionModel m = new DefaultListSelectionModel();\r
                        m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
                        m.setLeadAnchorNotificationEnabled(false);\r
-                       list.setSelectionModel(m);                      \r
-                       \r
+                       list.setSelectionModel(m);\r
+\r
+                       list.addMouseListener(new MouseAdapter() {\r
+                               public void mouseClicked (MouseEvent event) {\r
+                                       if (event.getClickCount() == 2) button.doClick();\r
+                               }\r
+                       });\r
+\r
                        button.addActionListener(new ActionListener() {\r
-                               \r
                                @Override public void actionPerformed (ActionEvent e) {\r
                                        String testName = (String)list.getSelectedValue();\r
                                        GdxTest test = GdxTests.newTest(testName);\r
@@ -51,6 +58,8 @@ public class LwjglTestStarter {
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
                frame.setContentPane(new TestList());\r
                frame.pack();\r
+               frame.setSize(frame.getWidth(), 600);\r
+               frame.setLocationRelativeTo(null);\r
                frame.setVisible(true);\r
        }\r
 }\r
diff --git a/tests/gdx-tests/src/com/badlogic/gdx/tests/ParticleEmitterTest.java b/tests/gdx-tests/src/com/badlogic/gdx/tests/ParticleEmitterTest.java
new file mode 100644 (file)
index 0000000..761f2d4
--- /dev/null
@@ -0,0 +1,109 @@
+\r
+package com.badlogic.gdx.tests;\r
+\r
+import java.util.ArrayList;\r
+\r
+import com.badlogic.gdx.Files.FileType;\r
+import com.badlogic.gdx.Gdx;\r
+import com.badlogic.gdx.Input;\r
+import com.badlogic.gdx.InputAdapter;\r
+import com.badlogic.gdx.InputListener;\r
+import com.badlogic.gdx.graphics.BitmapFont;\r
+import com.badlogic.gdx.graphics.BitmapFont.HAlignment;\r
+import com.badlogic.gdx.graphics.BitmapFontCache;\r
+import com.badlogic.gdx.graphics.Color;\r
+import com.badlogic.gdx.graphics.GL10;\r
+import com.badlogic.gdx.graphics.Sprite;\r
+import com.badlogic.gdx.graphics.SpriteBatch;\r
+import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
+import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
+import com.badlogic.gdx.graphics.particles.ParticleEffect;\r
+import com.badlogic.gdx.graphics.particles.ParticleEmitter;\r
+import com.badlogic.gdx.tests.utils.GdxTest;\r
+\r
+public class ParticleEmitterTest implements GdxTest {\r
+       private SpriteBatch spriteBatch;\r
+       private BitmapFont font;\r
+       ParticleEffect effect;\r
+       int emitterIndex;\r
+       ArrayList<ParticleEmitter> emitters;\r
+       int particleCount = 10;\r
+\r
+       public void surfaceCreated () {\r
+               if (spriteBatch != null) return;\r
+               spriteBatch = new SpriteBatch();\r
+\r
+               font = new BitmapFont(Gdx.files.getFileHandle("data/verdana39.fnt", FileType.Internal), Gdx.files.getFileHandle(\r
+                       "data/verdana39.png", FileType.Internal), false);\r
+\r
+               effect = new ParticleEffect();\r
+               effect.load(Gdx.files.getFileHandle("data/test.p", FileType.Internal), "data", FileType.Internal);\r
+               effect.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);\r
+               emitters = new ArrayList(effect.getEmitters());\r
+               effect.getEmitters().clear();\r
+               effect.getEmitters().add(emitters.get(0));\r
+\r
+               Gdx.input.addInputListener(new InputListener() {\r
+                       public boolean touchUp (int x, int y, int pointer) {\r
+                               return false;\r
+                       }\r
+\r
+                       public boolean touchDragged (int x, int y, int pointer) {\r
+                               effect.setPosition(x, Gdx.graphics.getHeight() - y);\r
+                               return false;\r
+                       }\r
+\r
+                       public boolean touchDown (int x, int y, int pointer) {\r
+                               effect.setPosition(x, Gdx.graphics.getHeight() - y);\r
+                               return false;\r
+                       }\r
+\r
+                       public boolean keyUp (int keycode) {\r
+                               return false;\r
+                       }\r
+\r
+                       public boolean keyTyped (char character) {\r
+                               return false;\r
+                       }\r
+\r
+                       public boolean keyDown (int keycode) {\r
+                               ParticleEmitter emitter = emitters.get(emitterIndex);\r
+                               if (keycode == Input.Keys.KEYCODE_DPAD_UP)\r
+                                       particleCount += 5;\r
+                               else if (keycode == Input.Keys.KEYCODE_DPAD_DOWN)\r
+                                       particleCount -= 5;\r
+                               else if (keycode == Input.Keys.KEYCODE_SPACE)\r
+                                       emitterIndex = (emitterIndex + 1) % emitters.size();\r
+                               else\r
+                                       return false;\r
+                               particleCount = Math.max(0, particleCount);\r
+                               if (particleCount > emitter.getMaxParticleCount()) emitter.setMaxParticleCount(particleCount * 2);\r
+                               emitter.getEmission().setHigh(particleCount / emitter.getLife().getHighMax());\r
+                               effect.getEmitters().clear();\r
+                               effect.getEmitters().add(emitters.get(emitterIndex));\r
+                               return false;\r
+                       }\r
+               });\r
+       }\r
+\r
+       public void surfaceChanged (int width, int height) {\r
+       }\r
+\r
+       public void render () {\r
+               GL10 gl = Gdx.graphics.getGL10();\r
+               gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r
+               spriteBatch.begin();\r
+               effect.draw(spriteBatch, Gdx.graphics.getDeltaTime());\r
+               font.draw(spriteBatch, Gdx.graphics.getFramesPerSecond() + " fps", 5, 40, Color.WHITE);\r
+               int activeCount = emitters.get(emitterIndex).getActiveCount();\r
+               font.draw(spriteBatch, activeCount + "/" + particleCount + " particles", 5, Gdx.graphics.getHeight() - 5, Color.WHITE);\r
+               spriteBatch.end();\r
+       }\r
+\r
+       public void dispose () {\r
+       }\r
+\r
+       public boolean needsGL20 () {\r
+               return false;\r
+       }\r
+}\r
index f99f210..5eeb639 100644 (file)
@@ -26,6 +26,7 @@ import com.badlogic.gdx.tests.MeshTest;
 import com.badlogic.gdx.tests.Mpg123Test;\r
 import com.badlogic.gdx.tests.MultitouchTest;\r
 import com.badlogic.gdx.tests.ObjTest;\r
+import com.badlogic.gdx.tests.ParticleEmitterTest;\r
 import com.badlogic.gdx.tests.Pong;\r
 import com.badlogic.gdx.tests.SimpleTest;\r
 import com.badlogic.gdx.tests.SoundTest;\r
@@ -75,6 +76,7 @@ public class GdxTests
                Mpg123Test.class,\r
                MultitouchTest.class,\r
                ObjTest.class,\r
+               ParticleEmitterTest.class,\r
                Pong.class,\r
                SimpleTest.class,\r
                SoundTest.class,\r