From: badlogicgames Date: Mon, 1 Nov 2010 23:35:12 +0000 (+0000) Subject: ["fixed"] twl, particle editor, hiero. Not really :p X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6fe00ed5a6d3620b4cb283e549d3fc9f11d809c9;p=mikumikustudio%2Flibgdx-mikumikustudio.git ["fixed"] twl, particle editor, hiero. Not really :p --- diff --git a/backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglApplication.java b/backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglApplication.java index cd980812f..8e1e4b58c 100644 --- a/backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglApplication.java +++ b/backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglApplication.java @@ -94,7 +94,7 @@ public final class JoglApplication implements Application { @Override public void windowIconified(WindowEvent arg0) { - graphics.pause(); + graphics.pause(); } @Override 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 deleted file mode 100644 index abb5a3c4d..000000000 --- a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglApplication.java +++ /dev/null @@ -1,298 +0,0 @@ - -package com.badlogic.gdx.backends.desktop; - -import java.awt.Canvas; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.util.ArrayList; - -import org.lwjgl.LWJGLException; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.Display; -import org.lwjgl.opengl.DisplayMode; -import org.lwjgl.opengl.PixelFormat; - -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.RenderListener; -import com.badlogic.gdx.Version; -import com.badlogic.gdx.utils.GdxRuntimeException; - -@SuppressWarnings("unchecked") public class LwjglApplication implements Application { - static { - System.setProperty("org.lwjgl.input.Mouse.allowNegativeMouseCoords", "true"); - Version.loadLibrary(); - - String os = System.getProperty("os.name"); - String arch = System.getProperty("os.arch"); - boolean is64Bit = false; - - if (arch.equals("amd64")) is64Bit = true; - - if (os.contains("Windows")) loadLibrariesWindows(is64Bit); - if (os.contains("Linux")) loadLibrariesLinux(is64Bit); - if (os.contains("Mac")) loadLibrariesMac(); - - System.setProperty("org.lwjgl.librarypath", new File("").getAbsolutePath()); - } - - private static void loadLibrariesWindows (boolean is64Bit) { - String[] libNames = null; - if (is64Bit) - libNames = new String[] {"OpenAL64.dll", "lwjgl64.dll", "jinput-raw_64.dll", "jinput-dx8_64.dll"}; - else - libNames = new String[] {"OpenAL32.dll", "lwjgl.dll", "jinput-raw.dll", "jinput-dx8.dll"}; - - for (String libName : libNames) - loadLibrary(libName, "/native/windows/"); - } - - private static void loadLibrariesLinux (boolean is64Bit) { - String[] libNames = null; - if (is64Bit) - libNames = new String[] {"libopenal64.so", "liblwjgl64.so", "jinput-linux64.so",}; - else - libNames = new String[] {"libopenal.so", "liblwjgl.so", "jinput-linux.so",}; - - for (String libName : libNames) - loadLibrary(libName, "/native/linux/"); - } - - private static void loadLibrariesMac () { - throw new GdxRuntimeException("loading native libs on Mac OS X not supported, mail contact@badlogicgames.com"); - } - - private static void loadLibrary (String libName, String classPath) { - InputStream in = null; - BufferedOutputStream out = null; - - try { - in = LwjglApplication.class.getResourceAsStream(classPath + libName); - out = new BufferedOutputStream(new FileOutputStream(libName)); - byte[] bytes = new byte[1024 * 4]; - while (true) { - int read_bytes = in.read(bytes); - if (read_bytes == -1) break; - - out.write(bytes, 0, read_bytes); - } - out.close(); - out = null; - in.close(); - in = null; - } catch (Throwable t) { - new GdxRuntimeException("Couldn't load lwjgl native, " + libName, t); - } finally { - if (out != null) try { - out.close(); - } catch (Exception ex) { - } - ; - if (in != null) try { - in.close(); - } catch (Exception ex) { - } - } - } - - private final LwjglGraphics graphics; - private final LwjglInput input; - private final LwjglAudio audio; - - protected int width, height; - private String title = ""; - private boolean mousePressed; - private int mouseX, mouseY; - private volatile boolean running = true; - final ArrayList listeners = new ArrayList(); - private Thread gameThread; - private ApplicationListener appListener; - - public LwjglApplication (String title, int width, int height, boolean useGL20IfAvailable) { - if (title == null) throw new IllegalArgumentException("title cannot be null."); - this.title = title; - this.width = width; - this.height = height; - - graphics = new LwjglGraphics(this, title, width, height, useGL20IfAvailable); - listeners.add(graphics); - input = new LwjglInput(); - audio = new LwjglAudio(); - - Gdx.app = this; - Gdx.graphics = this.getGraphics(); - Gdx.input = this.getInput(); - Gdx.audio = this.getAudio(); - Gdx.files = this.getFiles(); - - new Thread("LWJGL Application") { - public void run () { - try { - LwjglApplication.this.start(); - } catch (LWJGLException ex) { - throw new GdxRuntimeException(ex); - } - } - }.start(); - } - - protected void setupDisplay () throws LWJGLException { - Display.setDisplayMode(new DisplayMode(width, height)); - Display.setFullscreen(false); - Display.setTitle(title); - int samples = 0; - try { - Display.create(new PixelFormat(8, 8, 0, samples)); - } catch (Exception ex) { - Display.destroy(); - try { - Display.create(new PixelFormat(8, 8, 0)); - } catch (Exception ex2) { - Display.destroy(); - Display.create(new PixelFormat()); - } - } - } - - public void setSize (int width, int height) { - this.width = width; - this.height = height; - for (RenderListener listener : listeners) - listener.resized(getWidth(), getHeight()); - } - - void start () throws LWJGLException { - gameThread = Thread.currentThread(); - - setupDisplay(); - - for (RenderListener listener : listeners) - listener.created(); - setSize(width, height); - graphics.lastTime = System.nanoTime(); - for (RenderListener listener : listeners) - listener.render(); - - while (running && !Display.isCloseRequested()) { - - if (Keyboard.isCreated()) { - while (Keyboard.next()) { - if (Keyboard.getEventKeyState()) - input.fireKeyDown(LwjglInput.getKeyCode(Keyboard.getEventKey())); - else { - input.fireKeyUp(LwjglInput.getKeyCode(Keyboard.getEventKey())); - input.fireKeyTyped(Keyboard.getEventCharacter()); - } - } - } - - if (Mouse.isCreated()) { - int x = Mouse.getX(); - int y = height - Mouse.getY(); - while (Mouse.next()) { - if (isButtonPressed()) { - if (mousePressed == false) { - mousePressed = true; - mouseX = x; - mouseY = y; - input.fireTouchDown(x, y, 0); - } else { - if (mouseX != x || mouseY != y) { - input.fireTouchDragged(x, y, 0); - mouseX = x; - mouseY = y; - } - } - } else { - if (mousePressed == true) { - mousePressed = false; - input.fireTouchUp(x, y, 0); - } - } - } - } - - for (int i = 0, n = listeners.size(); i < n; i++) - listeners.get(i).render(); - - Display.update(); - Display.sync(60); - } - - if (appListener != null) appListener.pause(); - try { - for (int i = 0, n = listeners.size(); i < n; i++) - listeners.get(i).dispose(); - } finally { - Display.destroy(); - } - if (appListener != null) appListener.destroy(); - } - - private boolean isButtonPressed () { - for (int i = 0; i < Mouse.getButtonCount(); i++) - if (Mouse.isButtonDown(i)) return true; - return false; - } - - public void stop () { - running = false; - try { - gameThread.join(); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - } - - public int getWidth () { - return width; - } - - public int getHeight () { - return height; - } - - public void close () { - running = false; - } - - public Audio getAudio () { - return audio; - } - - public Files getFiles () { - return new LwjglFiles(); - } - - public Graphics getGraphics () { - return graphics; - } - - public Input getInput () { - return input; - } - - public void setApplicationListener (ApplicationListener appListener) { - this.appListener = appListener; - } - - public void log (String tag, String message) { - System.out.println(tag + ": " + message); - } - - public ApplicationType getType () { - return ApplicationType.Desktop; - } - - @Override public int getVersion () { - return 0; - } -} diff --git a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglGraphics.java b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglGraphics.java index b32467032..2e05c0340 100644 --- a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglGraphics.java +++ b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglGraphics.java @@ -13,14 +13,19 @@ package com.badlogic.gdx.backends.desktop; +import java.awt.Canvas; import java.awt.image.BufferedImage; import java.io.InputStream; import javax.imageio.ImageIO; +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.PixelFormat; + import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Graphics; -import com.badlogic.gdx.RenderListener; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.GL11; @@ -34,26 +39,31 @@ import com.badlogic.gdx.graphics.Texture.TextureWrap; import com.badlogic.gdx.utils.GdxRuntimeException; /** - * An implementation of the {@link Graphics} interface based on Jogl. + * An implementation of the {@link Graphics} interface based on Lwjgl. * @author mzechner */ -public final class LwjglGraphics implements Graphics, RenderListener { - private final LwjglApplication app; - private GLCommon gl; - private GL10 gl10; - private GL11 gl11; - private GL20 gl20; - private final boolean useGL2; - private float deltaTime = 0; - private long frameStart = 0; - private int frames = 0; - private int fps; - - long lastTime; - - LwjglGraphics (final LwjglApplication application, String title, int width, int height, boolean useGL2IfAvailable) { - this.app = application; +public final class LwjglGraphics implements Graphics{ + GLCommon gl; + GL10 gl10; + GL11 gl11; + GL20 gl20; + final boolean useGL2; + float deltaTime = 0; + long frameStart = 0; + int frames = 0; + int fps; + long lastTime = System.nanoTime(); + int width; + int height; + String title; + Canvas canvas; + + LwjglGraphics (String title, int width, int height, boolean useGL2IfAvailable, Canvas canvas) { useGL2 = useGL2IfAvailable; + this.title = title; + this.width = width; + this.height = height; + this.canvas = canvas; } public GL10 getGL10 () { @@ -69,11 +79,11 @@ public final class LwjglGraphics implements Graphics, RenderListener { } public int getHeight () { - return app.getHeight(); + return height; } public int getWidth () { - return app.getWidth(); + return width; } public boolean isGL11Available () { @@ -135,17 +145,25 @@ public final class LwjglGraphics implements Graphics, RenderListener { throw new GdxRuntimeException("Texture dimensions must be a power of two: " + file); return new LwjglTexture((BufferedImage)pixmap.getNativePixmap(), minFilter, magFilter, uWrap, vWrap, false); - } + } - public void setRenderListener (RenderListener listener) { - app.listeners.add(listener); + public float getDeltaTime () { + return deltaTime; } - public void dispose () { + public GraphicsType getType () { + return GraphicsType.LWJGL; + } + public int getFramesPerSecond () { + return fps; } - public void render () { + @Override public GLCommon getGLCommon () { + return gl; + } + + void updateTime () { long time = System.nanoTime(); deltaTime = (time - lastTime) / 1000000000.0f; lastTime = time; @@ -157,8 +175,29 @@ public final class LwjglGraphics implements Graphics, RenderListener { } frames++; } + + protected void setupDisplay () throws LWJGLException { + if(canvas!=null) Display.setParent(canvas); + Display.setDisplayMode(new DisplayMode(width, height)); + Display.setFullscreen(false); + Display.setTitle(title); + int samples = 0; + try { + Display.create(new PixelFormat(8, 8, 0, samples)); + } catch (Exception ex) { + Display.destroy(); + try { + Display.create(new PixelFormat(8, 8, 0)); + } catch (Exception ex2) { + Display.destroy(); + Display.create(new PixelFormat()); + } + } + + initiateGLInstances(); + } - public void created () { + void initiateGLInstances () { String version = org.lwjgl.opengl.GL11.glGetString(GL11.GL_VERSION); int major = Integer.parseInt("" + version.charAt(0)); int minor = Integer.parseInt("" + version.charAt(2)); @@ -182,23 +221,4 @@ public final class LwjglGraphics implements Graphics, RenderListener { Gdx.gl11 = gl11; Gdx.gl20 = gl20; } - - public float getDeltaTime () { - return deltaTime; - } - - public void resized (int width, int height) { - } - - public GraphicsType getType () { - return GraphicsType.LWJGL; - } - - public int getFramesPerSecond () { - return fps; - } - - @Override public GLCommon getGLCommon () { - return gl; - } } diff --git a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglInput.java b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglInput.java index 43a8aee9e..ed8999981 100644 --- a/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglInput.java +++ b/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/desktop/LwjglInput.java @@ -14,6 +14,9 @@ package com.badlogic.gdx.backends.desktop; import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; @@ -24,7 +27,8 @@ import org.lwjgl.input.Mouse; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.InputProcessor; -import com.badlogic.gdx.RenderListener; +import com.badlogic.gdx.utils.Pool; +import com.badlogic.gdx.utils.Pool.PoolObjectFactory; /** * An implementation of the {@link Input} interface hooking a Jogl panel for input. @@ -32,15 +36,53 @@ import com.badlogic.gdx.RenderListener; * @author mzechner * */ -final class LwjglInput implements Input, RenderListener { - String text; - TextInputListener textListener; - @SuppressWarnings("unchecked") private final ArrayList listeners = new ArrayList(); +final class LwjglInput implements Input { + class KeyEvent { + static final int KEY_DOWN = 0; + static final int KEY_UP = 1; + static final int KEY_TYPED = 2; + + int type; + int keyCode; + char keyChar; + } + + class TouchEvent { + static final int TOUCH_DOWN = 0; + static final int TOUCH_UP = 1; + static final int TOUCH_DRAGGED = 2; - public void addInputListener (InputProcessor listener) { - listeners.add(listener); + int type; + int x; + int y; + int pointer; } + Pool freeKeyEvents = new Pool( + new PoolObjectFactory() { + + @Override + public KeyEvent createObject() { + return new KeyEvent(); + } + }, 1000); + + Pool freeTouchEvents = new Pool( + new PoolObjectFactory() { + + @Override + public TouchEvent createObject() { + return new TouchEvent(); + } + }, 1000); + + List keyEvents = new ArrayList(); + List touchEvents = new ArrayList(); + boolean mousePressed = false; + int mouseX = 0; + int mouseY = 0; + int pressedKeys = 0; + public float getAccelerometerX () { return 0; } @@ -56,8 +98,8 @@ final class LwjglInput implements Input, RenderListener { public void getTextInput (final TextInputListener listener, final String title, final String text) { SwingUtilities.invokeLater(new Runnable() { public void run () { - LwjglInput.this.text = JOptionPane.showInputDialog(null, title, text); - if (LwjglInput.this.text != null) textListener = listener; + String output = JOptionPane.showInputDialog(null, title, text); + listener.input(output); } }); } @@ -75,40 +117,17 @@ final class LwjglInput implements Input, RenderListener { } public boolean isKeyPressed (int key) { - return Keyboard.isKeyDown(getKeyCodeReverse(key)); + if( key == Input.Keys.ANY_KEY ) + return pressedKeys > 0; + else + return Keyboard.isKeyDown(getKeyCodeReverse(key)); } public boolean isTouched () { - boolean button = Mouse.isButtonDown(0) || Mouse.isButtonDown(1) || Mouse.isButtonDown(2); - if (button) System.out.println("button!!"); + boolean button = Mouse.isButtonDown(0) || Mouse.isButtonDown(1) || Mouse.isButtonDown(2); return button; } - public void removeInputListener (InputProcessor listener) { - listeners.remove(listener); - } - - public void dispose () { - listeners.clear(); - } - - public void render () { - if (textListener != null) { - textListener.input(text); - textListener = null; - } - } - - public void created () { - // TODO Auto-generated method stub - - } - - public void resized (int width, int height) { - // TODO Auto-generated method stub - - } - public int getX (int pointer) { if (pointer > 0) return 0; @@ -134,36 +153,56 @@ final class LwjglInput implements Input, RenderListener { return false; } - public void fireKeyDown (int keycode) { - for (int i = 0; i < listeners.size(); i++) - if (listeners.get(i).keyDown(keycode)) return; - } - - public void fireKeyUp (int keycode) { - for (int i = 0; i < listeners.size(); i++) - if (listeners.get(i).keyUp(keycode)) return; - } - - public void fireKeyTyped (char character) { - for (int i = 0; i < listeners.size(); i++) - if (listeners.get(i).keyTyped(character)) return; + @Override public void setOnscreenKeyboardVisible (boolean visible) { + } - public void fireTouchDown (int x, int y, int pointer) { - for (int i = 0; i < listeners.size(); i++) - if (listeners.get(i).touchDown(x, y, pointer)) return; + @Override public boolean supportsOnscreenKeyboard () { + return false; } - - public void fireTouchUp (int x, int y, int pointer) { - for (int i = 0; i < listeners.size(); i++) - if (listeners.get(i).touchUp(x, y, pointer)) return; + + @Override public void setCatchBackKey (boolean catchBack) { + } - public void fireTouchDragged (int x, int y, int pointer) { - for (int i = 0; i < listeners.size(); i++) - if (listeners.get(i).touchDragged(x, y, pointer)) return; + @Override + public void processEvents(InputProcessor listener) { + synchronized(this) { + if(listener!=null) { + for(KeyEvent e: keyEvents) { + switch(e.type) { + case KeyEvent.KEY_DOWN: + listener.keyDown(e.keyCode); + break; + case KeyEvent.KEY_UP: + listener.keyUp(e.keyCode); + break; + case KeyEvent.KEY_TYPED: + listener.keyTyped(e.keyChar); + } + freeKeyEvents.free(e); + } + + for(TouchEvent e: touchEvents) { + switch(e.type) { + case TouchEvent.TOUCH_DOWN: + listener.touchDown(e.x, e.y, e.pointer); + break; + case TouchEvent.TOUCH_UP: + listener.touchUp(e.x, e.y, e.pointer); + break; + case TouchEvent.TOUCH_DRAGGED: + listener.touchDragged(e.x, e.y, e.pointer); + } + freeTouchEvents.free(e); + } + } + + keyEvents.clear(); + touchEvents.clear(); + } } - + public static int getKeyCode (int keyCode) { if (keyCode == Keyboard.KEY_0) return Input.Keys.KEYCODE_0; if (keyCode == Keyboard.KEY_1) return Input.Keys.KEYCODE_1; @@ -280,19 +319,99 @@ final class LwjglInput implements Input, RenderListener { if (keyCode == Input.Keys.KEYCODE_SHIFT_RIGHT) return Keyboard.KEY_RSHIFT; if (keyCode == Input.Keys.KEYCODE_SLASH) return Keyboard.KEY_SLASH; if (keyCode == Input.Keys.KEYCODE_SPACE) return Keyboard.KEY_SPACE; - if (keyCode == Input.Keys.KEYCODE_TAB) return Keyboard.KEY_TAB; + if (keyCode == Input.Keys.KEYCODE_TAB) return Keyboard.KEY_TAB; return Keyboard.KEY_NONE; } - @Override public void setOnscreenKeyboardVisible (boolean visible) { - + public void update() { + updateMouse(); + updateKeyboard(); } - - @Override public boolean supportsOnscreenKeyboard () { + + void updateMouse() { + if (Mouse.isCreated()) { + int x = Mouse.getX(); + int y = Gdx.graphics.getHeight() - Mouse.getY(); + while (Mouse.next()) { + if (isButtonPressed()) { + if (mousePressed == false) { + mousePressed = true; + TouchEvent event = freeTouchEvents.newObject(); + event.x = x; + event.y = y; + event.pointer = 0; + event.type = TouchEvent.TOUCH_DOWN; + touchEvents.add(event); + mouseX = x; + mouseY = y; + } else { + if (mouseX != x || mouseY != y) { + TouchEvent event = freeTouchEvents.newObject(); + event.x = x; + event.y = y; + event.pointer = 0; + event.type = TouchEvent.TOUCH_DRAGGED; + touchEvents.add(event); + mouseX = x; + mouseY = y; + } + } + } else { + if (mousePressed == true) { + mouseX = x; + mouseY = y; + mousePressed = false; + TouchEvent event = freeTouchEvents.newObject(); + event.x = x; + event.y = y; + event.pointer = 0; + event.type = TouchEvent.TOUCH_UP; + touchEvents.add(event); + } + } + } + } + } + + boolean isButtonPressed () { + for (int i = 0; i < Mouse.getButtonCount(); i++) + if (Mouse.isButtonDown(i)) return true; return false; } + - @Override public void setCatchBackKey (boolean catchBack) { - + void updateKeyboard() { + if (Keyboard.isCreated()) { + while (Keyboard.next()) { + if (Keyboard.getEventKeyState()) { + int keyCode = getKeyCode(Keyboard.getEventKey()); + char keyChar = Keyboard.getEventCharacter(); + + KeyEvent event = freeKeyEvents.newObject(); + event.keyCode = keyCode; + event.keyChar = 0; + event.type = KeyEvent.KEY_DOWN; + keyEvents.add(event); + + event = freeKeyEvents.newObject(); + event.keyCode = 0; + event.keyChar = keyChar; + event.type = KeyEvent.KEY_TYPED; + keyEvents.add(event); + pressedKeys++; + } + else { + int keyCode = LwjglInput.getKeyCode(Keyboard.getEventKey()); + + KeyEvent event = freeKeyEvents.newObject(); + event.keyCode = keyCode; + event.keyChar = 0; + event.type = KeyEvent.KEY_UP; + keyEvents.add(event); + + pressedKeys--; + } + } + } } } diff --git a/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java b/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java index 162c413d1..95e94d9be 100644 --- a/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java +++ b/extensions/hiero/src/com/badlogic/gdx/hiero/Hiero.java @@ -1,7 +1,33 @@ package com.badlogic.gdx.hiero; -import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL11.GL_BLEND; +import static org.lwjgl.opengl.GL11.GL_LIGHTING; +import static org.lwjgl.opengl.GL11.GL_MODELVIEW; +import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.GL_PROJECTION; +import static org.lwjgl.opengl.GL11.GL_QUADS; +import static org.lwjgl.opengl.GL11.GL_SCISSOR_TEST; +import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_COORD_ARRAY; +import static org.lwjgl.opengl.GL11.GL_VERTEX_ARRAY; +import static org.lwjgl.opengl.GL11.glBegin; +import static org.lwjgl.opengl.GL11.glBlendFunc; +import static org.lwjgl.opengl.GL11.glClearColor; +import static org.lwjgl.opengl.GL11.glClearDepth; +import static org.lwjgl.opengl.GL11.glColor4f; +import static org.lwjgl.opengl.GL11.glDisable; +import static org.lwjgl.opengl.GL11.glEnable; +import static org.lwjgl.opengl.GL11.glEnableClientState; +import static org.lwjgl.opengl.GL11.glEnd; +import static org.lwjgl.opengl.GL11.glLoadIdentity; +import static org.lwjgl.opengl.GL11.glMatrixMode; +import static org.lwjgl.opengl.GL11.glOrtho; +import static org.lwjgl.opengl.GL11.glScissor; +import static org.lwjgl.opengl.GL11.glTexCoord2f; +import static org.lwjgl.opengl.GL11.glVertex3f; +import static org.lwjgl.opengl.GL11.glViewport; import java.awt.BorderLayout; import java.awt.Canvas; @@ -60,8 +86,6 @@ import javax.swing.JWindow; import javax.swing.KeyStroke; import javax.swing.ScrollPaneConstants; import javax.swing.SpinnerNumberModel; -import javax.swing.UIManager; -import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -70,15 +94,11 @@ import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; -import sun.rmi.runtime.Log; - +import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.RenderListener; -import com.badlogic.gdx.backends.desktop.LwjglApplication; +import com.badlogic.gdx.backends.desktop.LwjglApplicationNew; import com.badlogic.gdx.graphics.BitmapFont; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; @@ -87,14 +107,13 @@ import com.badlogic.gdx.hiero.unicodefont.HieroSettings; import com.badlogic.gdx.hiero.unicodefont.UnicodeFont; import com.badlogic.gdx.hiero.unicodefont.effects.ColorEffect; import com.badlogic.gdx.hiero.unicodefont.effects.ConfigurableEffect; -import com.badlogic.gdx.hiero.unicodefont.effects.ConfigurableEffect.Value; import com.badlogic.gdx.hiero.unicodefont.effects.EffectUtil; import com.badlogic.gdx.hiero.unicodefont.effects.GradientEffect; import com.badlogic.gdx.hiero.unicodefont.effects.OutlineEffect; import com.badlogic.gdx.hiero.unicodefont.effects.OutlineWobbleEffect; import com.badlogic.gdx.hiero.unicodefont.effects.OutlineZigzagEffect; import com.badlogic.gdx.hiero.unicodefont.effects.ShadowEffect; -import com.badlogic.gdx.utils.GdxRuntimeException; +import com.badlogic.gdx.hiero.unicodefont.effects.ConfigurableEffect.Value; /** * A tool to visualize settings for {@link UnicodeFont} and to export BMFont files for use with {@link BitmapFont}. @@ -105,7 +124,7 @@ public class Hiero extends JFrame { + "abcdefghijklmnopqrstuvwxyz\n1234567890\n" // + "\"!`?'.,;:()[]{}<>|/@\\^$-%+=#_&~*\u007F"; - LwjglApplication app; + LwjglApplicationNew app; Canvas glCanvas; volatile UnicodeFont newUnicodeFont; UnicodeFont unicodeFont; @@ -187,17 +206,8 @@ public class Hiero extends JFrame { public final void addNotify () { super.addNotify(); - app = new LwjglApplication("Hiero", 200, 200, false) { - protected void setupDisplay () throws LWJGLException { - try { - Display.setParent(glCanvas); - } catch (LWJGLException ex) { - throw new GdxRuntimeException("Error setting display parent.", ex); - } - super.setupDisplay(); - } - }; - app.getGraphics().setRenderListener(new Renderer()); + app = new LwjglApplicationNew(new Renderer(), "Hiero", 200, 200, false, glCanvas); + addWindowListener(new WindowAdapter() { public void windowClosed (WindowEvent event) { app.stop(); @@ -1132,7 +1142,7 @@ public class Hiero extends JFrame { } } - class Renderer implements RenderListener { + class Renderer implements ApplicationListener { private String sampleText; public void created () { @@ -1149,9 +1159,10 @@ public class Hiero extends JFrame { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - public void resized (int width, int height) { + int width = Gdx.graphics.getWidth(); + int height = Gdx.graphics.getHeight(); + glViewport(0, 0, width, height); glScissor(0, 0, width, height); @@ -1260,6 +1271,30 @@ public class Hiero extends JFrame { public void dispose () { } + + @Override + public void create() { + // TODO Auto-generated method stub + + } + + @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 + + } } public static void main (String[] args) throws Exception { diff --git a/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFontTest.java b/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFontTest.java index 46152fc02..a2048be9a 100644 --- a/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFontTest.java +++ b/extensions/hiero/src/com/badlogic/gdx/hiero/unicodefont/UnicodeFontTest.java @@ -1,26 +1,46 @@ package com.badlogic.gdx.hiero.unicodefont; -import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL11.GL_BLEND; +import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT; +import static org.lwjgl.opengl.GL11.GL_LIGHTING; +import static org.lwjgl.opengl.GL11.GL_MODELVIEW; +import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.GL_PROJECTION; +import static org.lwjgl.opengl.GL11.GL_SCISSOR_TEST; +import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_COORD_ARRAY; +import static org.lwjgl.opengl.GL11.GL_VERTEX_ARRAY; +import static org.lwjgl.opengl.GL11.glBlendFunc; +import static org.lwjgl.opengl.GL11.glClearColor; +import static org.lwjgl.opengl.GL11.glClearDepth; +import static org.lwjgl.opengl.GL11.glDisable; +import static org.lwjgl.opengl.GL11.glEnable; +import static org.lwjgl.opengl.GL11.glEnableClientState; +import static org.lwjgl.opengl.GL11.glLoadIdentity; +import static org.lwjgl.opengl.GL11.glMatrixMode; +import static org.lwjgl.opengl.GL11.glOrtho; +import static org.lwjgl.opengl.GL11.glScissor; +import static org.lwjgl.opengl.GL11.glViewport; import org.lwjgl.opengl.GL11; +import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.RenderListener; -import com.badlogic.gdx.backends.desktop.LwjglApplication; +import com.badlogic.gdx.backends.desktop.LwjglApplicationNew; import com.badlogic.gdx.hiero.unicodefont.effects.ColorEffect; -public class UnicodeFontTest implements RenderListener { +public class UnicodeFontTest implements ApplicationListener { private UnicodeFont unicodeFont; - public void created () { + public void create () { unicodeFont = new UnicodeFont("c:/windows/fonts/arial.ttf", 48, false, false); unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.white)); - // unicodeFont.addAsciiGlyphs(); - // unicodeFont.loadGlyphs(); - } - public void resized (int width, int height) { + int width = Gdx.graphics.getWidth(); + int height = Gdx.graphics.getHeight(); + glViewport(0, 0, width, height); glScissor(0, 0, width, height); glEnable(GL_SCISSOR_TEST); @@ -62,7 +82,24 @@ public class UnicodeFontTest implements RenderListener { } public static void main (String[] args) { - LwjglApplication app = new LwjglApplication("UnicodeFont Test", 800, 600, false); - app.getGraphics().setRenderListener(new UnicodeFontTest()); + new LwjglApplicationNew(new UnicodeFontTest(), "UnicodeFont Test", 800, 600, false); + } + + @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 + } } 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 4db9576f4..d42eed605 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 @@ -30,14 +30,11 @@ import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.CompoundBorder; import javax.swing.plaf.basic.BasicSplitPaneUI; -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.Display; - -import com.badlogic.gdx.Files.FileType; +import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputProcessor; -import com.badlogic.gdx.RenderListener; -import com.badlogic.gdx.backends.desktop.LwjglApplication; +import com.badlogic.gdx.Files.FileType; +import com.badlogic.gdx.backends.desktop.LwjglApplicationNew; import com.badlogic.gdx.graphics.BitmapFont; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL10; @@ -45,11 +42,10 @@ import com.badlogic.gdx.graphics.Sprite; import com.badlogic.gdx.graphics.SpriteBatch; import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.Texture.TextureWrap; -import com.badlogic.gdx.math.Matrix4; import com.badlogic.gdx.utils.GdxRuntimeException; public class ParticleEditor extends JFrame { - LwjglApplication app; + LwjglApplicationNew app; Canvas glCanvas; JPanel rowsPanel; EffectPanel effectPanel; @@ -66,17 +62,7 @@ public class ParticleEditor extends JFrame { public final void addNotify () { super.addNotify(); - app = new LwjglApplication("ParticleEditor", 200, 200, false) { - protected void setupDisplay () throws LWJGLException { - try { - Display.setParent(glCanvas); - } catch (LWJGLException ex) { - throw new GdxRuntimeException("Error setting display parent.", ex); - } - super.setupDisplay(); - } - }; - app.getGraphics().setRenderListener(new Renderer()); + app = new LwjglApplicationNew(new Renderer(),"ParticleEditor", 200, 200, false, glCanvas); addWindowListener(new WindowAdapter() { public void windowClosed (WindowEvent event) { app.stop(); @@ -248,7 +234,7 @@ public class ParticleEditor extends JFrame { splitPane.setDividerLocation(325); } - class Renderer implements RenderListener, InputProcessor { + class Renderer implements ApplicationListener, InputProcessor { private float maxActiveTimer; private int maxActive, lastMaxActive; private boolean mouseDown; @@ -258,7 +244,7 @@ public class ParticleEditor extends JFrame { private SpriteBatch spriteBatch; private Sprite bgImage; // BOZO - Add setting background image to UI. - public void created () { + public void create () { if (spriteBatch != null) return; spriteBatch = new SpriteBatch(); @@ -267,10 +253,6 @@ public class ParticleEditor extends JFrame { effectPanel.newEmitter("Untitled", true); // if (resources.openFile("/editor-bg.png") != null) bgImage = new Image(gl, "/editor-bg.png"); - Gdx.input.addInputListener(this); - } - - public void resized (int width, int height) { int viewWidth = Gdx.graphics.getWidth(); int viewHeight = Gdx.graphics.getHeight(); @@ -337,6 +319,7 @@ public class ParticleEditor extends JFrame { // gl.drawLine((int)(viewWidth * getCurrentParticles().getPercentComplete()), viewHeight - 1, viewWidth, viewHeight - // 1); + Gdx.input.processEvents(this); } } @@ -387,6 +370,25 @@ public class ParticleEditor extends JFrame { public void dispose () { } + + + @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 + + } } static class ParticleData { diff --git a/extensions/twl/gdx-twl-tests-android/src/com/badlogic/gdx/twl/TextAreaTest.java b/extensions/twl/gdx-twl-tests-android/src/com/badlogic/gdx/twl/TextAreaTest.java index beb13e283..df80b6d27 100644 --- a/extensions/twl/gdx-twl-tests-android/src/com/badlogic/gdx/twl/TextAreaTest.java +++ b/extensions/twl/gdx-twl-tests-android/src/com/badlogic/gdx/twl/TextAreaTest.java @@ -20,7 +20,6 @@ import com.badlogic.gdx.backends.android.AndroidApplication; public class TextAreaTest extends AndroidApplication { public void onCreate (Bundle bundle) { super.onCreate(bundle); - initialize(false); - getGraphics().setRenderListener(new com.badlogic.gdx.twl.tests.TextAreaTest()); + initialize(new com.badlogic.gdx.twl.tests.TextAreaTest(), false); } } diff --git a/extensions/twl/gdx-twl-tests/.classpath b/extensions/twl/gdx-twl-tests/.classpath index 0961e7fc7..54a8fdfcb 100644 --- a/extensions/twl/gdx-twl-tests/.classpath +++ b/extensions/twl/gdx-twl-tests/.classpath @@ -3,6 +3,6 @@ - + diff --git a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTest.java b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTest.java index d3a77de63..610c34349 100644 --- a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTest.java +++ b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTest.java @@ -1,29 +1,23 @@ package com.badlogic.gdx.twl.tests; -import com.badlogic.gdx.Files.FileType; +import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.RenderListener; +import com.badlogic.gdx.Files.FileType; import com.badlogic.gdx.graphics.GL10; +import com.badlogic.gdx.twl.renderer.TwlInputListener; import com.badlogic.gdx.twl.renderer.TwlRenderer; import de.matthiasmann.twl.Button; import de.matthiasmann.twl.DialogLayout; import de.matthiasmann.twl.FPSCounter; import de.matthiasmann.twl.GUI; -import de.matthiasmann.twl.ScrollPane; -import de.matthiasmann.twl.TextArea; -import de.matthiasmann.twl.Timer; -import de.matthiasmann.twl.textarea.HTMLTextAreaModel; -import de.matthiasmann.twl.textarea.Style; -import de.matthiasmann.twl.textarea.StyleAttribute; -import de.matthiasmann.twl.textarea.TextAreaModel.Element; -import de.matthiasmann.twl.textarea.Value; - -public class ButtonTest implements RenderListener { - GUI gui; - - public void created () { + +public class ButtonTest implements ApplicationListener { + GUI gui; + TwlInputListener guiInputListener; + + public void create () { if (gui != null) return; Button button = new Button("Click Me"); @@ -35,18 +29,36 @@ public class ButtonTest implements RenderListener { layout.setVerticalGroup(layout.createSequentialGroup().addWidget(button).addGap(5).addWidget(fpsCounter).addGap(5)); gui = TwlRenderer.createGUI(layout, "data/widgets.xml", FileType.Internal); + gui.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + guiInputListener = new TwlInputListener(gui); } public void render () { - Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); - gui.update(); - } - - public void resized (int width, int height) { - gui.setSize(); + Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); + + Gdx.input.processEvents(guiInputListener); + gui.update(); } public void dispose () { gui.destroy(); + } + + @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 + } } diff --git a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTestDesktop.java b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTestDesktop.java index 3b30509b3..9db26c663 100644 --- a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTestDesktop.java +++ b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/ButtonTestDesktop.java @@ -1,11 +1,10 @@ package com.badlogic.gdx.twl.tests; -import com.badlogic.gdx.backends.desktop.JoglApplication; +import com.badlogic.gdx.backends.jogl.JoglApplication; public class ButtonTestDesktop { public static void main (String[] argv) { - JoglApplication app = new JoglApplication("Button Test", 480, 320, false); - app.getGraphics().setRenderListener(new ButtonTest()); + new JoglApplication(new ButtonTest(), "Button Test", 480, 320, false); } } diff --git a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTest.java b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTest.java index 7f4b7af4b..9b6b35fa2 100644 --- a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTest.java +++ b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTest.java @@ -1,10 +1,11 @@ package com.badlogic.gdx.twl.tests; -import com.badlogic.gdx.Files.FileType; +import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.RenderListener; +import com.badlogic.gdx.Files.FileType; import com.badlogic.gdx.graphics.GL10; +import com.badlogic.gdx.twl.renderer.TwlInputListener; import com.badlogic.gdx.twl.renderer.TwlRenderer; import de.matthiasmann.twl.DialogLayout; @@ -16,13 +17,14 @@ import de.matthiasmann.twl.Timer; import de.matthiasmann.twl.textarea.HTMLTextAreaModel; import de.matthiasmann.twl.textarea.Style; import de.matthiasmann.twl.textarea.StyleAttribute; -import de.matthiasmann.twl.textarea.TextAreaModel.Element; import de.matthiasmann.twl.textarea.Value; +import de.matthiasmann.twl.textarea.TextAreaModel.Element; -public class TextAreaTest implements RenderListener { +public class TextAreaTest implements ApplicationListener { GUI gui; + TwlInputListener guiInputListener; - public void created () { + public void create () { if (gui != null) return; final HTMLTextAreaModel htmlText = new HTMLTextAreaModel(); @@ -68,18 +70,30 @@ public class TextAreaTest implements RenderListener { speed = -speed; } }); + + TwlRenderer.updateSize(gui); + guiInputListener = new TwlInputListener(gui); } public void render () { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); + Gdx.input.processEvents(guiInputListener); gui.update(); } - public void resized (int width, int height) { - TwlRenderer.updateSize(gui); + public void destroy () { + gui.destroy(); } - public void dispose () { - gui.destroy(); + @Override + public void pause() { + // TODO Auto-generated method stub + + } + + @Override + public void resume() { + // TODO Auto-generated method stub + } } diff --git a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTestDesktop.java b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTestDesktop.java index 210a1ccb1..cd6ed68aa 100644 --- a/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTestDesktop.java +++ b/extensions/twl/gdx-twl-tests/src/com/badlogic/gdx/twl/tests/TextAreaTestDesktop.java @@ -1,11 +1,10 @@ package com.badlogic.gdx.twl.tests; -import com.badlogic.gdx.backends.desktop.JoglApplication; +import com.badlogic.gdx.backends.jogl.JoglApplication; public class TextAreaTestDesktop { public static void main (String[] argv) { - JoglApplication app = new JoglApplication("Twl Test", 480, 320, false); - app.getGraphics().setRenderListener(new TextAreaTest()); + new JoglApplication(new TextAreaTest(), "Twl Test", 480, 320, false); } } diff --git a/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlInputListener.java b/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlInputListener.java index 748f3bd6d..2f9b8a686 100644 --- a/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlInputListener.java +++ b/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlInputListener.java @@ -2,7 +2,6 @@ package com.badlogic.gdx.twl.renderer; import com.badlogic.gdx.InputProcessor; -import com.badlogic.gdx.RenderListener; import de.matthiasmann.twl.GUI; diff --git a/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlRenderer.java b/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlRenderer.java index 195f0c8bc..2b9b7beba 100644 --- a/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlRenderer.java +++ b/extensions/twl/gdx-twl/src/com/badlogic/gdx/twl/renderer/TwlRenderer.java @@ -241,8 +241,7 @@ public class TwlRenderer implements Renderer { gui.applyTheme(ThemeManager.createThemeManager(themeURL, renderer)); } catch (IOException ex) { throw new GdxRuntimeException("Error loading theme: " + themeFile, ex); - } - Gdx.input.addInputListener(new TwlInputListener(gui)); + } return gui; } } diff --git a/tests/gdx-tests-lwjgl/src/com/badlogic/gdx/tests/lwjgl/LwjglTestStarter.java b/tests/gdx-tests-lwjgl/src/com/badlogic/gdx/tests/lwjgl/LwjglTestStarter.java index 1fe65f7a9..0dd8f0e59 100644 --- a/tests/gdx-tests-lwjgl/src/com/badlogic/gdx/tests/lwjgl/LwjglTestStarter.java +++ b/tests/gdx-tests-lwjgl/src/com/badlogic/gdx/tests/lwjgl/LwjglTestStarter.java @@ -15,7 +15,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; -import com.badlogic.gdx.backends.desktop.LwjglApplication; +import com.badlogic.gdx.backends.desktop.LwjglApplicationNew; import com.badlogic.gdx.tests.utils.GdxTest; import com.badlogic.gdx.tests.utils.GdxTests; @@ -43,8 +43,7 @@ public class LwjglTestStarter { @Override public void actionPerformed (ActionEvent e) { String testName = (String)list.getSelectedValue(); GdxTest test = GdxTests.newTest(testName); - LwjglApplication app = new LwjglApplication(testName, 480, 320, test.needsGL20()); - app.getGraphics().setRenderListener(test); + new LwjglApplicationNew(test,testName, 480, 320, test.needsGL20()); } });