You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
|
2
(1) |
3
(2) |
4
|
|
5
(1) |
6
|
7
(11) |
8
(4) |
9
(2) |
10
(6) |
11
(14) |
|
12
(10) |
13
(13) |
14
(8) |
15
|
16
|
17
(2) |
18
|
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
|
26
|
27
(3) |
28
(1) |
29
|
30
|
31
|
|
|
From: Elias N. <eli...@us...> - 2004-12-11 20:18:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16276/linux Modified Files: org_lwjgl_Sys.c org_lwjgl_input_Mouse.c org_lwjgl_opengl_Display.c Log Message: Added java debug to all of linux native code Index: org_lwjgl_Sys.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_Sys.c 14 Nov 2004 11:39:54 -0000 1.8 +++ org_lwjgl_Sys.c 11 Dec 2004 20:18:18 -0000 1.9 @@ -59,10 +59,10 @@ return 1000000; } -static long queryTime(void) { +static long queryTime(JNIEnv *env) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { - printfDebug("Could not read current time\n"); + printfDebugJava(env, "Could not read current time"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; @@ -81,7 +81,7 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime (JNIEnv * env, jclass clazz) { - hires_timer = queryTime(); + hires_timer = queryTime(env); return (jlong) hires_timer; } @@ -101,7 +101,7 @@ // Reset scheduler to normal sched_pri.sched_priority = 0; if (sched_setscheduler(0, SCHED_OTHER, &sched_pri) != 0) { - printfDebug("Could not set realtime priority\n"); + printfDebugJava(env, "Could not set realtime priority"); return; } } @@ -111,12 +111,12 @@ min_pri = sched_get_priority_min(SCHED_FIFO); max_pri = sched_get_priority_max(SCHED_FIFO); if (min_pri == -1 || max_pri == -1) { - printfDebug("Failed to set realtime priority\n"); + printfDebugJava(env, "Failed to set realtime priority"); return; } sched_pri.sched_priority = (max_pri + min_pri)/2; if (sched_setscheduler(0, SCHED_FIFO, &sched_pri) != 0) { - printfDebug("Could not set realtime priority\n"); + printfDebugJava(env, "Could not set realtime priority"); return; } return; @@ -134,7 +134,7 @@ } if (setpriority(PRIO_PROCESS, 0, linux_priority) == -1) { - printfDebug("Failed to set priority.\n"); + printfDebugJava(env, "Failed to set priority."); } } @@ -143,7 +143,7 @@ char * eMessageText = GetStringNativeChars(env, message); char * cTitleBarText = GetStringNativeChars(env, title); - printfDebug("*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); + printfDebugJava(env, "*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); free(eMessageText); free(cTitleBarText); Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- org_lwjgl_opengl_Display.c 11 Dec 2004 20:09:04 -0000 1.15 +++ org_lwjgl_opengl_Display.c 11 Dec 2004 20:18:18 -0000 1.16 @@ -115,7 +115,7 @@ if (env != NULL) throwException(env, error_message); else - printfDebug(error_message); + printfDebugJava(env, error_message); return false; } else return true; @@ -145,7 +145,7 @@ if (env != NULL) throwException(env, "Could not open X display connection"); else - printfDebug("Could not open X display connection\n"); + printfDebugJava(env, "Could not open X display connection"); return NULL; } warp_atom = XInternAtom(display_connection, "_LWJGL_WARP", False); @@ -179,12 +179,12 @@ updateKeyboardGrab(); } -static void setRepeatMode(int mode) { +static void setRepeatMode(JNIEnv *env, int mode) { XKeyboardControl repeat_mode; repeat_mode.auto_repeat_mode = mode; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { - printfDebug("Could not open display to set repeat mode\n"); + printfDebugJava(env, "Could not open display to set repeat mode"); return; } XChangeKeyboardControl(disp, KBAutoRepeatMode, &repeat_mode); @@ -203,7 +203,7 @@ if (isLegacyFullscreen() || input_released) return false; input_released = true; - setRepeatMode(AutoRepeatModeDefault); + setRepeatMode(env, AutoRepeatModeDefault); updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { XIconifyWindow(getDisplay(), getCurrentWindow(), getCurrentScreen()); @@ -216,7 +216,7 @@ if (isLegacyFullscreen() || !input_released) return; input_released = false; - setRepeatMode(AutoRepeatModeOff); + setRepeatMode(env, AutoRepeatModeOff); updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { temporaryRestoreMode(env, getCurrentScreen()); @@ -323,15 +323,15 @@ free(title); } -static void destroyWindow(void) { +static void destroyWindow(JNIEnv *env) { if (USEGLX13) glXDestroyWindow(getDisplay(), glx_window); XDestroyWindow(getDisplay(), current_win); XFreeColormap(getDisplay(), cmap); - setRepeatMode(AutoRepeatModeDefault); + setRepeatMode(env, AutoRepeatModeDefault); } -static bool isNetWMFullscreenSupported() { +static bool isNetWMFullscreenSupported(JNIEnv *env) { unsigned long nitems; Atom actual_type; int actual_format; @@ -340,7 +340,7 @@ Atom netwm_supported_atom = XInternAtom(getDisplay(), "_NET_SUPPORTED", False); int result = XGetWindowProperty(getDisplay(), RootWindow(getDisplay(), getCurrentScreen()), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list); if (result != Success) { - printfDebug("Unable to query _NET_SUPPORTED window property\n"); + printfDebugJava(env, "Unable to query _NET_SUPPORTED window property"); return false; } Atom fullscreen_atom = XInternAtom(getDisplay(), "_NET_WM_STATE_FULLSCREEN", False); @@ -392,7 +392,7 @@ XFreeColormap(getDisplay(), cmap); return false; } - printfDebug("Created window\n"); + printfDebugJava(env, "Created window"); current_win = win; if (current_window_mode != WINDOWED || undecorated) { // Use Motif decoration hint property and hope the window manager respects them @@ -416,9 +416,9 @@ XMapRaised(getDisplay(), win); waitMapped(win); XClearWindow(getDisplay(), win); - setRepeatMode(AutoRepeatModeOff); + setRepeatMode(env, AutoRepeatModeOff); if (!checkXError(env)) { - destroyWindow(); + destroyWindow(env); return false; } return true; @@ -575,7 +575,7 @@ return glXChooseVisual(getDisplay(), getCurrentScreen(), attrib_list.attribs); } -static void dumpVisualInfo(XVisualInfo *vis_info) { +static void dumpVisualInfo(JNIEnv *env, XVisualInfo *vis_info) { int alpha, depth, stencil, r, g, b; int sample_buffers = 0; int samples = 0; @@ -589,7 +589,7 @@ glXGetConfig(getDisplay(), vis_info, GLX_SAMPLE_BUFFERS_ARB, &sample_buffers); glXGetConfig(getDisplay(), vis_info, GLX_SAMPLES_ARB, &samples); } - printfDebug("Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d\n", r, g, b, alpha, depth, stencil, sample_buffers, samples); + printfDebugJava(env, "Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d", r, g, b, alpha, depth, stencil, sample_buffers, samples); } static void destroyContext(void) { @@ -645,7 +645,7 @@ return false; } if (isDebugEnabled()) - dumpVisualInfo(vis_info); + dumpVisualInfo(env, vis_info); context = glXCreateContext(getDisplay(), vis_info, NULL, True); if (context == NULL) { XFree(vis_info); @@ -726,7 +726,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_createWindow(JNIEnv *env, jobject this, jobject mode, jboolean fullscreen, int x, int y) { bool current_fullscreen = fullscreen == JNI_TRUE; if (current_fullscreen) { - if (getCurrentDisplayModeExtension() == XRANDR && isNetWMFullscreenSupported()) + if (getCurrentDisplayModeExtension() == XRANDR && isNetWMFullscreenSupported(env)) current_window_mode = FULLSCREEN_NETWM; else current_window_mode = FULLSCREEN_LEGACY; @@ -742,17 +742,17 @@ return; } if (isDebugEnabled()) - dumpVisualInfo(vis_info); + dumpVisualInfo(env, vis_info); if (USEGLX13) glx_window = glXCreateWindow(getDisplay(), configs[0], getCurrentWindow(), NULL); if (!makeCurrent() || !checkXError(env)) { glXDestroyWindow(getDisplay(), glx_window); - destroyWindow(); + destroyWindow(env); } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_destroyWindow(JNIEnv *env, jobject this) { - destroyWindow(); + destroyWindow(env); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_swapBuffers(JNIEnv * env, jobject this) Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- org_lwjgl_input_Mouse.c 11 Dec 2004 20:09:04 -0000 1.27 +++ org_lwjgl_input_Mouse.c 11 Dec 2004 20:18:18 -0000 1.28 @@ -110,10 +110,10 @@ last_y = y; } -static bool blankCursor(void) { +static bool blankCursor(JNIEnv *env) { unsigned int best_width, best_height; if (XQueryBestCursor(getDisplay(), getCurrentWindow(), 1, 1, &best_width, &best_height) == 0) { - printfDebug("Could not query best cursor size\n"); + throwException(env, "Could not query best cursor size"); return false; } Pixmap mask = XCreatePixmap(getDisplay(), getCurrentWindow(), best_width, best_height, 1); @@ -259,9 +259,8 @@ reset(); for (i = 0; i < NUM_BUTTONS; i++) buttons[i] = 0; - if (!blankCursor()) { + if (!blankCursor(env)) { decDisplay(); - throwException(env, "Could not create blank cursor"); return; } current_cursor = None; @@ -367,7 +366,7 @@ int buttons_length = (*env)->GetDirectBufferCapacity(env, button_buffer_obj); handleMessages(env); if (coords_length < 3) { - printfDebug("ERROR: Not enough space in coords array: %d < 3\n", coords_length); + printfDebugJava(env, "ERROR: Not enough space in coords array: %d < 3", coords_length); return; } if (isGrabbed()) { |
|
From: Elias N. <eli...@us...> - 2004-12-11 20:09:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14152/linux Modified Files: Window.h display.c display.h org_lwjgl_input_Keyboard.c org_lwjgl_input_Mouse.c org_lwjgl_opengl_Display.c Log Message: Added java debug output to linux display.c Index: display.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- display.h 22 Sep 2004 19:56:02 -0000 1.6 +++ display.h 11 Dec 2004 20:09:04 -0000 1.7 @@ -51,11 +51,11 @@ extern int getScreenModeHeight(void); extern jobject initDisplay(JNIEnv *env, int screen); extern void switchDisplayMode(JNIEnv * env, jobject mode, int screen); -extern void resetDisplayMode(int screen, bool temporary); +extern void resetDisplayMode(JNIEnv *env, int screen, bool temporary); extern jobjectArray getAvailableDisplayModes(JNIEnv * env, int screen); -extern int getGammaRampLength(int screen); +extern int getGammaRampLength(JNIEnv *env, int screen); extern void setGammaRamp(JNIEnv *env, jobject gamma_ramp_buffer, int screen); extern extension getCurrentDisplayModeExtension(); -extern void temporaryRestoreMode(int screen); +extern void temporaryRestoreMode(JNIEnv *env, int screen); #endif Index: org_lwjgl_input_Keyboard.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_input_Keyboard.c 2 Nov 2004 12:48:58 -0000 1.11 +++ org_lwjgl_input_Keyboard.c 11 Dec 2004 20:09:04 -0000 1.12 @@ -285,12 +285,12 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_pollKeyboard(JNIEnv * env, jobject this, jobject buffer) { unsigned char *new_keyboard_buffer = (unsigned char *)(*env)->GetDirectBufferAddress(env, buffer); - handleMessages(); + handleMessages(env); memcpy(new_keyboard_buffer, key_buf, KEYBOARD_SIZE*sizeof(unsigned char)); } JNIEXPORT int JNICALL Java_org_lwjgl_opengl_LinuxDisplay_readKeyboard(JNIEnv * env, jobject this, jobject buffer, jint buffer_position) { - handleMessages(); + handleMessages(env); jint* buffer_ptr = (jint *)(*env)->GetDirectBufferAddress(env, buffer); int buffer_size = ((*env)->GetDirectBufferCapacity(env, buffer))/sizeof(jint) - buffer_position; return copyEvents(&event_queue, buffer_ptr + buffer_position, buffer_size); Index: Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Window.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Window.h 11 Dec 2004 11:21:01 -0000 1.23 +++ Window.h 11 Dec 2004 20:09:03 -0000 1.24 @@ -53,8 +53,7 @@ /* * release input (keyboard, mouse) */ - extern bool releaseInput(void); - extern void handleMessages(void); + extern void handleMessages(JNIEnv *env); extern bool checkXError(JNIEnv *env); extern Atom getWarpAtom(void); Index: display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/display.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- display.c 22 Sep 2004 19:56:02 -0000 1.3 +++ display.c 11 Dec 2004 20:09:03 -0000 1.4 @@ -87,54 +87,54 @@ return current_extension; } -static bool getXF86VidModeVersion(Display *disp, int *major, int *minor) { +static bool getXF86VidModeVersion(JNIEnv *env, Display *disp, int *major, int *minor) { int event_base, error_base; if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { - printfDebug("XF86VidMode extension not available\n"); + printfDebugJava(env, "XF86VidMode extension not available"); return false; } if (!XF86VidModeQueryVersion(disp, major, minor)) { - printfDebug("Could not query XF86VidMode version\n"); + printfDebugJava(env, "Could not query XF86VidMode version"); return false; } - printfDebug("XF86VidMode extension version %i.%i\n", *major, *minor); + printfDebugJava(env, "XF86VidMode extension version %i.%i", *major, *minor); return true; } -static bool getXrandrVersion(Display *disp, int *major, int *minor) { +static bool getXrandrVersion(JNIEnv *env, Display *disp, int *major, int *minor) { int event_base, error_base; if (!XRRQueryExtension(disp, &event_base, &error_base)) { - printfDebug("Xrandr extension not available\n"); + printfDebugJava(env, "Xrandr extension not available"); return false; } if (!XRRQueryVersion(disp, major, minor)) { - printfDebug("Could not query Xrandr version\n"); + printfDebugJava(env, "Could not query Xrandr version"); return false; } - printfDebug("Xrandr extension version %i.%i\n", *major, *minor); + printfDebugJava(env, "Xrandr extension version %i.%i", *major, *minor); return true; } -static bool isXrandrSupported(Display *disp) { +static bool isXrandrSupported(JNIEnv *env, Display *disp) { int major, minor; - if (!getXrandrVersion(disp, &major, &minor)) + if (!getXrandrVersion(env, disp, &major, &minor)) return false; return major >= 1; } -static bool isXF86VidModeSupported(Display *disp) { +static bool isXF86VidModeSupported(JNIEnv *env, Display *disp) { int minor_ver, major_ver; - if (!getXF86VidModeVersion(disp, &major_ver, &minor_ver)) + if (!getXF86VidModeVersion(env, disp, &major_ver, &minor_ver)) return false; return major_ver >= 2; } -static extension getBestDisplayModeExtension(Display *disp) { - if (isXrandrSupported(disp)) +static extension getBestDisplayModeExtension(JNIEnv *env, Display *disp) { + if (isXrandrSupported(env, disp)) return XRANDR; - else if (isXF86VidModeSupported(disp)) + else if (isXF86VidModeSupported(env, disp)) return XF86VIDMODE; else return NONE; @@ -225,29 +225,29 @@ return true; } -static bool setMode(Display *disp, int screen, int width, int height, int freq, bool temporary) { +static bool setMode(JNIEnv *env, Display *disp, int screen, int width, int height, int freq, bool temporary) { if (current_extension == NONE) return false; int num_modes, i; mode_info *avail_modes = getDisplayModes(disp, screen, &num_modes); if (avail_modes == NULL) { - printfDebug("Could not get display modes\n"); + printfDebugJava(env, "Could not get display modes"); return false; } bool result = false; for ( i = 0; i < num_modes; ++i ) { - printfDebug("Mode %d: %dx%d @%d\n", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq); + printfDebugJava(env, "Mode %d: %dx%d @%d", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq); if (avail_modes[i].width == width && avail_modes[i].height == height && avail_modes[i].freq == freq) { switch (current_extension) { case XF86VIDMODE: if (!setXF86VidModeMode(disp, screen, &avail_modes[i])) { - printfDebug("Could not switch mode\n"); + printfDebugJava(env, "Could not switch mode"); continue; } break; case XRANDR: if (!setXrandrMode(disp, screen, &avail_modes[i])) { - printfDebug("Could not switch mode\n"); + printfDebugJava(env, "Could not switch mode"); continue; } break; @@ -279,26 +279,26 @@ saved_gamma_ramp_length = 0; } -static int getGammaRampLengthOfDisplay(Display *disp, int screen) { +static int getGammaRampLengthOfDisplay(JNIEnv *env, Display *disp, int screen) { int ramp_size; - if (!isXF86VidModeSupported(disp)) { - printfDebug("XF86VidMode extension version >= 2 not found\n"); + if (!isXF86VidModeSupported(env, disp)) { + printfDebugJava(env, "XF86VidMode extension version >= 2 not found"); return 0; } if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { - printfDebug("XF86VidModeGetGammaRampSize call failed\n"); + printfDebugJava(env, "XF86VidModeGetGammaRampSize call failed"); return 0; } return ramp_size; } -int getGammaRampLength(int screen) { +int getGammaRampLength(JNIEnv *env, int screen) { Display *disp = XOpenDisplay(NULL); if (disp == NULL) { - printfDebug("Could not open display"); + printfDebugJava(env, "Could not open display"); return 0; } - int length = getGammaRampLengthOfDisplay(disp, screen); + int length = getGammaRampLengthOfDisplay(env, disp, screen); XCloseDisplay(disp); return length; } @@ -312,7 +312,7 @@ return NULL; } - current_extension = getBestDisplayModeExtension(disp); + current_extension = getBestDisplayModeExtension(env, disp); if (current_extension == NONE) { throwException(env, "No display mode extension is available"); XCloseDisplay(disp); @@ -328,7 +328,7 @@ saved_height = current_height = avail_modes[0].height; saved_freq = current_freq = avail_modes[0].freq; int bpp = XDefaultDepth(disp, screen); - printfDebug("Original display dimensions: width %d, height %d freq %d\n", saved_width, saved_height, saved_freq); + printfDebugJava(env, "Original display dimensions: width %d, height %d freq %d", saved_width, saved_height, saved_freq); jclass jclass_DisplayMode = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); jmethodID ctor = (*env)->GetMethodID(env, jclass_DisplayMode, "<init>", "(IIII)V"); jobject newMode = (*env)->NewObject(env, jclass_DisplayMode, ctor, saved_width, saved_height, bpp, saved_freq); @@ -336,7 +336,7 @@ free(avail_modes); /* Fetch the current gamma ramp */ - saved_gamma_ramp_length = getGammaRampLengthOfDisplay(disp, screen); + saved_gamma_ramp_length = getGammaRampLengthOfDisplay(env, disp, screen); if (saved_gamma_ramp_length > 0) { r_ramp = (unsigned short *)malloc(sizeof(unsigned short)*saved_gamma_ramp_length); g_ramp = (unsigned short *)malloc(sizeof(unsigned short)*saved_gamma_ramp_length); @@ -363,18 +363,18 @@ if (env != NULL) throwException(env, "Could not set gamma ramp."); else - printfDebug("Could not set gamma ramp\n"); + printfDebugJava(env, "Could not set gamma ramp"); } } -void temporaryRestoreMode(int screen) { +void temporaryRestoreMode(JNIEnv *env, int screen) { Display *disp = XOpenDisplay(NULL); if (disp == NULL) { - printfDebug("Could not open display"); + printfDebugJava(env, "Could not open display"); return; } - if (!setMode(disp, screen, current_width, current_height, current_freq, false)) - printfDebug("Could not restore mode\n"); + if (!setMode(env, disp, screen, current_width, current_height, current_freq, false)) + printfDebugJava(env, "Could not restore mode"); setCurrentGamma(disp, screen, NULL); XCloseDisplay(disp); // Don't propagate error to caller @@ -397,17 +397,17 @@ throwException(env, "Could not open display"); return; } - if (!setMode(disp, screen, width, height, freq, false)) + if (!setMode(env, disp, screen, width, height, freq, false)) throwException(env, "Could not switch mode."); XCloseDisplay(disp); } -void resetDisplayMode(int screen, bool temporary) { +void resetDisplayMode(JNIEnv *env, int screen, bool temporary) { Display *disp = XOpenDisplay(NULL); if (disp == NULL) return; - if (!setMode(disp, screen, saved_width, saved_height, saved_freq, temporary)) { - printfDebug("Failed to reset mode"); + if (!setMode(env, disp, screen, saved_width, saved_height, saved_freq, temporary)) { + printfDebugJava(env, "Failed to reset mode"); } if (saved_gamma_ramp_length > 0) { XF86VidModeSetGammaRamp(disp, screen, saved_gamma_ramp_length, r_ramp, g_ramp, b_ramp); @@ -428,7 +428,7 @@ int bpp = XDefaultDepth(disp, screen); avail_modes = getDisplayModes(disp, screen, &num_modes); if (avail_modes == NULL) { - printfDebug("Could not get display modes\n"); + printfDebugJava(env, "Could not get display modes"); XCloseDisplay(disp); return NULL; } @@ -453,7 +453,7 @@ return; } freeCurrentGamma(); - current_gamma_ramp_length = getGammaRampLengthOfDisplay(disp, screen); + current_gamma_ramp_length = getGammaRampLengthOfDisplay(env, disp, screen); if (current_gamma_ramp_length == 0) { throwException(env, "Gamma ramp not supported"); return; Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- org_lwjgl_opengl_Display.c 11 Dec 2004 19:44:53 -0000 1.14 +++ org_lwjgl_opengl_Display.c 11 Dec 2004 20:09:04 -0000 1.15 @@ -199,7 +199,7 @@ XChangeProperty (getDisplay(), getCurrentWindow(), motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long)); } -bool releaseInput(void) { +static bool releaseInput(JNIEnv *env) { if (isLegacyFullscreen() || input_released) return false; input_released = true; @@ -207,19 +207,19 @@ updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { XIconifyWindow(getDisplay(), getCurrentWindow(), getCurrentScreen()); - resetDisplayMode(getCurrentScreen(), true); + resetDisplayMode(env, getCurrentScreen(), true); } return true; } -static void acquireInput(void) { +static void acquireInput(JNIEnv *env) { if (isLegacyFullscreen() || !input_released) return; input_released = false; setRepeatMode(AutoRepeatModeOff); updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { - temporaryRestoreMode(getCurrentScreen()); + temporaryRestoreMode(env, getCurrentScreen()); } } @@ -246,20 +246,20 @@ } } -static void checkInput(void) { +static void checkInput(JNIEnv *env) { Window win; int revert_mode; XGetInputFocus(getDisplay(), &win, &revert_mode); if (win == current_win) { - acquireInput(); + acquireInput(env); focused = true; } else { - releaseInput(); + releaseInput(env); focused = false; } } -void handleMessages(void) { +void handleMessages(JNIEnv *env) { XEvent event; /* Window win; int revert_mode;*/ @@ -310,7 +310,7 @@ break; } } - checkInput(); + checkInput(env); } static void setWindowTitle(const char *title) { @@ -439,7 +439,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_update (JNIEnv *env, jobject this) { - handleMessages(); + handleMessages(env); } static bool makeCurrent(void) { @@ -676,11 +676,11 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetDisplayMode(JNIEnv *env, jobject this) { - resetDisplayMode(getCurrentScreen(), false); + resetDisplayMode(env, getCurrentScreen(), false); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getGammaRampLength(JNIEnv *env, jobject this) { - return (jint)getGammaRampLength(getCurrentScreen()); + return (jint)getGammaRampLength(env, getCurrentScreen()); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setGammaRamp(JNIEnv *env, jobject this, jobject gamma_buffer) { Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- org_lwjgl_input_Mouse.c 11 Dec 2004 11:29:07 -0000 1.26 +++ org_lwjgl_input_Mouse.c 11 Dec 2004 20:09:04 -0000 1.27 @@ -365,7 +365,7 @@ int coords_length = (*env)->GetDirectBufferCapacity(env, coord_buffer_obj); unsigned char *buttons_buffer = (unsigned char *)(*env)->GetDirectBufferAddress(env, button_buffer_obj); int buttons_length = (*env)->GetDirectBufferCapacity(env, button_buffer_obj); - handleMessages(); + handleMessages(env); if (coords_length < 3) { printfDebug("ERROR: Not enough space in coords array: %d < 3\n", coords_length); return; @@ -394,7 +394,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_readMouse(JNIEnv *env, jobject this, jobject buffer, jint buffer_position) { jint* buffer_ptr = (jint *)(*env)->GetDirectBufferAddress(env, buffer); int buffer_size = ((*env)->GetDirectBufferCapacity(env, buffer))/sizeof(jint) - buffer_position; - handleMessages(); + handleMessages(env); return copyEvents(&event_queue, buffer_ptr + buffer_position, buffer_size); } |
|
From: Elias N. <eli...@us...> - 2004-12-11 20:09:12
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14152/common Modified Files: common_tools.c Log Message: Added java debug output to linux display.c Index: common_tools.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- common_tools.c 11 Dec 2004 19:44:52 -0000 1.9 +++ common_tools.c 11 Dec 2004 20:09:02 -0000 1.10 @@ -80,7 +80,7 @@ buffer[BUFFER_SIZE - 1] = '\0'; jstring str = (*env)->NewStringUTF(env, buffer); jclass org_lwjgl_Sys_class = (*env)->FindClass(env, "org/lwjgl/Sys"); - jmethodID log_method = (*env)->GetMethodID(env, org_lwjgl_Sys_class, "log", "(Ljava/lang/String;)V"); + jmethodID log_method = (*env)->GetStaticMethodID(env, org_lwjgl_Sys_class, "log", "(Ljava/lang/String;)V"); (*env)->CallStaticVoidMethod(env, org_lwjgl_Sys_class, log_method, str); } va_end(ap); |
|
From: Elias N. <eli...@us...> - 2004-12-11 19:45:05
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9017/common Modified Files: common_tools.c common_tools.h Log Message: Tweaked linux native isActive() and added printfDebugJava to print debug from native through Sys.log Index: common_tools.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- common_tools.c 14 Nov 2004 10:42:16 -0000 1.8 +++ common_tools.c 11 Dec 2004 19:44:52 -0000 1.9 @@ -70,6 +70,22 @@ debug = enable; } +void printfDebugJava(JNIEnv *env, const char *format, ...) { + #define BUFFER_SIZE 4000 + static char buffer[BUFFER_SIZE]; + va_list ap; + va_start(ap, format); + if (isDebugEnabled()) { + vsnprintf(buffer, BUFFER_SIZE, format, ap); + buffer[BUFFER_SIZE - 1] = '\0'; + jstring str = (*env)->NewStringUTF(env, buffer); + jclass org_lwjgl_Sys_class = (*env)->FindClass(env, "org/lwjgl/Sys"); + jmethodID log_method = (*env)->GetMethodID(env, org_lwjgl_Sys_class, "log", "(Ljava/lang/String;)V"); + (*env)->CallStaticVoidMethod(env, org_lwjgl_Sys_class, log_method, str); + } + va_end(ap); +} + void printfDebug(const char *format, ...) { va_list ap; va_start(ap, format); Index: common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- common_tools.h 14 Nov 2004 11:39:53 -0000 1.31 +++ common_tools.h 11 Dec 2004 19:44:53 -0000 1.32 @@ -130,6 +130,7 @@ extern void throwOpenALException(JNIEnv * env, const char * err); extern void throwFMODException(JNIEnv * env, const char * err); extern void setDebugEnabled(bool enable); +extern void printfDebugJava(JNIEnv *env, const char *format, ...); extern void printfDebug(const char *format, ...); extern bool getBooleanProperty(JNIEnv *env, const char* propertyName); extern char * GetStringNativeChars(JNIEnv *env, jstring jstr); |
|
From: Elias N. <eli...@us...> - 2004-12-11 19:45:04
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9017/linux Modified Files: org_lwjgl_opengl_Display.c Log Message: Tweaked linux native isActive() and added printfDebugJava to print debug from native through Sys.log Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- org_lwjgl_opengl_Display.c 11 Dec 2004 11:21:01 -0000 1.13 +++ org_lwjgl_opengl_Display.c 11 Dec 2004 19:44:53 -0000 1.14 @@ -785,7 +785,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isActive (JNIEnv *env, jobject this) { - return focused ? JNI_TRUE : JNI_FALSE; + return focused || isLegacyFullscreen() ? JNI_TRUE : JNI_FALSE; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setVSyncEnabled |
|
From: Elias N. <eli...@us...> - 2004-12-11 16:45:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2840/opengl Modified Files: Display.java Log Message: Added initial mode debug output Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- Display.java 25 Nov 2004 22:31:38 -0000 1.33 +++ Display.java 11 Dec 2004 16:44:56 -0000 1.34 @@ -93,6 +93,7 @@ Sys.initialize(); display_impl = createDisplayImplementation(); current_mode = initial_mode = display_impl.init(); + Sys.log("Initial mode: " + initial_mode); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { reset(); |
|
From: Elias N. <eli...@us...> - 2004-12-11 11:29:15
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6464 Modified Files: org_lwjgl_input_Mouse.c Log Message: More linux fixes Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- org_lwjgl_input_Mouse.c 11 Dec 2004 11:21:01 -0000 1.25 +++ org_lwjgl_input_Mouse.c 11 Dec 2004 11:29:07 -0000 1.26 @@ -130,7 +130,7 @@ static void updateCursor(void) { Cursor cursor; - if (isGrabbed()) { + if (shouldGrab()) { cursor = blank_cursor; } else { cursor = current_cursor; |
|
From: Elias N. <eli...@us...> - 2004-12-11 11:21:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4970 Modified Files: Window.h org_lwjgl_input_Mouse.c org_lwjgl_opengl_Display.c Log Message: More linux fixes Index: Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Window.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Window.h 10 Dec 2004 19:49:11 -0000 1.22 +++ Window.h 11 Dec 2004 11:21:01 -0000 1.23 @@ -69,6 +69,7 @@ extern void updatePointerGrab(void); extern void updateKeyboardGrab(void); extern void setGrab(bool); + extern bool isGrabbed(void); extern bool shouldGrab(void); /* Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_Display.c 10 Dec 2004 19:49:11 -0000 1.12 +++ org_lwjgl_opengl_Display.c 11 Dec 2004 11:21:01 -0000 1.13 @@ -235,6 +235,10 @@ return !input_released && grab; } +bool isGrabbed(void) { + return grab; +} + void setGrab(bool new_grab) { if (new_grab != grab) { grab = new_grab; Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- org_lwjgl_input_Mouse.c 11 Dec 2004 11:11:23 -0000 1.24 +++ org_lwjgl_input_Mouse.c 11 Dec 2004 11:21:01 -0000 1.25 @@ -80,7 +80,7 @@ } static bool putMouseEvent(jint button, jint state, jint dz) { - if (shouldGrab()) + if (isGrabbed()) return putMouseEventWithCoords(button, state, 0, 0, dz); else return putMouseEventWithCoords(button, state, last_x, last_y, dz); @@ -98,7 +98,7 @@ accum_dy += dy; last_x = x; last_y = y; - if (shouldGrab()) { + if (isGrabbed()) { putMouseEventWithCoords(-1, 0, dx, dy, 0); } else { putMouseEventWithCoords(-1, 0, x, y, 0); @@ -130,7 +130,7 @@ static void updateCursor(void) { Cursor cursor; - if (shouldGrab()) { + if (isGrabbed()) { cursor = blank_cursor; } else { cursor = current_cursor; @@ -370,7 +370,7 @@ printfDebug("ERROR: Not enough space in coords array: %d < 3\n", coords_length); return; } - if (shouldGrab()) { + if (isGrabbed()) { coords[0] = accum_dx; coords[1] = accum_dy; } else { |
|
From: Elias N. <eli...@us...> - 2004-12-11 11:11:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3172 Modified Files: org_lwjgl_input_Mouse.c Log Message: Linux: Fix more mouse handling bugs Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- org_lwjgl_input_Mouse.c 11 Dec 2004 08:10:44 -0000 1.23 +++ org_lwjgl_input_Mouse.c 11 Dec 2004 11:11:23 -0000 1.24 @@ -80,7 +80,7 @@ } static bool putMouseEvent(jint button, jint state, jint dz) { - if (pointer_grabbed) + if (shouldGrab()) return putMouseEventWithCoords(button, state, 0, 0, dz); else return putMouseEventWithCoords(button, state, last_x, last_y, dz); @@ -370,7 +370,7 @@ printfDebug("ERROR: Not enough space in coords array: %d < 3\n", coords_length); return; } - if (pointer_grabbed) { + if (shouldGrab()) { coords[0] = accum_dx; coords[1] = accum_dy; } else { |
|
From: Elias N. <eli...@us...> - 2004-12-11 10:50:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31840 Modified Files: MacOSXFrame.java Log Message: Mac OS X: Added support for org.lwjgl.opengl.Window.undecorated Index: MacOSXFrame.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- MacOSXFrame.java 25 Nov 2004 22:31:38 -0000 1.5 +++ MacOSXFrame.java 11 Dec 2004 10:50:05 -0000 1.6 @@ -69,7 +69,8 @@ addComponentListener(this); canvas = new MacOSXGLCanvas(); add(canvas, BorderLayout.CENTER); - setUndecorated(fullscreen); + boolean undecorated = Boolean.getBoolean("org.lwjgl.opengl.Window.undecorated"); + setUndecorated(fullscreen || undecorated); if ( fullscreen ) { getDevice().setFullScreenWindow(this); getDevice().setDisplayMode(requested_mode); |
|
From: Elias N. <eli...@us...> - 2004-12-11 10:47:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31341/native/macosx Modified Files: org_lwjgl_opengl_Display.m Log Message: Support org.lwjgl.opengl.Window.allowSoftwareOpenGL on Mac OS X Index: org_lwjgl_opengl_Display.m =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_opengl_Display.m 18 Nov 2004 12:10:28 -0000 1.5 +++ org_lwjgl_opengl_Display.m 11 Dec 2004 10:47:21 -0000 1.6 @@ -69,8 +69,10 @@ bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); attrib_list_t attribs; + jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Window.allowSoftwareOpenGL"); initAttribList(&attribs); - putAttrib(&attribs, NSOpenGLPFAAccelerated); + if (!allow_software_acceleration) + putAttrib(&attribs, NSOpenGLPFAAccelerated); if (double_buffered) putAttrib(&attribs, NSOpenGLPFADoubleBuffer); putAttrib(&attribs, NSOpenGLPFAColorSize); putAttrib(&attribs, bpp); |
|
From: Elias N. <eli...@us...> - 2004-12-11 08:10:54
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3516 Modified Files: org_lwjgl_input_Mouse.c Log Message: Improved fullscreen pointer handling Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- org_lwjgl_input_Mouse.c 10 Dec 2004 19:49:11 -0000 1.22 +++ org_lwjgl_input_Mouse.c 11 Dec 2004 08:10:44 -0000 1.23 @@ -98,7 +98,7 @@ accum_dy += dy; last_x = x; last_y = y; - if (pointer_grabbed) { + if (shouldGrab()) { putMouseEventWithCoords(-1, 0, dx, dy, 0); } else { putMouseEventWithCoords(-1, 0, x, y, 0); |
|
From: Mark B. <cap...@us...> - 2004-12-11 02:14:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/devil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9686/src/java/org/lwjgl/test/devil Modified Files: BasicTest.java Log Message: Test for DevIL library. Index: BasicTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/devil/BasicTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- BasicTest.java 12 Nov 2004 03:37:34 -0000 1.3 +++ BasicTest.java 11 Dec 2004 02:14:07 -0000 1.4 @@ -52,22 +52,36 @@ e.printStackTrace(); System.exit(0); } + int err = IL.ilGetError(); + System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR); System.out.println("ilGenImages"); IntBuffer im = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); IL.ilGenImages(1, im); System.out.println("ilBindImage"); IL.ilBindImage(im.get(0)); - System.out.println("ilLoadImage"); - IL.ilLoadImage("F:/Apps/Java/eclipse/workspace/LWJGL/res/spaceinvaders/alien2.gif"); - System.out.println("ilGetError"); - int err = IL.ilGetError(); + err = IL.ilGetError(); System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR); + String imageFile = "F:/Apps/Java/eclipse/workspace/LWJGL/res/ILtest.tga"; + System.out.println("ilLoadImage " + imageFile); + System.out.println("load lump = " + IL.ilLoadFromURL(BasicTest.class.getResource("/res/ILtest.tga"))); + err = IL.ilGetError(); + System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR); + int newIm = IL.ilCloneCurImage(); + IL.ilCopyImage(im.get(0)); + IL.ilBindImage(newIm); ByteBuffer buf = IL.ilGetData(); + System.out.println("ilGetData"); + err = IL.ilGetError(); + System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR); int limit = buf.limit(); System.out.println("limit = " + limit); + for(int i=0;i<buf.limit();i+=3) { + System.out.println(buf.get(i) + " " + buf.get(i + 1) + " " + buf.get(i + 2)); + } + System.out.println("current image = " + im.get(0) + " IL.ilGetInteger(IL.IL_ACTIVE_IMAGE) = " + IL.ilGetInteger(IL.IL_ACTIVE_IMAGE)); System.out.println("Version: " + IL.ilGetInteger(IL.IL_VERSION_NUM)); - System.out.println(IL.ilActiveImage(im.get(0))); - System.out.println(IL.ilClearImage()); + err = IL.ilGetError(); + System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR); } } |
|
From: Mark B. <cap...@us...> - 2004-12-11 01:56:07
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6568/src/java/org/lwjgl/devil Modified Files: IL.java Log Message: Added load methods to read from a stream and URL Index: IL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/IL.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- IL.java 8 Dec 2004 19:16:28 -0000 1.5 +++ IL.java 11 Dec 2004 01:55:49 -0000 1.6 @@ -31,6 +31,10 @@ */ package org.lwjgl.devil; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -45,7 +49,7 @@ * @version $Revision$ */ public class IL { - + private static final int BUFFER_LENGTH = 1000; /** Have we been created? */ protected static boolean created; @@ -62,11 +66,11 @@ public static final int IL_LUMINANCE = 0x1909; public static final int IL_BYTE = 0x1400; - public static final int IL_UNSIGNED_BYTE = 0x1401; +// public static final int IL_UNSIGNED_BYTE = 0x1401; public static final int IL_SHORT = 0x1402; - public static final int IL_UNSIGNED_SHORT = 0x1403; +// public static final int IL_UNSIGNED_SHORT = 0x1403; public static final int IL_INT = 0x1404; - public static final int IL_UNSIGNED_INT = 0x1405; +// public static final int IL_UNSIGNED_INT = 0x1405; public static final int IL_FLOAT = 0x1406; public static final int IL_DOUBLE = 0x140A; @@ -374,6 +378,123 @@ //ilLoadF() uses a Windows file handle so will not be implemented // public static native boolean ilLoadF(int Type, ILHANDLE File); public static native boolean ilLoadImage(String fileName); + public static boolean ilLoadFromURL(URL url) { + boolean result = false; + int type = IL_TYPE_UNKNOWN; + + String file = url.toString(); + int index = file.lastIndexOf('.'); + if(index != -1) { + String extension = file.substring(index + 1); + if(extension.equalsIgnoreCase("bmp")) { + type = IL_BMP; + } + else if(extension.equalsIgnoreCase("cut")) { + type = IL_CUT; + } + else if(extension.equalsIgnoreCase("gif")) { + type = IL_GIF; + } + else if(extension.equalsIgnoreCase("ico")) { + type = IL_ICO; + } + else if(extension.equalsIgnoreCase("jpg")) { + type = IL_JPG; + } + else if(extension.equalsIgnoreCase("lif")) { + type = IL_LIF; + } + else if(extension.equalsIgnoreCase("mng")) { + type = IL_MNG; + } + else if(extension.equalsIgnoreCase("pcd")) { + type = IL_PCD; + } + else if(extension.equalsIgnoreCase("pcx")) { + type = IL_PCX; + } + else if(extension.equalsIgnoreCase("pic")) { + type = IL_PIC; + } + else if(extension.equalsIgnoreCase("png")) { + type = IL_PNG; + } + else if(extension.equalsIgnoreCase("pbm") || + extension.equalsIgnoreCase("pgm") || + extension.equalsIgnoreCase("ppm")) { + type = IL_PNM; + } + else if(extension.equalsIgnoreCase("psd")) { + type = IL_PSD; + } + else if(extension.equalsIgnoreCase("psp")) { + type = IL_PSP; + } + else if(extension.equalsIgnoreCase("bw") || + extension.equalsIgnoreCase("rgb") || + extension.equalsIgnoreCase("rgba") || + extension.equalsIgnoreCase("sgi")) { + type = IL_SGI; + } + else if(extension.equalsIgnoreCase("tga")) { + type = IL_TGA; + } + else if(extension.equalsIgnoreCase("tif") || + extension.equalsIgnoreCase("tiff")) { + type = IL_TIF; + } + } + + try { + result = ilLoadFromStream(url.openStream(), type); + } + catch(IOException e) { + e.printStackTrace(); + result = false; + } + + return result; + } + public static boolean ilLoadFromStream(InputStream stream, int type) { + boolean result = false; + int bufferLength = BUFFER_LENGTH; + int lastRead = 0; + byte read[] = new byte[bufferLength]; + byte block[] = new byte[0]; + + BufferedInputStream buf = new BufferedInputStream(stream); + try { + do { + lastRead = buf.read(read); + if(lastRead != -1) { + block = appendByteArray(block, read, lastRead); + } + } while(lastRead != -1); + ByteBuffer lump = ByteBuffer.allocateDirect(block.length); + lump.put(block); + lump.flip(); + result = ilLoadL(type, lump, block.length); + } + catch(IOException e) { + e.printStackTrace(); + result = false; + } + + return result; + } + private static byte[] appendByteArray(byte oldArray[], byte copyArray[], int length) { + int oldLength = oldArray.length; + byte newArray[] = new byte[oldLength + length]; + + for(int i=0;i<oldLength;i++) { + newArray[i] = oldArray[i]; + } + for(int i=0;i<length;i++) { + newArray[i + oldLength] = copyArray[i]; + } + + return newArray; + } public static boolean ilLoadL(int Type, ByteBuffer Lump, int Size) { BufferChecks.checkDirect(Lump); return nilLoadL(Type, Lump, Lump.position(), Size); |