From: nathan.sweet Date: Tue, 2 Nov 2010 03:38:10 +0000 (+0000) Subject: [fixed] LwjglCanvas, Hiero, particle editor. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=870a37dd95cfe703f39c6dfa640c47e2f31eab34;p=mikumikustudio%2Flibgdx-mikumikustudio.git [fixed] LwjglCanvas, Hiero, particle editor. --- diff --git a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglApplication.java b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglApplication.java index 16c6653ee..56fac654b 100644 --- a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglApplication.java +++ b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglApplication.java @@ -68,9 +68,17 @@ public class LwjglApplication implements Application { graphics.updateTime(); input.update(); - if( lastWidth != graphics.getWidth() || lastHeight != graphics.getHeight() ) { - lastWidth = graphics.getWidth(); - lastHeight = graphics.getHeight(); + int width, height; + if (graphics.canvas != null) { + width = graphics.canvas.getWidth(); + height = graphics.canvas.getHeight(); + } else { + width = graphics.getWidth(); + height = graphics.getHeight(); + } + if( lastWidth != width || lastHeight != height ) { + lastWidth = width; + lastHeight = height; listener.resize(lastWidth, lastHeight); } diff --git a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglCanvas.java b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglCanvas.java index 8b2b30583..d8b4a995a 100644 --- a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglCanvas.java +++ b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglCanvas.java @@ -1,8 +1,11 @@ + package com.badlogic.gdx.backends.desktop; import java.awt.Canvas; import java.awt.Dimension; -import java.lang.reflect.InvocationTargetException; +import java.awt.EventQueue; +import java.util.Timer; +import java.util.TimerTask; import javax.swing.SwingUtilities; @@ -15,6 +18,7 @@ import com.badlogic.gdx.Application; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Audio; import com.badlogic.gdx.Files; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Graphics; import com.badlogic.gdx.Input; import com.badlogic.gdx.utils.GdxRuntimeException; @@ -28,152 +32,129 @@ public class LwjglCanvas implements Application { Thread mainLoopThread; boolean running = true; Canvas canvas; - - public LwjglCanvas( ApplicationListener listener, boolean useGL2) { + Timer timer = new Timer("LwjglCanvas Timer"); + Runnable updateRunnable; + + public LwjglCanvas (ApplicationListener listener, boolean useGL2) { LwjglNativesLoader.load(); - - canvas = new Canvas() { + + canvas = new Canvas() { private final Dimension minSize = new Dimension(); public final void addNotify () { super.addNotify(); - try { - graphics.setupDisplay(); - start(); - } catch (LWJGLException e) { - throw new GdxRuntimeException(e); - } + EventQueue.invokeLater(new Runnable() { + public void run () { + start(); + } + }); } public Dimension getMinimumSize () { return minSize; - } - }; - + } + }; + canvas.setSize(100, 100); - canvas.setMinimumSize(new Dimension(2,2)); - graphics = new LwjglGraphics( canvas, useGL2); + canvas.setMinimumSize(new Dimension(2, 2)); + graphics = new LwjglGraphics(canvas, useGL2); audio = new LwjglAudio(); files = new LwjglFiles(); input = new LwjglInput(); this.listener = listener; + + Gdx.app = this; + Gdx.graphics = graphics; + Gdx.audio = audio; + Gdx.files = files; + Gdx.input = input; } - - public Canvas getCanvas() { + + public Canvas getCanvas () { return canvas; } - @Override - public Audio getAudio() { + @Override public Audio getAudio () { return audio; } - @Override - public Files getFiles() { + @Override public Files getFiles () { return files; } - @Override - public Graphics getGraphics() { + @Override public Graphics getGraphics () { return graphics; } - @Override - public Input getInput() { + @Override public Input getInput () { return input; } - @Override - public ApplicationType getType() { + @Override public ApplicationType getType () { return ApplicationType.Desktop; } - @Override - public int getVersion() { + @Override public int getVersion () { return 0; } - @Override - public void log(String tag, String message) { - System.out.println( tag + ": " + message ); + @Override public void log (String tag, String message) { + System.out.println(tag + ": " + message); } - - private void start() { - LwjglNativesLoader.load(); - mainLoopThread = new Thread("LWJGL Application") { - @SuppressWarnings("synthetic-access") - public void run () { - LwjglCanvas.this.mainLoop(); - } - }; - mainLoopThread.start(); - } - - private void mainLoop( ) { - Keyboard.enableRepeatEvents(true); + + void start () { try { - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - listener.create(); - listener.resize(graphics.getWidth(), graphics.getHeight()); - } - }); - } catch (Exception e1) { - throw new GdxRuntimeException(e1); + graphics.setupDisplay(); + } catch (LWJGLException e) { + throw new GdxRuntimeException(e); } - - Runnable runnable = new Runnable() { + + Keyboard.enableRepeatEvents(true); + + listener.create(); + listener.resize(graphics.getWidth(), graphics.getHeight()); + + updateRunnable = new Runnable() { int lastWidth = graphics.getWidth(); int lastHeight = graphics.getHeight(); - - @Override - public void run() { + + public void run () { graphics.updateTime(); input.update(); - - if( lastWidth != graphics.getWidth() || lastHeight != graphics.getHeight() ) { + + if (lastWidth != graphics.getWidth() || lastHeight != graphics.getHeight()) { lastWidth = graphics.getWidth(); lastHeight = graphics.getHeight(); - try { - Display.setDisplayMode(new DisplayMode(lastWidth, lastHeight)); - } catch (LWJGLException e) { - throw new GdxRuntimeException(e); - } listener.resize(lastWidth, lastHeight); } - + listener.render(); input.processEvents(null); Display.update(); - Display.sync(60); + Display.sync(60); } }; - - while(running) { - SwingUtilities.invokeLater(runnable); - try { - Thread.sleep(16); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + + timer.schedule(new TimerTask() { + public void run () { + try { + EventQueue.invokeAndWait(updateRunnable); + } catch (Exception ex) { + throw new GdxRuntimeException(ex); + } } - } - + }, 0, 16); + } + + public void stop () { + running = false; + timer.cancel(); SwingUtilities.invokeLater(new Runnable() { - public void run() { + public void run () { listener.pause(); listener.destroy(); - Display.destroy(); + Display.destroy(); } - }); - } - - public void stop() { - running = false; - try { - mainLoopThread.join(); - } - catch(Exception ex) { - } + }); } } diff --git a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglFiles.java b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglFiles.java index 0104a5a80..1f4657a35 100644 --- a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglFiles.java +++ b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglFiles.java @@ -41,6 +41,9 @@ final class LwjglFiles implements Files { else file = new File(this.externalPath + filename); + // BOZO - Hack. + if (!file.exists()) file = new File("resources/" + filename); + if (file.exists() == false) throw new GdxRuntimeException("File '" + filename + "' doesn't exist"); else diff --git a/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java b/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java index a67bc3e7a..c11b756d2 100644 --- a/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java +++ b/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java @@ -126,8 +126,6 @@ public class Hiero extends JFrame { + "abcdefghijklmnopqrstuvwxyz\n1234567890\n" // + "\"!`?'.,;:()[]{}<>|/@\\^$-%+=#_&~*\u007F"; - LwjglApplication app; - Canvas glCanvas; volatile UnicodeFont newUnicodeFont; UnicodeFont unicodeFont; Color renderingBackgroundColor = Color.BLACK; @@ -183,9 +181,8 @@ public class Hiero extends JFrame { Splash splash = new Splash(this, "/splash.jpg", 2000); initialize(); splash.close(); - - LwjglCanvas lwjglCanvas = new LwjglCanvas(new Renderer(), false); - gamePanel.add(lwjglCanvas.getCanvas()); + + gamePanel.add(new LwjglCanvas(new Renderer(), false).getCanvas()); prefs = Preferences.userNodeForPackage(Hiero.class); java.awt.Color backgroundColor = EffectUtil.fromString(prefs.get("background", "000000")); @@ -1131,7 +1128,7 @@ public class Hiero extends JFrame { class Renderer implements ApplicationListener { private String sampleText; - public void created () { + @Override public void create () { glEnable(GL_SCISSOR_TEST); glEnable(GL_TEXTURE_2D); @@ -1146,10 +1143,8 @@ public class Hiero extends JFrame { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } - - @Override - public void resize(int width, int height) { + @Override public void resize (int width, int height) { glViewport(0, 0, width, height); glScissor(0, 0, width, height); @@ -1157,17 +1152,12 @@ public class Hiero extends JFrame { glLoadIdentity(); glOrtho(0, width, height, 0, 1, -1); glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glLoadIdentity(); } public void render () { - if (glCanvas == null) return; int viewWidth = Gdx.graphics.getWidth(); int viewHeight = Gdx.graphics.getHeight(); - if (viewWidth != glCanvas.getWidth() || viewHeight != glCanvas.getHeight()) { - viewWidth = Math.max(1, glCanvas.getWidth()); - viewHeight = Math.max(1, glCanvas.getHeight()); - } if (newUnicodeFont != null) { if (unicodeFont != null) unicodeFont.destroy(); @@ -1255,50 +1245,31 @@ public class Hiero extends JFrame { } } - public void dispose () { + @Override public void pause () { } - @Override - public void create() { - // TODO Auto-generated method stub - + @Override public void resume () { } - - @Override - public void destroy() { - // TODO Auto-generated method stub - - } - - @Override - public void pause() { - // TODO Auto-generated method stub - - } - - @Override - public void resume() { - // TODO Auto-generated method stub - + + @Override public void destroy () { } } public static void main (String[] args) throws Exception { -// LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels(); -// for (int i = 0, n = lookAndFeels.length; i < n; i++) { -// if ("Nimbus".equals(lookAndFeels[i].getName())) { -// try { -// UIManager.setLookAndFeel(lookAndFeels[i].getClassName()); -// } catch (Throwable ignored) { -// } -// break; -// } -// } - SwingUtilities.invokeLater( new Runnable() { - - @Override - public void run() { - new Hiero(); +// LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels(); +// for (int i = 0, n = lookAndFeels.length; i < n; i++) { +// if ("Nimbus".equals(lookAndFeels[i].getName())) { +// try { +// UIManager.setLookAndFeel(lookAndFeels[i].getClassName()); +// } catch (Throwable ignored) { +// } +// break; +// } +// } + SwingUtilities.invokeLater(new Runnable() { + + @Override public void run () { + new Hiero(); } }); } diff --git a/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/CountPanel.java b/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/CountPanel.java index 555257296..6ccacf010 100644 --- a/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/CountPanel.java +++ b/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/CountPanel.java @@ -22,9 +22,7 @@ class CountPanel extends EditorPanel { maxSpinner.setValue(editor.getEmitter().getMaxParticleCount()); maxSpinner.addChangeListener(new ChangeListener() { public void stateChanged (ChangeEvent event) { - synchronized (editor.effect) { editor.getEmitter().setMaxParticleCount((Integer)maxSpinner.getValue()); - } } }); diff --git a/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/ParticleEditor.java b/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/ParticleEditor.java index d18334d3d..7c83a65ef 100644 --- a/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/ParticleEditor.java +++ b/extensions/particle-editor/src/com/badlogic/gdx/graphics/particles/ParticleEditor.java @@ -35,6 +35,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.Files.FileType; import com.badlogic.gdx.backends.desktop.LwjglApplication; +import com.badlogic.gdx.backends.desktop.LwjglCanvas; import com.badlogic.gdx.graphics.BitmapFont; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL10; @@ -45,8 +46,7 @@ import com.badlogic.gdx.graphics.Texture.TextureWrap; import com.badlogic.gdx.utils.GdxRuntimeException; public class ParticleEditor extends JFrame { - LwjglApplication app; - Canvas glCanvas; + LwjglCanvas lwjglCanvas; JPanel rowsPanel; EffectPanel effectPanel; private JSplitPane splitPane; @@ -57,23 +57,13 @@ public class ParticleEditor extends JFrame { public ParticleEditor () { super("GDX Particle Editor"); - glCanvas = new Canvas() { - private final Dimension minSize = new Dimension(); - - public final void addNotify () { - super.addNotify(); - app = new LwjglApplication(new Renderer(),"ParticleEditor", 200, 200, false, glCanvas); - addWindowListener(new WindowAdapter() { - public void windowClosed (WindowEvent event) { - app.stop(); - } - }); + lwjglCanvas = new LwjglCanvas(new Renderer(), false); + addWindowListener(new WindowAdapter() { + public void windowClosed (WindowEvent event) { + System.exit(0); + // Gdx.app.quit(); } - - public Dimension getMinimumSize () { - return minSize; - } - }; + }); initializeComponents(); @@ -87,32 +77,30 @@ public class ParticleEditor extends JFrame { EventQueue.invokeLater(new Runnable() { public void run () { rowsPanel.removeAll(); - synchronized (effect) { - ParticleEmitter emitter = getEmitter(); - addRow(new ImagePanel(ParticleEditor.this)); - addRow(new RangedNumericPanel("Delay", emitter.getDelay())); - addRow(new RangedNumericPanel("Duration", emitter.getDuration())); - addRow(new CountPanel(ParticleEditor.this)); - addRow(new ScaledNumericPanel("Emission", "Duration", emitter.getEmission())); - addRow(new ScaledNumericPanel("Life", "Duration", emitter.getLife())); - addRow(new ScaledNumericPanel("Life Offset", "Duration", emitter.getLifeOffset())); - addRow(new RangedNumericPanel("X Offset", emitter.getXOffsetValue())); - addRow(new RangedNumericPanel("Y Offset", emitter.getYOffsetValue())); - addRow(new SpawnPanel(emitter.getSpawnShape(), ParticleEditor.this)); - addRow(new ScaledNumericPanel("Spawn Width", "Duration", emitter.getSpawnWidth())); - addRow(new ScaledNumericPanel("Spawn Height", "Duration", emitter.getSpawnHeight())); - addRow(new ScaledNumericPanel("Size", "Life", emitter.getScale())); - addRow(new ScaledNumericPanel("Velocity", "Life", emitter.getVelocity())); - addRow(new ScaledNumericPanel("Angle", "Life", emitter.getAngle())); - addRow(new ScaledNumericPanel("Rotation", "Life", emitter.getRotation())); - addRow(new ScaledNumericPanel("Wind", "Life", emitter.getWind())); - addRow(new ScaledNumericPanel("Gravity", "Life", emitter.getGravity())); - addRow(new GradientPanel("Tint", emitter.getTint())); - addRow(new PercentagePanel("Transparency", "Life", emitter.getTransparency())); - addRow(new OptionsPanel(ParticleEditor.this)); - for (Component component : rowsPanel.getComponents()) - if (component instanceof EditorPanel) ((EditorPanel)component).update(ParticleEditor.this); - } + ParticleEmitter emitter = getEmitter(); + addRow(new ImagePanel(ParticleEditor.this)); + addRow(new RangedNumericPanel("Delay", emitter.getDelay())); + addRow(new RangedNumericPanel("Duration", emitter.getDuration())); + addRow(new CountPanel(ParticleEditor.this)); + addRow(new ScaledNumericPanel("Emission", "Duration", emitter.getEmission())); + addRow(new ScaledNumericPanel("Life", "Duration", emitter.getLife())); + addRow(new ScaledNumericPanel("Life Offset", "Duration", emitter.getLifeOffset())); + addRow(new RangedNumericPanel("X Offset", emitter.getXOffsetValue())); + addRow(new RangedNumericPanel("Y Offset", emitter.getYOffsetValue())); + addRow(new SpawnPanel(emitter.getSpawnShape(), ParticleEditor.this)); + addRow(new ScaledNumericPanel("Spawn Width", "Duration", emitter.getSpawnWidth())); + addRow(new ScaledNumericPanel("Spawn Height", "Duration", emitter.getSpawnHeight())); + addRow(new ScaledNumericPanel("Size", "Life", emitter.getScale())); + addRow(new ScaledNumericPanel("Velocity", "Life", emitter.getVelocity())); + addRow(new ScaledNumericPanel("Angle", "Life", emitter.getAngle())); + addRow(new ScaledNumericPanel("Rotation", "Life", emitter.getRotation())); + addRow(new ScaledNumericPanel("Wind", "Life", emitter.getWind())); + addRow(new ScaledNumericPanel("Gravity", "Life", emitter.getGravity())); + addRow(new GradientPanel("Tint", emitter.getTint())); + addRow(new PercentagePanel("Transparency", "Life", emitter.getTransparency())); + addRow(new OptionsPanel(ParticleEditor.this)); + for (Component component : rowsPanel.getComponents()) + if (component instanceof EditorPanel) ((EditorPanel)component).update(ParticleEditor.this); rowsPanel.repaint(); } }); @@ -216,7 +204,7 @@ public class ParticleEditor extends JFrame { { JPanel spacer = new JPanel(new BorderLayout()); leftSplit.add(spacer, JSplitPane.TOP); - spacer.add(glCanvas); + spacer.add(lwjglCanvas.getCanvas()); spacer.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4)); } { @@ -253,74 +241,65 @@ public class ParticleEditor extends JFrame { effectPanel.newEmitter("Untitled", true); // if (resources.openFile("/editor-bg.png") != null) bgImage = new Image(gl, "/editor-bg.png"); } - - @Override - public void resize(int width, int height) { + + @Override public void resize (int width, int height) { Gdx.gl.glViewport(0, 0, width, height); spriteBatch.getProjectionMatrix().setToOrtho(0, width, height, 0, 0, 1); - synchronized (effect) { - effect.setPosition(width / 2, height / 2); - } + effect.setPosition(width / 2, height / 2); } public void render () { - synchronized (effect) { - int viewWidth = Gdx.graphics.getWidth(); - int viewHeight = Gdx.graphics.getHeight(); - if (viewWidth != glCanvas.getWidth() || viewHeight != glCanvas.getHeight()) { - viewWidth = Math.max(1, glCanvas.getWidth()); - viewHeight = Math.max(1, glCanvas.getHeight()); - } + int viewWidth = Gdx.graphics.getWidth(); + int viewHeight = Gdx.graphics.getHeight(); - float delta = Gdx.graphics.getDeltaTime(); + float delta = Gdx.graphics.getDeltaTime(); - Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); + Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); - spriteBatch.begin(); - spriteBatch.enableBlending(); - spriteBatch.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); + spriteBatch.begin(); + spriteBatch.enableBlending(); + spriteBatch.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); - if (bgImage != null) { - bgImage.setPosition(viewWidth / 2 - bgImage.getWidth() / 2, viewHeight / 2 - bgImage.getHeight() / 2); - bgImage.draw(spriteBatch); - } + if (bgImage != null) { + bgImage.setPosition(viewWidth / 2 - bgImage.getWidth() / 2, viewHeight / 2 - bgImage.getHeight() / 2); + bgImage.draw(spriteBatch); + } - activeCount = 0; - for (ParticleEmitter emitter : effect.getEmitters()) { - if (emitter.getTexture() == null && emitter.getImagePath() != null) loadImage(emitter); - boolean enabled = isEnabled(emitter); - if (enabled) { - if (emitter.getTexture() != null) emitter.draw(spriteBatch, delta); - activeCount += emitter.getActiveCount(); - } - } - if (effect.isComplete()) effect.start(); - - maxActive = Math.max(maxActive, activeCount); - maxActiveTimer += delta; - if (maxActiveTimer > 3) { - maxActiveTimer = 0; - lastMaxActive = maxActive; - maxActive = 0; + activeCount = 0; + for (ParticleEmitter emitter : effect.getEmitters()) { + if (emitter.getTexture() == null && emitter.getImagePath() != null) loadImage(emitter); + boolean enabled = isEnabled(emitter); + if (enabled) { + if (emitter.getTexture() != null) emitter.draw(spriteBatch, delta); + activeCount += emitter.getActiveCount(); } + } + if (effect.isComplete()) effect.start(); + + maxActive = Math.max(maxActive, activeCount); + maxActiveTimer += delta; + if (maxActiveTimer > 3) { + maxActiveTimer = 0; + lastMaxActive = maxActive; + maxActive = 0; + } - if (mouseDown) { - // gl.drawLine(mouseX - 6, mouseY, mouseX + 5, mouseY); - // gl.drawLine(mouseX, mouseY - 5, mouseX, mouseY + 6); - } + if (mouseDown) { + // gl.drawLine(mouseX - 6, mouseY, mouseX + 5, mouseY); + // gl.drawLine(mouseX, mouseY - 5, mouseX, mouseY + 6); + } - font.draw(spriteBatch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 10, Color.WHITE); - font.draw(spriteBatch, "Count: " + activeCount, 10, 30, Color.WHITE); - font.draw(spriteBatch, "Max: " + lastMaxActive, 10, 50, Color.WHITE); - font.draw(spriteBatch, (int)(getEmitter().getPercentComplete() * 100) + "%", 10, 70, Color.WHITE); + font.draw(spriteBatch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 10, Color.WHITE); + font.draw(spriteBatch, "Count: " + activeCount, 10, 30, Color.WHITE); + font.draw(spriteBatch, "Max: " + lastMaxActive, 10, 50, Color.WHITE); + font.draw(spriteBatch, (int)(getEmitter().getPercentComplete() * 100) + "%", 10, 70, Color.WHITE); - spriteBatch.end(); + spriteBatch.end(); - // gl.drawLine((int)(viewWidth * getCurrentParticles().getPercentComplete()), viewHeight - 1, viewWidth, viewHeight - + // gl.drawLine((int)(viewWidth * getCurrentParticles().getPercentComplete()), viewHeight - 1, viewWidth, viewHeight - // 1); - Gdx.input.processEvents(this); - } + Gdx.input.processEvents(this); } private void loadImage (ParticleEmitter emitter) { @@ -351,9 +330,7 @@ public class ParticleEditor extends JFrame { } public boolean touchDown (int x, int y, int pointer) { - synchronized (effect) { - effect.setPosition(x, y); - } + effect.setPosition(x, y); return false; } @@ -362,32 +339,26 @@ public class ParticleEditor extends JFrame { } public boolean touchDragged (int x, int y, int pointer) { - synchronized (effect) { - effect.setPosition(x, y); - } + effect.setPosition(x, y); return false; } public void dispose () { } - - @Override - public void destroy() { + @Override public void destroy () { // TODO Auto-generated method stub - + } - @Override - public void pause() { + @Override public void pause () { // TODO Auto-generated method stub - + } - @Override - public void resume() { + @Override public void resume () { // TODO Auto-generated method stub - + } }