From: Caspian Rychlik-P. <ci...@us...> - 2003-03-28 23:16:21
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv18020/src/native/win32 Modified Files: org_lwjgl_opengl_BaseGL.cpp org_lwjgl_Display.cpp org_lwjgl_Window.cpp Log Message: Big changes for the new 0.6 LWJGL release Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_opengl_BaseGL.cpp 28 Mar 2003 19:01:48 -0000 1.16 +++ org_lwjgl_opengl_BaseGL.cpp 28 Mar 2003 23:16:13 -0000 1.17 @@ -198,6 +198,9 @@ // Delete the rendering context if (hglrc != NULL) { +#ifdef _DEBUG + printf("Delete GL context\n"); +#endif wglDeleteContext(hglrc); hglrc = NULL; } Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- org_lwjgl_Display.cpp 28 Mar 2003 19:01:50 -0000 1.35 +++ org_lwjgl_Display.cpp 28 Mar 2003 23:16:14 -0000 1.36 @@ -46,7 +46,7 @@ jobjectArray GetAvailableDisplayModesNT(JNIEnv * env); jobjectArray GetAvailableDisplayModes9x(JNIEnv * env); - +bool modeSet = false; // Whether we've done a display mode change /* @@ -254,6 +254,7 @@ env->SetStaticObjectField(clazz, fid_initialMode, newMode); env->DeleteLocalRef(newMode); + modeSet = true; } /* @@ -264,11 +265,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_resetDisplayMode (JNIEnv * env, jclass clazz) { - // Under Win32, all we have to do is: - ChangeDisplaySettings(NULL, 0); + if (modeSet) { + modeSet = false; + // Under Win32, all we have to do is: + ChangeDisplaySettings(NULL, 0); - // And we'll call init() again to put the correct mode back in Display - Java_org_lwjgl_Display_init(env, clazz); + // And we'll call init() again to put the correct mode back in Display + Java_org_lwjgl_Display_init(env, clazz); + } } /* Index: org_lwjgl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Window.cpp 28 Mar 2003 21:04:32 -0000 1.3 +++ org_lwjgl_Window.cpp 28 Mar 2003 23:16:15 -0000 1.4 @@ -101,19 +101,31 @@ { // Release DirectInput if (lpdi != NULL) { +#ifdef _DEBUG + printf("Destroying directinput\n"); +#endif lpdi->Release(); lpdi = NULL; } // Release device context if (hdc != NULL && hwnd != NULL) { +#ifdef _DEBUG + printf("Releasing DC\n"); +#endif ReleaseDC(hwnd, hdc); } // Close the window if (hwnd != NULL) { +#ifdef _DEBUG + printf("Destroy window\n"); +#endif // Vape the window DestroyWindow(hwnd); +#ifdef _DEBUG + printf("Destroyed window\n"); +#endif hwnd = NULL; } @@ -144,7 +156,6 @@ LPARAM lParam) { if (environment == NULL) { - printf("No environment!\n"); return DefWindowProc(hWnd, msg, wParam, lParam); } @@ -227,7 +238,9 @@ printf("Failed to register window class\n"); return false; } +#ifdef _DEBUG printf("Window registered\n"); +#endif oneShotInitialised = true; } @@ -308,7 +321,7 @@ // and then to issue commands to it, you need to call gl::makeCurrent(). // 3. Hide the mouse if necessary - isFullScreen = fullscreen; + isFullScreen = fullscreen == JNI_TRUE; if (isFullScreen) { ShowCursor(FALSE); } @@ -356,7 +369,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Window_nDestroy (JNIEnv * env, jobject obj) { + // Cache env and obj + environment = env; + window = obj; + closeWindow(); + + environment = NULL; + window = NULL; } /* |