|
From: Caspian Rychlik-P. <ci...@us...> - 2005-05-04 20:41:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11996/src/java/org/lwjgl/opengl Modified Files: Display.java Log Message: Internal tweaks to allow certain display mode changes Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- Display.java 9 Apr 2005 17:35:37 -0000 1.48 +++ Display.java 4 May 2005 20:41:24 -0000 1.49 @@ -129,13 +129,13 @@ String class_name; switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_LINUX: - class_name = "org.lwjgl.opengl.LinuxDisplay"; + class_name = "org.lwjgl.opengl.LinuxDisplay"; break; case LWJGLUtil.PLATFORM_WINDOWS: - class_name = "org.lwjgl.opengl.Win32Display"; + class_name = "org.lwjgl.opengl.Win32Display"; break; case LWJGLUtil.PLATFORM_MACOSX: - class_name = "org.lwjgl.opengl.MacOSXDisplay"; + class_name = "org.lwjgl.opengl.MacOSXDisplay"; break; default: throw new IllegalStateException("Unsupported platform"); @@ -231,8 +231,9 @@ * A native context must exist, and it will be attached to the window. */ private static void createWindow() throws LWJGLException { - if (window_created) - throw new InternalError("Window already created"); + if (window_created) { + return; + } int window_x; int window_y; if (!fullscreen) { @@ -255,19 +256,22 @@ initControls(); setVSyncEnabled(vsync); window_created = true; + update(); } private static void destroyWindow() { + if (!window_created) { + return; + } try { - if (context.isCurrent()) - Context.releaseCurrentContext(); + if (context.isCurrent()) { + Context.releaseCurrentContext(); + } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred while trying to release context"); } - if (!window_created) - throw new InternalError("Window already created"); - // Automatically destroy keyboard, mouse, and controller + // Automatically destroy keyboard & mouse if (Mouse.isCreated()) { Mouse.destroy(); } @@ -279,8 +283,10 @@ } private static void switchDisplayMode() throws LWJGLException { - if (!current_mode.isFullscreen()) - throw new LWJGLException("The current DisplayMode instance cannot be used for fullscreen mode"); + if (!current_mode.isFullscreen()) { + System.out.println("Switching to "+initial_mode); + setDisplayMode(initial_mode); + } display_impl.switchDisplayMode(current_mode); } |