Added a standard system error output
This commit is contained in:
parent
434497c7bd
commit
450ff067cf
|
@ -55,6 +55,23 @@ HWND hwnd = NULL; // Handle to the window
|
||||||
HDC hdc = NULL; // Device context
|
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
|
* A dummy WindowProc which does nothing. Used so we can have an invisible OpenGL window
|
||||||
*/
|
*/
|
||||||
|
@ -179,7 +196,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Creating display: size %dx%d %dhz %dbpp...\n", width, height, freq, bpp);
|
printf("Creating display: size %dx%d %dhz %dbpp...\n", width, height, freq, bpp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fullscreen && SetDisplayMode(width, height, bpp, freq) != 1)
|
if (fullscreen && SetDisplayMode(width, height, bpp, freq) != 1)
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
|
|
||||||
|
@ -187,7 +203,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate
|
||||||
Register a window. This window does nothing, it's just a requirement that we get
|
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
|
a handle to it so we can do other things
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!oneShotInitialised) {
|
if (!oneShotInitialised) {
|
||||||
WNDCLASS windowClass;
|
WNDCLASS windowClass;
|
||||||
|
|
||||||
|
@ -203,6 +218,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate
|
||||||
windowClass.lpszClassName = WINDOWCLASSNAME;
|
windowClass.lpszClassName = WINDOWCLASSNAME;
|
||||||
|
|
||||||
if (RegisterClass(&windowClass) == 0) {
|
if (RegisterClass(&windowClass) == 0) {
|
||||||
|
dumpLastError();
|
||||||
printf("Failed to register window class\n");
|
printf("Failed to register window class\n");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue