diff --git a/src/java/org/lwjgl/opengl/CoreGL.java b/src/java/org/lwjgl/opengl/CoreGL.java index f1815017..3306112e 100644 --- a/src/java/org/lwjgl/opengl/CoreGL.java +++ b/src/java/org/lwjgl/opengl/CoreGL.java @@ -53,9 +53,8 @@ public class CoreGL extends BaseGL implements CoreGLConstants { * @param alpha * @param depth * @param stencil - * @throws Exception */ - public CoreGL(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) throws Exception { + public CoreGL(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) { super(title, x, y, width, height, bpp, alpha, depth, stencil); } @@ -65,9 +64,8 @@ public class CoreGL extends BaseGL implements CoreGLConstants { * @param alpha * @param depth * @param stencil - * @throws Exception */ - public CoreGL(String title, int bpp, int alpha, int depth, int stencil) throws Exception { + public CoreGL(String title, int bpp, int alpha, int depth, int stencil) { super(title, bpp, alpha, depth, stencil); } diff --git a/src/java/org/lwjgl/opengl/GL.java b/src/java/org/lwjgl/opengl/GL.java index 7c1ae04c..7d6f1757 100644 --- a/src/java/org/lwjgl/opengl/GL.java +++ b/src/java/org/lwjgl/opengl/GL.java @@ -58,9 +58,8 @@ public class GL extends CoreGL implements GLConstants { * @param alpha * @param depth * @param stencil - * @throws Exception */ - public GL(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) throws Exception { + public GL(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) { super(title, x, y, width, height, bpp, alpha, depth, stencil); } @@ -70,9 +69,8 @@ public class GL extends CoreGL implements GLConstants { * @param alpha * @param depth * @param stencil - * @throws Exception */ - public GL(String title, int bpp, int alpha, int depth, int stencil) throws Exception { + public GL(String title, int bpp, int alpha, int depth, int stencil) { super(title, bpp, alpha, depth, stencil); } diff --git a/src/java/org/lwjgl/test/opengl/Game.java b/src/java/org/lwjgl/test/opengl/Game.java index e5209d78..55e81f4a 100644 --- a/src/java/org/lwjgl/test/opengl/Game.java +++ b/src/java/org/lwjgl/test/opengl/Game.java @@ -61,17 +61,18 @@ public final class Game { break; } } - - //select above found displaymode - Display.create(modes[mode], 0, 16, 0, false, "LWJGL Game Example"); - System.out.println("Created display."); + if (mode != -1) { + //select above found displaymode + System.out.println("Setting display mode to "+modes[mode]); + Display.setDisplayMode(modes[mode]); + System.out.println("Created display."); + } } catch (Exception e) { System.err.println("Failed to create display due to " + e); - System.exit(1); } } - public static final GL gl = new GL(); + public static final GL gl = new GL("LWJGL Game Example", 16, 0, 0,0); public static final GLU glu = new GLU(gl); static { try { @@ -99,10 +100,18 @@ public final class Game { try { init(); while (!finished) { -// Keyboard.poll(); + gl.tick(); + + if (gl.isMinimized()) + Thread.sleep(200); + else if (gl.isCloseRequested()) + System.exit(0); + + Keyboard.poll(); + Keyboard.read(); mainLoop(); render(); - gl.swapBuffers(); + gl.paint(); } } catch (Throwable t) { t.printStackTrace(); @@ -188,6 +197,10 @@ public final class Game { Keyboard.destroy(); Mouse.destroy(); gl.destroy(); - BaseGL.destroy(); + try { + Display.resetDisplayMode(); + } catch (Exception e) { + e.printStackTrace(); + } } }