Update of /cvsroot/java-game-lib/LWJGL/src/native/win32
In directory sc8-pr-cvs1:/tmp/cvs-serv13855/win32
Modified Files:
org_lwjgl_Display.cpp
Log Message:
Added a standard system error output
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.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- org_lwjgl_Display.cpp 24 Nov 2002 17:12:36 -0000 1.7
+++ org_lwjgl_Display.cpp 14 Dec 2002 15:23:53 -0000 1.8
@@ -53,7 +53,24 @@
bool oneShotInitialised = false;
HWND hwnd = NULL; // Handle to the window
HDC hdc = NULL; // Device context
-LPDIRECTINPUT lpdi = NULL;
+LPDIRECTINPUT lpdi = NULL;
+
+void dumpLastError(void) {
+ LPVOID lpMsgBuf;
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ 0, // Default language
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ NULL
+ );
+ printf("System error: %s\n", lpMsgBuf);
+ LocalFree(lpMsgBuf);
+}
/*
* A dummy WindowProc which does nothing. Used so we can have an invisible OpenGL window
@@ -178,16 +195,14 @@
{
#ifdef _DEBUG
printf("Creating display: size %dx%d %dhz %dbpp...\n", width, height, freq, bpp);
-#endif
-
+#endif
if (fullscreen && SetDisplayMode(width, height, bpp, freq) != 1)
return JNI_FALSE;
/*
Register a window. This window does nothing, it's just a requirement that we get
a handle to it so we can do other things
- */
-
+ */
if (!oneShotInitialised) {
WNDCLASS windowClass;
@@ -203,9 +218,10 @@
windowClass.lpszClassName = WINDOWCLASSNAME;
if (RegisterClass(&windowClass) == 0) {
+ dumpLastError();
printf("Failed to register window class\n");
return JNI_FALSE;
- }
+ }
oneShotInitialised = true;
}
|