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
|
4
|
5
|
6
(7) |
7
(5) |
8
(14) |
|
9
(10) |
10
(6) |
11
|
12
(7) |
13
(1) |
14
(1) |
15
|
|
16
|
17
(2) |
18
|
19
|
20
(5) |
21
|
22
|
|
23
|
24
(1) |
25
|
26
(2) |
27
|
28
|
|
|
From: Brian M. <ma...@us...> - 2003-02-08 23:25:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv26695 Modified Files: org_lwjgl_Display.cpp org_lwjgl_opengl_BaseGL.cpp Log Message: fix: moved handleMessages to its rightfull place 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.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- org_lwjgl_Display.cpp 8 Feb 2003 23:01:58 -0000 1.20 +++ org_lwjgl_Display.cpp 8 Feb 2003 23:25:11 -0000 1.21 @@ -49,7 +49,7 @@ #define WINDOWCLASSNAME "LWJGLWINDOW" -extern void handleMessages(); +void handleMessages(); extern HINSTANCE dll_handle; // Initialise static variables @@ -180,6 +180,37 @@ // default action return DefWindowProc(hWnd, msg, wParam, lParam); } + +/* + * Handle windowing messages sent by the operating system + */ +void handleMessages() +{ + /* + * Now's our chance to deal with Windows messages that are + * otherwise just piling up and causing everything not to + * work properly + */ + MSG msg; + while (PeekMessage( + &msg, // message information + hwnd, // handle to window + 0, // first message + 0, // last message + PM_NOREMOVE // removal options + )) { + + if (GetMessage (&msg, NULL, 0, 0) <= 0) { +#ifdef _DEBUG + printf("We should quit here...\n"); +#endif + return; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + }; +} + /* * Sets the fullscreen display mode. 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.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_opengl_BaseGL.cpp 7 Feb 2003 21:53:39 -0000 1.11 +++ org_lwjgl_opengl_BaseGL.cpp 8 Feb 2003 23:25:11 -0000 1.12 @@ -46,39 +46,7 @@ HGLRC hglrc = NULL; // OpenGL rendering context extern HDC hdc; extern HWND hwnd; - - - -/* - * Handle windowing messages sent by the operating system - */ -void handleMessages() -{ - /* - * Now's our chance to deal with Windows messages that are - * otherwise just piling up and causing everything not to - * work properly - */ - MSG msg; - while (PeekMessage( - &msg, // message information - hwnd, // handle to window - 0, // first message - 0, // last message - PM_NOREMOVE // removal options - )) { - - if (GetMessage (&msg, NULL, 0, 0) <= 0) { -#ifdef _DEBUG - printf("We should quit here...\n"); -#endif - return; - } - TranslateMessage(&msg); - DispatchMessage(&msg); - }; -} - +extern void handleMessages(); /* * Class: org_lwjgl_opengl_BaseGL |
|
From: Brian M. <ma...@us...> - 2003-02-08 23:02:03
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv19034 Modified Files: org_lwjgl_Display.cpp Log Message: add: close button enabled 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.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- org_lwjgl_Display.cpp 8 Feb 2003 19:30:53 -0000 1.19 +++ org_lwjgl_Display.cpp 8 Feb 2003 23:01:58 -0000 1.20 @@ -59,6 +59,9 @@ LPDIRECTINPUT lpdi = NULL; bool isMinimized = false; bool isFullscreen = false; +JNIEnv* environment; +jclass clsDisplay; +jfieldID fidclose; void destroyDI(void) { @@ -148,6 +151,12 @@ case SC_RESTORE: isMinimized = false; appActivate(false); + break; + case SC_CLOSE: + environment->SetStaticBooleanField(clsDisplay, fidclose, true); + //don't continue processing this command since this + //would shutdown the window, which the application might not want to + return 0L; default: break; } @@ -276,6 +285,10 @@ (JNIEnv * env, jclass clazz, jint width, jint height, jint bpp, jint freq, jint alphaBits, jint depthBits, jint stencilBits, jboolean fullscreen, jstring title) { + environment = env; + clsDisplay = clazz; + fidclose = env->GetStaticFieldID(clsDisplay, "closeRequested", "Z"); + #ifdef _DEBUG printf("Creating display: size %dx%d %dhz %dbpp...\n", width, height, freq, bpp); #endif @@ -351,10 +364,6 @@ dll_handle, NULL); env->ReleaseStringUTFChars(title, titleString); - - // Disable close button - HMENU SysMen = GetSystemMenu(hwnd, false); - EnableMenuItem(SysMen, SC_CLOSE, MF_BYCOMMAND | MF_DISABLED); // And we never look at windowClass again... |
|
From: Brian M. <ma...@us...> - 2003-02-08 23:01:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv18876 Modified Files: Display.java Log Message: add: close button enabled Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Display.java 7 Feb 2003 21:50:02 -0000 1.12 +++ Display.java 8 Feb 2003 23:01:28 -0000 1.13 @@ -57,6 +57,9 @@ /** A pointer to the native display window. On Windows this will be an hWnd. */ private static int handle; + + /** Whether or not the display has been requested to shutdown by the user */ + public static boolean closeRequested = false; /** * No construction allowed. @@ -214,5 +217,4 @@ * @return true if the display is minimized */ public static native boolean isMinimized(); - -} +} \ No newline at end of file |
|
From: Brian M. <ma...@us...> - 2003-02-08 23:00:44
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv18572 Modified Files: org_lwjgl_Display.h Log Message: add: close button enabled Index: org_lwjgl_Display.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Display.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Display.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_Display.h 7 Feb 2003 21:51:16 -0000 1.4 +++ org_lwjgl_Display.h 8 Feb 2003 23:00:36 -0000 1.5 @@ -11,6 +11,7 @@ /* Inaccessible static: created */ /* Inaccessible static: mode */ /* Inaccessible static: handle */ +/* Inaccessible static: closeRequested */ /* Inaccessible static: class_000240 */ /* * Class: org_lwjgl_Display @@ -43,7 +44,6 @@ */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_isMinimized (JNIEnv *, jclass); - #ifdef __cplusplus } |
|
From: Elias N. <eli...@us...> - 2003-02-08 20:36:35
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv30211/linux Modified Files: org_lwjgl_input_Mouse.cpp Log Message: Updated linux files to recent mouse and display changes Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_input_Mouse.cpp 8 Feb 2003 19:55:07 -0000 1.11 +++ org_lwjgl_input_Mouse.cpp 8 Feb 2003 20:36:31 -0000 1.12 @@ -62,10 +62,12 @@ static bool pointer_grabbed; -static jfieldID fid_button; -static jfieldID fid_dx; -static jfieldID fid_dy; -static jfieldID fid_dz; +static jfieldID fid_has_wheel = NULL; +static jfieldID fid_button_count = NULL; +static jfieldID fid_buttons = NULL; +static jfieldID fid_dx = NULL; +static jfieldID fid_dy = NULL; +static jfieldID fid_dwheel = NULL; static int last_x; static int last_y; @@ -85,26 +87,18 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_initIDs (JNIEnv * env, jclass clazz) { - // Get a global class instance, just to be sure - static jobject globalClassLock = NULL; - - if (globalClassLock == NULL) { - globalClassLock = env->NewGlobalRef(clazz); - } - - // Now cache the field IDs: - if (fid_button == NULL) { - fid_button = env->GetStaticFieldID(clazz, "button", "[Z"); - } - if (fid_dx == NULL) { + if (fid_has_wheel == NULL) + fid_has_wheel = env->GetStaticFieldID(clazz, "hasWheel", "Z"); + if (fid_button_count == NULL) + fid_button_count = env->GetStaticFieldID(clazz, "buttonCount", "I"); + if (fid_buttons == NULL) + fid_buttons = env->GetStaticFieldID(clazz, "buttons", "[Z"); + if (fid_dx == NULL) fid_dx = env->GetStaticFieldID(clazz, "dx", "I"); - } - if (fid_dy == NULL) { + if (fid_dy == NULL) fid_dy = env->GetStaticFieldID(clazz, "dy", "I"); - } - if (fid_dz == NULL) { - fid_dz = env->GetStaticFieldID(clazz, "dz", "I"); - } + if (fid_dwheel == NULL) + fid_dwheel = env->GetStaticFieldID(clazz, "dwheel", "I"); } int blankCursor(void) { @@ -172,9 +166,13 @@ { int i; + jbooleanArray buttons_array = env->NewBooleanArray(NUM_BUTTONS); + env->SetStaticObjectField(clazz, fid_buttons, buttons_array); + env->SetStaticIntField(clazz, fid_button_count, NUM_BUTTONS); + env->SetStaticBooleanField(clazz, fid_has_wheel, JNI_TRUE); current_x = current_y = current_z = last_x = last_y = last_z = pointer_grabbed = 0; for (i = 0; i < NUM_BUTTONS; i++) - buttons[i] = 0; + buttons[i] = JNI_FALSE; if (!blankCursor()) { #ifdef _DEBUG printf("Could create blank cursor\n"); @@ -192,25 +190,6 @@ /* * Class: org_lwjgl_input_Mouse - * Method: nGetNumButtons - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNumButtons(JNIEnv *env, jclass clazz) { - return (jint)NUM_BUTTONS; -} - -/* - * Class: org_lwjgl_input_Mouse - * Method: nHasZValue - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nHasZValue(JNIEnv *env, jclass clazz) { - return JNI_TRUE; -} - - -/* - * Class: org_lwjgl_input_Mouse * Method: nDestroy * Signature: ()V */ @@ -318,12 +297,12 @@ int moved_z = current_z - last_z; env->SetStaticIntField(clazz, fid_dx, (jint)moved_x); env->SetStaticIntField(clazz, fid_dy, (jint)moved_y); - env->SetStaticIntField(clazz, fid_dz, (jint)moved_z); + env->SetStaticIntField(clazz, fid_dwheel, (jint)moved_z); last_x = current_x; last_y = current_y; last_z = current_z; - jbooleanArray buttonsArray = (jbooleanArray) env->GetStaticObjectField(clazz, fid_button); - env->SetBooleanArrayRegion(buttonsArray, 0, NUM_BUTTONS, buttons); + jbooleanArray buttons_array = (jbooleanArray)env->GetStaticObjectField(clazz, fid_buttons); + env->SetBooleanArrayRegion(buttons_array, 0, NUM_BUTTONS, buttons); if (isFullscreen()) warpPointer(); } |
|
From: Elias N. <eli...@us...> - 2003-02-08 19:55:11
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv15046/src/native/linux Modified Files: org_lwjgl_Display.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_BaseGL.cpp Log Message: Added isMinimized to linux Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- org_lwjgl_Display.cpp 6 Feb 2003 20:40:41 -0000 1.14 +++ org_lwjgl_Display.cpp 8 Feb 2003 19:55:06 -0000 1.15 @@ -47,20 +47,22 @@ #include <X11/Xutil.h> #include <stdio.h> #include <stdlib.h> +#include <assert.h> #include <jni.h> #include "org_lwjgl_Display.h" - Display * disp; int screen; -int current_fullscreen; -int current_focused; Window win; -int win_width; -int win_height; -XF86VidModeModeInfo **avail_modes; -XVisualInfo * vis_info; -int gl_loaded = 0; + +static bool current_fullscreen; +static bool current_focused; +static bool current_minimized; +static int win_width; +static int win_height; +static XF86VidModeModeInfo **avail_modes; +static XVisualInfo * vis_info; +static bool gl_loaded = false; struct pixelformat { int bpp; @@ -188,32 +190,41 @@ } while ((event.type != MapNotify) || (event.xmap.event != win)); } -int isFocused(void) { +void handleMessages(void) { XEvent event; - while (XCheckMaskEvent(disp, EnterWindowMask | LeaveWindowMask, &event)) { - if (event.type == EnterNotify) - current_focused = 1; - else if (event.type == LeaveNotify) - current_focused = 0; + while (XCheckMaskEvent(disp, EnterWindowMask | LeaveWindowMask | StructureNotifyMask, &event)) { + switch (event.type) { + case EnterNotify: + current_focused = true; + break; + case LeaveNotify: + current_focused = false; + break; + case MapNotify: + current_minimized = false; + break; + case UnmapNotify: + current_minimized = true; + break; + } } - return current_focused; } -int loadGL(Display *disp, int screen) { - if (gl_loaded == 1) - return JNI_TRUE; +bool loadGL(Display *disp, int screen) { + if (gl_loaded == true) + return true; if (extgl_Open(disp, screen) != 0) { #ifdef _DEBUG printf("Could not load gl libs\n"); #endif - return JNI_FALSE; + return false; } - gl_loaded = 1; - return JNI_TRUE; + gl_loaded = true; + return true; } void closeGL(void) { - gl_loaded = 0; + gl_loaded = false; extgl_Close(); } @@ -234,6 +245,41 @@ return 1; } +bool isFullscreen(void) { + return current_fullscreen; +} + +bool isFocused(void) { + handleMessages(); + return current_focused; +} + +bool isMinimized(void) { + handleMessages(); + return current_minimized; +} + +int getWindowHeight(void) { + return win_height; +} + +int getWindowWidth(void) { + return win_width; +} + +XVisualInfo *getVisualInfo(void) { + return vis_info; +} + +/* + * Class: org_lwjgl_Display + * Method: isMinimized + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_isMinimized(JNIEnv *env, jclass clazz) { + return isMinimized() ? JNI_TRUE : JNI_FALSE; +} + JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass clazz, jint width, jint height, jint bpp, jint freq, jint alpha_bits, jint depth_bits, jint stencil_bits, jboolean fullscreen, jstring title) { Window root_win; XSetWindowAttributes attribs; @@ -243,8 +289,12 @@ win_width = width; win_height = height; - current_fullscreen = fullscreen; - current_focused = 0; + if (fullscreen == JNI_TRUE) + current_fullscreen = true; + else + current_fullscreen = false; + current_minimized = false; + current_focused = false; disp = XOpenDisplay(NULL); if (disp == NULL) { #ifdef _DEBUG @@ -253,7 +303,7 @@ return JNI_FALSE; } screen = DefaultScreen(disp); - if (loadGL(disp, screen) != JNI_TRUE) { + if (!loadGL(disp, screen)) { #ifdef _DEBUG printf("Could not load GL libs\n"); #endif @@ -278,7 +328,7 @@ cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone); attribs.colormap = cmap; - attribs.event_mask = StructureNotifyMask | EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; + attribs.event_mask = VisibilityChangeMask| StructureNotifyMask | EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; attribs.background_pixel = 0xFF000000; attribmask = CWColormap | CWBackPixel | CWEventMask; if (fullscreen) { @@ -359,7 +409,7 @@ XCloseDisplay(disp); return NULL; } - if (loadGL(disp, screen) != JNI_TRUE) { + if (!loadGL(disp, screen)) { #ifdef _DEBUG printf("Could not load GL\n"); #endif Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_input_Keyboard.cpp 2 Feb 2003 22:49:16 -0000 1.11 +++ org_lwjgl_input_Keyboard.cpp 8 Feb 2003 19:55:07 -0000 1.12 @@ -50,24 +50,25 @@ #define KEYBOARD_SIZE 256 #define KEY_EVENT_BACKLOG 20 -unsigned char readBuffer[KEYBOARD_BUFFER_SIZE * 2]; -jfieldID fid_readBuffer; -unsigned char key_buf[KEYBOARD_SIZE]; -unsigned char key_map[KEYBOARD_SIZE]; +static unsigned char readBuffer[KEYBOARD_BUFFER_SIZE * 2]; +static jfieldID fid_readBuffer; +static unsigned char key_buf[KEYBOARD_SIZE]; +static unsigned char key_map[KEYBOARD_SIZE]; -XKeyEvent saved_key_events[KEY_EVENT_BACKLOG]; -int list_start = 0; -int list_end = 0; +static XKeyEvent saved_key_events[KEY_EVENT_BACKLOG]; +static int list_start = 0; +static int list_end = 0; -bool keyboard_grabbed; -bool buffer_enabled; -bool translation_enabled; +static bool keyboard_grabbed; +static bool buffer_enabled; +static bool translation_enabled; extern Display *disp; extern Window win; -extern int current_fullscreen; -extern int isFocused(void); +extern bool isFullscreen(void); + +extern bool isFocused(void); /* * Class: org_lwjgl_input_Keyboard @@ -100,7 +101,7 @@ } int updateKeyboardGrab(void) { - if (current_fullscreen) { + if (isFullscreen()) { if (!keyboard_grabbed) return grabKeyboard(); } else { Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_input_Mouse.cpp 12 Dec 2002 19:51:20 -0000 1.10 +++ org_lwjgl_input_Mouse.cpp 8 Feb 2003 19:55:07 -0000 1.11 @@ -55,28 +55,27 @@ extern Display *disp; extern Window win; extern int screen; -extern int current_fullscreen; -extern int win_width; -extern int win_height; - -bool pointer_grabbed; +extern bool isFullscreen(void); +extern bool isFocused(void); +extern int getWindowWidth(void); +extern int getWindowHeight(void); -jfieldID fid_button; -jfieldID fid_dx; -jfieldID fid_dy; -jfieldID fid_dz; +static bool pointer_grabbed; -int last_x; -int last_y; -int last_z; -int current_x; -int current_y; -int current_z; -unsigned char buttons[NUM_BUTTONS]; +static jfieldID fid_button; +static jfieldID fid_dx; +static jfieldID fid_dy; +static jfieldID fid_dz; -Cursor blank_cursor; +static int last_x; +static int last_y; +static int last_z; +static int current_x; +static int current_y; +static int current_z; +static unsigned char buttons[NUM_BUTTONS]; -extern int isFocused(void); +static Cursor blank_cursor; /* * Class: org_lwjgl_input_Mouse @@ -131,7 +130,7 @@ int grabPointer(void) { int result; int mask = EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask; - if (current_fullscreen) { + if (isFullscreen()) { result = XGrabPointer(disp, win, False, mask, GrabModeAsync, GrabModeAsync, win, blank_cursor, CurrentTime); XWarpPointer(disp, None, win, 0, 0, 0, 0, current_x, current_y); XF86VidModeSetViewPort(disp, screen, 0, 0); // make sure we have a centered window @@ -148,7 +147,7 @@ } int updatePointerGrab(void) { - if (current_fullscreen) { + if (isFullscreen()) { if (!pointer_grabbed) return grabPointer(); } else { @@ -281,9 +280,9 @@ int i; // Reset pointer to middle of screen if inside a certain inner border if (current_x < POINTER_WARP_BORDER || current_y < POINTER_WARP_BORDER || - current_x > win_width - POINTER_WARP_BORDER || current_y > win_height - POINTER_WARP_BORDER) { - current_x = last_x = win_width/2; - current_y = last_y = win_height/2; + current_x > getWindowWidth() - POINTER_WARP_BORDER || current_y > getWindowHeight() - POINTER_WARP_BORDER) { + current_x = last_x = getWindowWidth()/2; + current_y = last_y = getWindowHeight()/2; XWarpPointer(disp, None, win, 0, 0, 0, 0, current_x, current_y); XEvent event; // Try to catch the warp pointer event @@ -325,7 +324,7 @@ last_z = current_z; jbooleanArray buttonsArray = (jbooleanArray) env->GetStaticObjectField(clazz, fid_button); env->SetBooleanArrayRegion(buttonsArray, 0, NUM_BUTTONS, buttons); - if (current_fullscreen) + if (isFullscreen()) warpPointer(); } Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_opengl_BaseGL.cpp 19 Dec 2002 16:35:35 -0000 1.5 +++ org_lwjgl_opengl_BaseGL.cpp 8 Feb 2003 19:55:07 -0000 1.6 @@ -43,7 +43,7 @@ #include "org_lwjgl_opengl_BaseGL.h" GLXContext context = NULL; // OpenGL rendering context -extern XVisualInfo * vis_info; +extern XVisualInfo * getVisualInfo(void); extern Window win; extern Display * disp; @@ -64,13 +64,13 @@ (JNIEnv * env, jobject obj) { - if (!vis_info) { + if (!getVisualInfo()) { #ifdef _DEBUG printf("No visual info\n"); #endif return JNI_FALSE; } - context = glXCreateContext(disp, vis_info, NULL, True); + context = glXCreateContext(disp, getVisualInfo(), NULL, True); if (!context) { #ifdef _DEBUG printf("Could not create context\n"); |
|
From: Brian M. <ma...@us...> - 2003-02-08 19:37:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv8773 Modified Files: Game.java Log Message: fix: updated to reflect changes in new mouse Index: Game.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Game.java 6 Feb 2003 18:18:45 -0000 1.8 +++ Game.java 8 Feb 2003 19:37:09 -0000 1.9 @@ -120,9 +120,9 @@ angle = 0.0f; Mouse.poll(); - if (Mouse.dx != 0 || Mouse.dy != 0 || Mouse.dz != 0) - System.out.println("Mouse moved " + Mouse.dx + " " + Mouse.dy + " " + Mouse.dz); - for (int i = 0; i < 8; i++) + if (Mouse.dx != 0 || Mouse.dy != 0 || Mouse.dwheel != 0) + System.out.println("Mouse moved " + Mouse.dx + " " + Mouse.dy + " " + Mouse.dwheel); + for (int i = 0; i < Mouse.buttonCount; i++) if (Mouse.isButtonDown(i)) System.out.println("Button " + i + " down"); /* Keyboard.poll(); |
|
From: Brian M. <ma...@us...> - 2003-02-08 19:31:22
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv6529 Modified Files: org_lwjgl_input_Controller.cpp Log Message: mod: renaming of most methods/fields due to name clashes with Mouse fix: check for DIERR_NOTACQUIRED when loosing focus fix: check for controller failed, and would crash VM if no controller could be found Index: org_lwjgl_input_Controller.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Controller.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Controller.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_input_Controller.cpp 23 Jan 2003 21:38:33 -0000 1.4 +++ org_lwjgl_input_Controller.cpp 8 Feb 2003 19:31:19 -0000 1.5 @@ -45,73 +45,75 @@ #define DIRECTINPUT_VERSION 0x0500 #include <dinput.h> -#define AXISMAX 1000 // Maxmimum range to which we'll gauge the swing -#define AXISMIN -1000 // Minimum range to which we'll gauge the swing +#define CONTROLLER_AXISMAX 1000 // Maxmimum range to which we'll gauge the swing +#define CONTROLLER_AXISMIN -1000 // Minimum range to which we'll gauge the swing -extern HWND hwnd; // Handle to window +extern HINSTANCE dll_handle; -IDirectInput* lpDI; // DI instance -IDirectInputDevice2* lpDIDevice; // DI Device instance -DIJOYSTATE2 js; // State of Controller +extern HWND hwnd; // Handle to window -int buttoncount = 0; // Temporary buttoncount -bool hasx; // Temporary xaxis check -bool hasrx; // Temporary rotational xaxis check -bool hasy; // Temporary yaxis check -bool hasry; // Temporary rotational yaxis check -bool hasz; // Temporary zaxis check -bool hasrz; // Temporary rotational zaxis check -bool haspov; // Temporary pov check -bool hasslider; // Temporary slider check +extern LPDIRECTINPUT lpdi; // DI instance -JNIEnv* environment; // JNIEnvironment copy +IDirectInputDevice2* cDIDevice; // DI Device instance +DIJOYSTATE2 cJS; // State of Controller -bool create_success; // bool used to determine successfull creation +int cButtoncount = 0; // Temporary buttoncount +bool cHasx; // Temporary xaxis check +bool cHasrx; // Temporary rotational xaxis check +bool cHasy; // Temporary yaxis check +bool cHasry; // Temporary rotational yaxis check +bool cHasz; // Temporary zaxis check +bool cHasrz; // Temporary rotational zaxis check +bool cHaspov; // Temporary pov check +bool cHasslider; // Temporary slider check + +JNIEnv* cEnvironment; // JNIEnvironment copy + +bool cCreate_success; // bool used to determine successfull creation // Cached fields of Controller.java jclass clsController; -jfieldID fidButtonCount; -jfieldID fidHasXAxis; -jfieldID fidHasRXAxis; -jfieldID fidHasYAxis; -jfieldID fidHasRYAxis; -jfieldID fidHasZAxis; -jfieldID fidHasRZAxis; -jfieldID fidHasPOV; -jfieldID fidHasSlider; -jfieldID fidButtons; -jfieldID fidX; -jfieldID fidRX; -jfieldID fidY; -jfieldID fidRY; -jfieldID fidZ; -jfieldID fidRZ; -jfieldID fidPOV; -jfieldID fidSlider; +jfieldID fidCButtonCount; +jfieldID fidCHasXAxis; +jfieldID fidCHasRXAxis; +jfieldID fidCHasYAxis; +jfieldID fidCHasRYAxis; +jfieldID fidCHasZAxis; +jfieldID fidCHasRZAxis; +jfieldID fidCHasPOV; +jfieldID fidCHasSlider; +jfieldID fidCButtons; +jfieldID fidCX; +jfieldID fidCRX; +jfieldID fidCY; +jfieldID fidCRY; +jfieldID fidCZ; +jfieldID fidCRZ; +jfieldID fidCPOV; +jfieldID fidCSlider; // Function prototypes (defined in the cpp file, since header file is generic across platforms -void EnumerateCapabilities(); +void EnumerateControllerCapabilities(); void EnumerateControllers(); BOOL CALLBACK EnumControllerCallback(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef); BOOL CALLBACK EnumControllerObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef); -void Shutdown(); +void ShutdownController(); void CreateController(LPCDIDEVICEINSTANCE lpddi); void SetupController(); -void InitializeFields(); -void CacheFields(); -void UpdateFields(); -void SetCapabilities(); -void PrintError(HRESULT error); +void InitializeControllerFields(); +void CacheControllerFields(); +void UpdateControllerFields(); +void SetControllerCapabilities(); /** * Initializes any field ids */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_initIDs(JNIEnv * env, jclass clazz) { - environment = env; + cEnvironment = env; clsController = clazz; /* Cache fields in Controller */ - CacheFields(); + CacheControllerFields(); } /** @@ -120,56 +122,65 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) { // Create the DirectInput object. HRESULT hr; - hr = DirectInputCreate(GetModuleHandle(NULL), DIRECTINPUT_VERSION, &lpDI, NULL); + hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); if (FAILED(hr)) { #if _DEBUG printf("DirectInputCreate failed\n"); #endif - Shutdown(); + ShutdownController(); return JNI_FALSE; } /* Find all Controllers */ EnumerateControllers(); - if (!create_success) { + if (!cCreate_success) { #if _DEBUG printf("EnumerateControllers failed\n"); #endif - Shutdown(); + ShutdownController(); + return JNI_FALSE; + } + + /* check that we got at least 1 controller */ + if (cDIDevice == NULL) { +#if _DEBUG + printf("No devices found during enumeration\n"); +#endif + ShutdownController(); return JNI_FALSE; } /* Enumerate capabilities of Controller */ - EnumerateCapabilities(); - if (!create_success) { + EnumerateControllerCapabilities(); + if (!cCreate_success) { #if _DEBUG - printf("EnumerateCapabilities failed\n"); + printf("EnumerateControllerCapabilities failed\n"); #endif - Shutdown(); + ShutdownController(); return JNI_FALSE; } - if(create_success) { + if(cCreate_success) { /* Do setup of Controller */ SetupController(); } /* Initialize any fields on the Controller */ - InitializeFields(); + InitializeControllerFields(); /* Set capabilities */ - SetCapabilities(); + SetControllerCapabilities(); /* Aquire the Controller */ - hr = lpDIDevice->Acquire(); + hr = cDIDevice->Acquire(); if(FAILED(hr)) { #if _DEBUG printf("Acquire failed\n"); #endif - Shutdown(); + ShutdownController(); return JNI_FALSE; } - return create_success; + return cCreate_success; } /* @@ -178,7 +189,7 @@ * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nDestroy(JNIEnv *env, jclass clazz) { - Shutdown(); + ShutdownController(); } /* @@ -190,48 +201,51 @@ HRESULT hRes; // poll the Controller to read the current state - hRes = lpDIDevice->Poll(); + hRes = cDIDevice->Poll(); if (FAILED(hRes)) { #if _DEBUG printf("Poll fail\n"); #endif + + //check if we need to reaquire + if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { + cDIDevice->Acquire(); +#if _DEBUG + printf("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); +#endif + } return; } - UpdateFields(); + UpdateControllerFields(); } /** * Shutdown DI */ -void Shutdown() { - // release DI instance - if (lpDI != NULL) { - // release device - if (lpDIDevice != NULL) { - lpDIDevice->Unacquire(); - lpDIDevice->Release(); - lpDIDevice = NULL; - } - lpDI->Release(); - lpDI = NULL; +void ShutdownController() { + // release device + if (cDIDevice != NULL) { + cDIDevice->Unacquire(); + cDIDevice->Release(); + cDIDevice = NULL; } } /** * Enumerates the capabilities of the Controller attached to the system */ -void EnumerateCapabilities() { +void EnumerateControllerCapabilities() { HRESULT hr; - hr = lpDIDevice->EnumObjects(EnumControllerObjectsCallback, NULL, DIDFT_ALL); + hr = cDIDevice->EnumObjects(EnumControllerObjectsCallback, NULL, DIDFT_ALL); if FAILED(hr) { #if _DEBUG printf("EnumObjects failed\n"); #endif - create_success = false; + cCreate_success = false; return; } - create_success = true; + cCreate_success = true; } /** @@ -239,15 +253,15 @@ */ void EnumerateControllers() { HRESULT hr; - hr = lpDI->EnumDevices(DIDEVTYPE_JOYSTICK, EnumControllerCallback, 0, DIEDFL_ATTACHEDONLY); + hr = lpdi->EnumDevices(DIDEVTYPE_JOYSTICK, EnumControllerCallback, 0, DIEDFL_ATTACHEDONLY); if FAILED(hr) { #if _DEBUG printf("EnumDevices failed\n"); #endif - create_success = false; + cCreate_success = false; return; } - create_success = true; + cCreate_success = true; } /** @@ -269,23 +283,23 @@ printf("found %s\n", lpddoi->tszName); #endif if(lpddoi->guidType == GUID_Button) { - buttoncount++; + cButtoncount++; } else if(lpddoi->guidType == GUID_XAxis) { - hasx = true; + cHasx = true; } else if(lpddoi->guidType == GUID_YAxis) { - hasy = true; + cHasy = true; } else if(lpddoi->guidType == GUID_ZAxis){ - hasz = true; + cHasz = true; } else if (lpddoi->guidType == GUID_POV){ - haspov = true; + cHaspov = true; } else if (lpddoi->guidType == GUID_Slider){ - hasslider = true; + cHasslider = true; } else if (lpddoi->guidType == GUID_RxAxis) { - hasrx = true; + cHasrx = true; } else if (lpddoi->guidType == GUID_RyAxis) { - hasry = true; + cHasry = true; } else if (lpddoi->guidType == GUID_RzAxis) { - hasrz = true; + cHasrz = true; #if _DEBUG } else { printf("Unhandled object found: %s\n", lpddoi->tszName); @@ -299,15 +313,15 @@ */ void CreateController(LPCDIDEVICEINSTANCE lpddi) { HRESULT hr; - hr = lpDI->CreateDevice(lpddi->guidInstance, (LPDIRECTINPUTDEVICE*) &lpDIDevice, NULL); + hr = lpdi->CreateDevice(lpddi->guidInstance, (LPDIRECTINPUTDEVICE*) &cDIDevice, NULL); if FAILED(hr) { #if _DEBUG printf("CreateDevice failed\n"); #endif - create_success = false; + cCreate_success = false; return; } - create_success = true; + cCreate_success = true; } /** @@ -315,20 +329,20 @@ */ void SetupController() { // set Controller data format - if(lpDIDevice->SetDataFormat(&c_dfDIJoystick2) != DI_OK) { + if(cDIDevice->SetDataFormat(&c_dfDIJoystick2) != DI_OK) { #if _DEBUG printf("SetDataFormat failed\n"); #endif - create_success = false; + cCreate_success = false; return; } // set the cooperative level - if(lpDIDevice->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND) != DI_OK) { + if(cDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { #if _DEBUG printf("SetCooperativeLevel failed\n"); #endif - create_success = false; + cCreate_success = false; return; } @@ -338,79 +352,79 @@ diprg.diph.dwSize = sizeof(diprg); diprg.diph.dwHeaderSize = sizeof(diprg.diph); diprg.diph.dwHow = DIPH_BYOFFSET; - diprg.lMin = AXISMIN; - diprg.lMax = AXISMAX; + diprg.lMin = CONTROLLER_AXISMIN; + diprg.lMax = CONTROLLER_AXISMAX; // set X-axis - if(hasx) { + if(cHasx) { diprg.diph.dwObj = DIJOFS_X; - if(lpDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { #if _DEBUG printf("SetProperty(DIJOFS_X) failed\n"); #endif - create_success = false; + cCreate_success = false; return; } } // set RX-axis - if(hasrx) { + if(cHasrx) { diprg.diph.dwObj = DIJOFS_RX; - if(lpDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { #if _DEBUG printf("SetProperty(DIJOFS_RX) failed\n"); #endif - create_success = false; + cCreate_success = false; return; } } // set Y-axis - if(hasy) { + if(cHasy) { diprg.diph.dwObj = DIJOFS_Y; - if(lpDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { #if _DEBUG printf("SetProperty(DIJOFS_Y) failed\n"); #endif - create_success = false; + cCreate_success = false; return; } } // set RY-axis - if(hasry) { + if(cHasry) { diprg.diph.dwObj = DIJOFS_RY; - if(lpDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { #if _DEBUG printf("SetProperty(DIJOFS_RY) failed\n"); #endif - create_success = false; + cCreate_success = false; return; } } // set Z-axis - if(hasz) { + if(cHasz) { diprg.diph.dwObj = DIJOFS_Z; - if(lpDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { #if _DEBUG printf("SetProperty(DIJOFS_Z) failed\n"); #endif - create_success = false; + cCreate_success = false; return; } } // set RZ-axis - if(hasrz) { + if(cHasrz) { diprg.diph.dwObj = DIJOFS_RZ; - if(lpDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { #if _DEBUG printf("SetProperty(DIJOFS_RZ) failed\n"); #endif - create_success = false; + cCreate_success = false; return; } } @@ -419,136 +433,139 @@ // Lastly slider // using z axis since we're running dx 5 // - if(hasslider) { + if(cHasslider) { diprg.diph.dwObj = DIJOFS_Z; - if(lpDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { #if _DEBUG printf("SetProperty(DIJOFS_Z(SLIDER)) failed\n"); #endif - create_success = false; + cCreate_success = false; return; } } - create_success = true; + cCreate_success = true; } /** * Sets the fields on the Controller */ -void InitializeFields() { +void InitializeControllerFields() { //set buttons array - jbooleanArray buttonsArray = environment->NewBooleanArray(buttoncount); - environment->SetStaticObjectField(clsController, fidButtons, buttonsArray); + jbooleanArray buttonsArray = cEnvironment->NewBooleanArray(cButtoncount); + cEnvironment->SetStaticObjectField(clsController, fidCButtons, buttonsArray); } /** * Updates the fields on the Controller */ -void UpdateFields() { +void UpdateControllerFields() { HRESULT hRes; // get data from the Controller - hRes = lpDIDevice->GetDeviceState(sizeof(DIJOYSTATE2), &js); + hRes = cDIDevice->GetDeviceState(sizeof(DIJOYSTATE2), &cJS); if (hRes != DI_OK) { // did the read fail because we lost input for some reason? // if so, then attempt to reacquire. - if(hRes == DIERR_INPUTLOST) { - lpDIDevice->Acquire(); + if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { + cDIDevice->Acquire(); #if _DEBUG - printf("DIERR_INPUTLOST, reaquiring input : create_success=%d\n", create_success); + printf("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); #endif } - return; +#if _DEBUG + printf("Error getting controller state: %d\n", hRes); +#endif + return; } //axis's - if(hasx) { - environment->SetStaticIntField(clsController, fidX, js.lX); + if(cHasx) { + cEnvironment->SetStaticIntField(clsController, fidCX, cJS.lX); } - if(hasy) { - environment->SetStaticIntField(clsController, fidY, js.lY); + if(cHasy) { + cEnvironment->SetStaticIntField(clsController, fidCY, cJS.lY); } - if(hasz) { - environment->SetStaticIntField(clsController, fidZ, js.lZ); + if(cHasz) { + cEnvironment->SetStaticIntField(clsController, fidCZ, cJS.lZ); } //rotational axis - if(hasrx) { - environment->SetStaticIntField(clsController, fidRX, js.lRx); + if(cHasrx) { + cEnvironment->SetStaticIntField(clsController, fidCRX, cJS.lRx); } - if(hasry) { - environment->SetStaticIntField(clsController, fidRY, js.lRy); + if(cHasry) { + cEnvironment->SetStaticIntField(clsController, fidCRY, cJS.lRy); } - if(hasrz) { - environment->SetStaticIntField(clsController, fidRZ, js.lRz); + if(cHasrz) { + cEnvironment->SetStaticIntField(clsController, fidCRZ, cJS.lRz); } //buttons - jbooleanArray buttonsArray = (jbooleanArray) environment->GetStaticObjectField(clsController, fidButtons); - BYTE * buttons = (BYTE *) environment->GetPrimitiveArrayCritical(buttonsArray, NULL); - memcpy(buttons, js.rgbButtons, buttoncount); - environment->ReleasePrimitiveArrayCritical(buttonsArray, buttons, 0); + jbooleanArray buttonsArray = (jbooleanArray) cEnvironment->GetStaticObjectField(clsController, fidCButtons); + BYTE * buttons = (BYTE *) cEnvironment->GetPrimitiveArrayCritical(buttonsArray, NULL); + memcpy(buttons, cJS.rgbButtons, cButtoncount); + cEnvironment->ReleasePrimitiveArrayCritical(buttonsArray, buttons, 0); //pov - if(haspov) { - environment->SetStaticIntField(clsController, fidPOV, js.rgdwPOV[0]); + if(cHaspov) { + cEnvironment->SetStaticIntField(clsController, fidCPOV, cJS.rgdwPOV[0]); } //slider - if(hasslider) { - environment->SetStaticIntField(clsController, fidSlider, js.lZ); + if(cHasslider) { + cEnvironment->SetStaticIntField(clsController, fidCSlider, cJS.lZ); } } /** * Sets the capabilities of the Controller */ -void SetCapabilities() { +void SetControllerCapabilities() { //set buttoncount - environment->SetStaticIntField(clsController, fidButtonCount, buttoncount); + cEnvironment->SetStaticIntField(clsController, fidCButtonCount, cButtoncount); //set axis - environment->SetStaticIntField(clsController, fidHasXAxis, hasx); - environment->SetStaticIntField(clsController, fidHasYAxis, hasy); - environment->SetStaticIntField(clsController, fidHasZAxis, hasz); + cEnvironment->SetStaticBooleanField(clsController, fidCHasXAxis, cHasx); + cEnvironment->SetStaticBooleanField(clsController, fidCHasYAxis, cHasy); + cEnvironment->SetStaticBooleanField(clsController, fidCHasZAxis, cHasz); //set rotational axis - environment->SetStaticIntField(clsController, fidHasRXAxis, hasrx); - environment->SetStaticIntField(clsController, fidHasRYAxis, hasry); - environment->SetStaticIntField(clsController, fidHasRZAxis, hasrz); + cEnvironment->SetStaticBooleanField(clsController, fidCHasRXAxis, cHasrx); + cEnvironment->SetStaticBooleanField(clsController, fidCHasRYAxis, cHasry); + cEnvironment->SetStaticBooleanField(clsController, fidCHasRZAxis, cHasrz); //set pov - environment->SetStaticIntField(clsController, fidHasPOV, haspov); + cEnvironment->SetStaticBooleanField(clsController, fidCHasPOV, cHaspov); //set slider - environment->SetStaticIntField(clsController, fidHasSlider, hasslider); + cEnvironment->SetStaticBooleanField(clsController, fidCHasSlider, cHasslider); } /** * Caches the field ids for quicker access */ -void CacheFields() { - fidButtonCount = environment->GetStaticFieldID(clsController, "buttonCount", "I"); - fidHasXAxis = environment->GetStaticFieldID(clsController, "hasXAxis", "Z"); - fidHasRXAxis = environment->GetStaticFieldID(clsController, "hasRXAxis", "Z"); - fidHasYAxis = environment->GetStaticFieldID(clsController, "hasYAxis", "Z"); - fidHasRYAxis = environment->GetStaticFieldID(clsController, "hasRYAxis", "Z"); - fidHasZAxis = environment->GetStaticFieldID(clsController, "hasZAxis", "Z"); - fidHasRZAxis = environment->GetStaticFieldID(clsController, "hasRZAxis", "Z"); - fidHasPOV = environment->GetStaticFieldID(clsController, "hasPOV", "Z"); - fidHasSlider = environment->GetStaticFieldID(clsController, "hasSlider", "Z"); - fidButtons = environment->GetStaticFieldID(clsController, "buttons", "[Z"); - fidX = environment->GetStaticFieldID(clsController, "x", "I"); - fidRX = environment->GetStaticFieldID(clsController, "rx", "I"); - fidY = environment->GetStaticFieldID(clsController, "y", "I"); - fidRY = environment->GetStaticFieldID(clsController, "ry", "I"); - fidZ = environment->GetStaticFieldID(clsController, "z", "I"); - fidRZ = environment->GetStaticFieldID(clsController, "rz", "I"); - fidPOV = environment->GetStaticFieldID(clsController, "pov", "I"); - fidSlider = environment->GetStaticFieldID(clsController, "slider", "I"); +void CacheControllerFields() { + fidCButtonCount = cEnvironment->GetStaticFieldID(clsController, "buttonCount", "I"); + fidCHasXAxis = cEnvironment->GetStaticFieldID(clsController, "hasXAxis", "Z"); + fidCHasRXAxis = cEnvironment->GetStaticFieldID(clsController, "hasRXAxis", "Z"); + fidCHasYAxis = cEnvironment->GetStaticFieldID(clsController, "hasYAxis", "Z"); + fidCHasRYAxis = cEnvironment->GetStaticFieldID(clsController, "hasRYAxis", "Z"); + fidCHasZAxis = cEnvironment->GetStaticFieldID(clsController, "hasZAxis", "Z"); + fidCHasRZAxis = cEnvironment->GetStaticFieldID(clsController, "hasRZAxis", "Z"); + fidCHasPOV = cEnvironment->GetStaticFieldID(clsController, "hasPOV", "Z"); + fidCHasSlider = cEnvironment->GetStaticFieldID(clsController, "hasSlider", "Z"); + fidCButtons = cEnvironment->GetStaticFieldID(clsController, "buttons", "[Z"); + fidCX = cEnvironment->GetStaticFieldID(clsController, "x", "I"); + fidCRX = cEnvironment->GetStaticFieldID(clsController, "rx", "I"); + fidCY = cEnvironment->GetStaticFieldID(clsController, "y", "I"); + fidCRY = cEnvironment->GetStaticFieldID(clsController, "ry", "I"); + fidCZ = cEnvironment->GetStaticFieldID(clsController, "z", "I"); + fidCRZ = cEnvironment->GetStaticFieldID(clsController, "rz", "I"); + fidCPOV = cEnvironment->GetStaticFieldID(clsController, "pov", "I"); + fidCSlider = cEnvironment->GetStaticFieldID(clsController, "slider", "I"); } |
|
From: Brian M. <ma...@us...> - 2003-02-08 19:30:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv6358 Modified Files: org_lwjgl_Display.cpp Log Message: fix: make mouse actually behave! 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.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- org_lwjgl_Display.cpp 8 Feb 2003 01:02:34 -0000 1.18 +++ org_lwjgl_Display.cpp 8 Feb 2003 19:30:53 -0000 1.19 @@ -141,21 +141,31 @@ case SC_MONITORPOWER: return 0L; break; + case SC_MINIMIZE: + isMinimized = true; + appActivate(true); + break; + case SC_RESTORE: + isMinimized = false; + appActivate(false); default: break; } } case WM_ACTIVATE: { - int fActive, fMinimized; - - fActive = LOWORD(wParam); - fMinimized = (BOOL) HIWORD(wParam); - appActivate(fActive != WA_INACTIVE && !fMinimized); - isMinimized = fMinimized == TRUE || (fActive == WA_INACTIVE && isFullscreen); + switch(LOWORD(wParam)) { + case WA_ACTIVE: + case WA_CLICKACTIVE: + isMinimized = false; + break; + case WA_INACTIVE: + isMinimized = true; + break; + } + appActivate(!isMinimized); } - } // default action |
|
From: Brian M. <ma...@us...> - 2003-02-08 19:30:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv6173 Modified Files: org_lwjgl_input_Mouse.cpp Log Message: new Mouse implementation, rewritten to better fit Controller structure Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_input_Mouse.cpp 7 Feb 2003 21:54:31 -0000 1.6 +++ org_lwjgl_input_Mouse.cpp 8 Feb 2003 19:30:23 -0000 1.7 @@ -1,5 +1,5 @@ -/* - * Copyright (c) 2002 Light Weight Java Game Library Project +/* + * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -16,8 +16,7 @@ * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR @@ -35,107 +34,112 @@ * * Win32 mouse handling. * - * @author cix_foo <ci...@us...> + * @author Brian Matzon <br...@ma...> * @version $Revision$ */ - #define WIN32_LEAN_AND_MEAN - -#include <windows.h> #include "org_lwjgl_input_Mouse.h" +#include <windows.h> #undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x0300 #include <dinput.h> -extern LPDIRECTINPUT lpdi; -LPDIRECTINPUTDEVICE lpdiMouse; -extern HWND hwnd; // The display, which must have been created -jfieldID fid_button; -jfieldID fid_dx; -jfieldID fid_dy; -jfieldID fid_dz; +extern HINSTANCE dll_handle; -/* - * Class: org_lwjgl_input_Mouse - * Method: initIDs - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_initIDs - (JNIEnv * env, jclass clazz) -{ - // Get a global class instance, just to be sure - static jobject globalClassLock = NULL; +extern HWND hwnd; // Handle to window - if (globalClassLock == NULL) { - globalClassLock = env->NewGlobalRef(clazz); - } +extern LPDIRECTINPUT lpdi; // DI instance +LPDIRECTINPUTDEVICE mDIDevice; // DI Device instance +DIMOUSESTATE diMouseState; // State of Mouse - // Now cache the field IDs: - if (fid_button == NULL) { - fid_button = env->GetStaticFieldID(clazz, "button", "[Z"); - } - if (fid_dx == NULL) { - fid_dx = env->GetStaticFieldID(clazz, "dx", "I"); - } - if (fid_dy == NULL) { - fid_dy = env->GetStaticFieldID(clazz, "dy", "I"); - } - if (fid_dz == NULL) { - fid_dz = env->GetStaticFieldID(clazz, "dz", "I"); - } +int mButtoncount = 0; // Temporary buttoncount +bool mHaswheel; // Temporary wheel check + +JNIEnv* mEnvironment; // JNIEnvironment copy + +bool mCreate_success; // bool used to determine successfull creation + +// Cached fields of Mouse.java +jclass clsMouse; +jfieldID fidMButtonCount; +jfieldID fidMButtons; +jfieldID fidMDX; +jfieldID fidMDY; +jfieldID fidMDWheel; +jfieldID fidMHasWheel; + +// Function prototypes (defined in the cpp file, since header file is generic across platforms +void EnumerateMouseCapabilities(); +BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef); +void ShutdownMouse(); +void CreateMouse(); +void SetupMouse(); +void InitializeMouseFields(); +void CacheMouseFields(); +void UpdateMouseFields(); +void SetMouseCapabilities(); + +/** + * Initializes any field ids + */ +JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_initIDs(JNIEnv * env, jclass clazz) { + mEnvironment = env; + clsMouse = clazz; + + /* Cache fields in Mouse */ + CacheMouseFields(); } -/* - * Class: org_lwjgl_input_Mouse - * Method: nCreate - * Signature: ()Z +/** + * Called when the Mouse instance is to be created */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nCreate - (JNIEnv * env, jclass clazz) -{ - // Check to see if we're already initialized - if (lpdiMouse != NULL) { - printf("Mouse already created.\n"); - return JNI_FALSE; - } +JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv *env, jclass clazz) { + // Create the DirectInput object. + HRESULT hr; + hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); + if (FAILED(hr)) { +#if _DEBUG + printf("DirectInputCreate failed\n"); +#endif + ShutdownMouse(); + return JNI_FALSE; + } - if (hwnd == NULL) { - printf("No window\n"); - return JNI_FALSE; - } + /* skip enumeration, since we only want system mouse */ + CreateMouse(); - // First get reference to directinput: - if (lpdi == NULL) { - HRESULT ret = DirectInputCreate((HINSTANCE)GetCurrentProcess(), DIRECTINPUT_VERSION, &lpdi, NULL); - if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) { - printf("Failed to create directinput\n"); - return JNI_FALSE; - } - } + /* Enumerate capabilities of Mouse */ + EnumerateMouseCapabilities(); + if (!mCreate_success) { +#if _DEBUG + printf("EnumerateMouseCapabilities failed\n"); +#endif + ShutdownMouse(); + return JNI_FALSE; + } - // Get mouse device - if (lpdi->CreateDevice(GUID_SysMouse, &lpdiMouse, NULL) != DI_OK) { - printf("Failed to create mouse\n"); - return JNI_FALSE; - } + if(mCreate_success) { + /* Do setup of Mouse */ + SetupMouse(); + } - // Grab non-exclusive foreground access to device - if (lpdiMouse->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { - printf("Failed to set mouse coop\n"); - return JNI_FALSE; - } + /* Initialize any fields on the Mouse */ + InitializeMouseFields(); - // Tell 'em wot format to be in (the default "you are a mouse and keyboard" format) - lpdiMouse->SetDataFormat(&c_dfDIMouse); + /* Set capabilities */ + SetMouseCapabilities(); - HRESULT ret = lpdiMouse->Acquire(); - if (ret != DI_OK && ret != S_FALSE) { -#ifdef _DEBUG - printf("Failed to acquire mouse\n"); + /* Aquire the Mouse */ + hr = mDIDevice->Acquire(); + if(FAILED(hr)) { +#if _DEBUG + printf("Acquire failed\n"); #endif - } - return JNI_TRUE; + ShutdownMouse(); + return JNI_FALSE; + } + return mCreate_success; } /* @@ -143,51 +147,174 @@ * Method: nDestroy * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy - (JNIEnv * env, jclass clazz) -{ - - // Release mouse - if (lpdiMouse != NULL) { - lpdiMouse->Unacquire(); - lpdiMouse->Release(); - lpdiMouse = NULL; - } - +JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv *env, jclass clazz) { + ShutdownMouse(); } /* - * Class: org_lwjgl_input_Mouse + * Class: org_lwjgl_input_Controller * Method: nPoll * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll - (JNIEnv * env, jclass clazz) -{ - DIMOUSESTATE diMouseState; - HRESULT ret; - while (ret = lpdiMouse->GetDeviceState(sizeof(diMouseState), &diMouseState) != DI_OK) { - ret = lpdiMouse->Acquire(); - if (ret != DI_OK && ret != S_FALSE) { - return; - } - } +JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll(JNIEnv * env, jclass clazz) { + UpdateMouseFields(); +} - if (ret == DI_OK) { - env->SetStaticIntField(clazz, fid_dx, (jint)diMouseState.lX); - env->SetStaticIntField(clazz, fid_dy, (jint)diMouseState.lY); - env->SetStaticIntField(clazz, fid_dz, (jint)diMouseState.lZ); - jbooleanArray buttonsArray = (jbooleanArray) env->GetStaticObjectField(clazz, fid_button); - for (int i = 0; i < 4; i++) - if (diMouseState.rgbButtons[i] != 0) - diMouseState.rgbButtons[i] = JNI_TRUE; - else - diMouseState.rgbButtons[i] = JNI_FALSE; - env->SetBooleanArrayRegion(buttonsArray, 0, 4, diMouseState.rgbButtons); - } else { -#ifdef _DEBUG - printf("Failed to get mouse device state\n"); +/** + * Shutdown DI + */ +void ShutdownMouse() { + // release device + if (mDIDevice != NULL) { + mDIDevice->Unacquire(); + mDIDevice->Release(); + } +} +/** + * Enumerates the capabilities of the Mouse attached to the system + */ +void EnumerateMouseCapabilities() { + HRESULT hr; + hr = mDIDevice->EnumObjects(EnumMouseObjectsCallback, NULL, DIDFT_ALL); + if FAILED(hr) { +#if _DEBUG + printf("EnumObjects failed\n"); #endif - } + mCreate_success = false; + return; + } + mCreate_success = true; +} + +/** + * Callback from EnumObjects. Called for each "object" on the Mouse. + */ +BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { +#if _DEBUG + printf("found %s\n", lpddoi->tszName); +#endif + if(lpddoi->guidType == GUID_Button) { + mButtoncount++; + } else if(lpddoi->guidType == GUID_XAxis) { + } else if(lpddoi->guidType == GUID_YAxis) { + } else if(lpddoi->guidType == GUID_ZAxis) { + mHaswheel = true; +#if _DEBUG + } else { + printf("Unhandled object found: %s\n", lpddoi->tszName); +#endif + } + return DIENUM_CONTINUE; +} + +/** + * Creates the specified device as a Mouse + */ +void CreateMouse() { + HRESULT hr; + hr = lpdi->CreateDevice(GUID_SysMouse, &mDIDevice, NULL); + if FAILED(hr) { +#if _DEBUG + printf("CreateDevice failed\n"); +#endif + mCreate_success = false; + return; + } + mCreate_success = true; +} + +/** + * Sets up the Mouse properties + */ +void SetupMouse() { + // set Mouse data format + if(mDIDevice->SetDataFormat(&c_dfDIMouse) != DI_OK) { +#if _DEBUG + printf("SetDataFormat failed\n"); +#endif + mCreate_success = false; + return; + } + + // set the cooperative level + if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { +#if _DEBUG + printf("SetCooperativeLevel failed\n"); +#endif + mCreate_success = false; + return; + } + mCreate_success = true; +} + +/** + * Sets the fields on the Mouse + */ +void InitializeMouseFields() { + //set buttons array + jbooleanArray buttonsArray = mEnvironment->NewBooleanArray(mButtoncount); + mEnvironment->SetStaticObjectField(clsMouse, fidMButtons, buttonsArray); +} + +/** + * Updates the fields on the Mouse + */ +void UpdateMouseFields() { + HRESULT hRes; + + // get data from the Mouse + hRes = mDIDevice->GetDeviceState(sizeof(DIMOUSESTATE), &diMouseState); + + if (hRes != DI_OK) { + // did the read fail because we lost input for some reason? + // if so, then attempt to reacquire. + if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { + mDIDevice->Acquire(); +#if _DEBUG + printf("DIERR_INPUTLOST, reaquiring input : mCreate_success=%d\n", mCreate_success); +#endif + } else { +#if _DEBUG + printf("Error getting mouse state: %d\n", hRes); +#endif + } + return; + } + + mEnvironment->SetStaticIntField(clsMouse, fidMDX, (jint) diMouseState.lX); + mEnvironment->SetStaticIntField(clsMouse, fidMDY, (jint) diMouseState.lY); + mEnvironment->SetStaticIntField(clsMouse, fidMDWheel, (jint) diMouseState.lZ); + + jbooleanArray buttonsArray = (jbooleanArray) mEnvironment->GetStaticObjectField(clsMouse, fidMButtons); + for (int i = 0; i < mButtoncount; i++) { + if (diMouseState.rgbButtons[i] != 0) { + diMouseState.rgbButtons[i] = JNI_TRUE; + } else { + diMouseState.rgbButtons[i] = JNI_FALSE; + } + } + mEnvironment->SetBooleanArrayRegion(buttonsArray, 0, mButtoncount, diMouseState.rgbButtons); +} + +/** + * Sets the capabilities of the Mouse + */ +void SetMouseCapabilities() { + //set buttoncount + mEnvironment->SetStaticIntField(clsMouse, fidMButtonCount, mButtoncount); + //set wheel + mEnvironment->SetStaticBooleanField(clsMouse, fidMHasWheel, mHaswheel); } + +/** + * Caches the field ids for quicker access + */ +void CacheMouseFields() { + fidMButtonCount = mEnvironment->GetStaticFieldID(clsMouse, "buttonCount", "I"); + fidMHasWheel = mEnvironment->GetStaticFieldID(clsMouse, "hasWheel", "Z"); + fidMButtons = mEnvironment->GetStaticFieldID(clsMouse, "buttons", "[Z"); + fidMDX = mEnvironment->GetStaticFieldID(clsMouse, "dx", "I"); + fidMDY = mEnvironment->GetStaticFieldID(clsMouse, "dy", "I"); + fidMDWheel = mEnvironment->GetStaticFieldID(clsMouse, "dwheel", "I"); +} \ No newline at end of file |
|
From: Brian M. <ma...@us...> - 2003-02-08 19:30:11
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1:/tmp/cvs-serv6022 Modified Files: Mouse.java Log Message: new Mouse implementation, rewritten to better fit Controller structure Index: Mouse.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Mouse.java 21 Dec 2002 12:37:18 -0000 1.11 +++ Mouse.java 8 Feb 2003 19:30:07 -0000 1.12 @@ -32,8 +32,6 @@ package org.lwjgl.input; -import java.nio.ByteBuffer; - import org.lwjgl.Display; import org.lwjgl.Sys; @@ -59,7 +57,7 @@ private static boolean created; /** The mouse buttons status from the last poll */ - private static boolean[] button = new boolean[8]; + private static boolean[] buttons; /** Delta X */ public static int dx; @@ -68,22 +66,11 @@ public static int dy; /** Delta Z */ - public static int dz; - - /** - * The mouse events from the last read: a sequence of Events - */ - private static ByteBuffer readBuffer; - - /** Address of the read buffer */ - private static int readBufferAddress; - - /** The size in bytes of a single mouse event */ - private static final int MOUSE_EVENT_SIZE = 20; - - /** The stride in bytes of a single mouse event */ - private static final int MOUSE_EVENT_STRIDE = 32; - + public static int dwheel; + + /* Mouse capabilities */ + public static int buttonCount = -1; + public static boolean hasWheel = false; /** * Mouse cannot be constructed. @@ -152,109 +139,15 @@ * Native method to poll the mouse */ private static native void nPoll(); - - /** - * Queries the number of buttons the mouse has - * @return the number of buttons the mouse has - */ - public static int getNumButtons() { - assert created : "The mouse has not been created."; - return nGetNumButtons(); - } - - /** - * Native implementation of getNumButtons() - */ - private static native int nGetNumButtons(); - - /** - * Queries whether the mouse has a Z value - * @return true if the mouse has a Z value - */ - public static boolean hasZValue() { - assert created : "The mouse has not been created."; - return nHasZValue(); - } - - /** - * Native implementation of hasZValue() - */ - private static native boolean nHasZValue(); /** * See if a particular mouse button is down. * - * @param button The index of the button you wish to test (0..getNumButtons()) + * @param button The index of the button you wish to test (0..buttonCount) * @return true if the specified button is down - * @see #getNumButtons() */ public static boolean isButtonDown(int button) { assert created : "The mouse has not been created."; - return Mouse.button[button]; - } - -// /** -// * Enable mouse buffering. Must be called after the mouse is created. -// * @return the size of the mouse buffer in events, or 0 if no buffering -// * can be enabled for any reason -// */ -// public static int enableBuffer() { -// assert created : "The mouse has not been created."; -// return nEnableBuffer(); -// } -// -// -// /** -// * Native method to enable the buffer -// * @return the size of the buffer allocated, in events (1 event is 2 bytes), -// * or 0 if no buffer can be allocated -// */ -// private static native int nEnableBuffer(); - - - /** - * Gets the next mouse event. This returns its results as if a poll() had - * been called. - * - * @return true if a mouse event was read, false otherwise - */ - public static boolean next() { - assert created : "The mouse has not been created."; - assert readBuffer != null : "Mouse buffering has not been enabled."; - - if (readBuffer.hasRemaining()) { - dx = readBuffer.getInt(); - dy = readBuffer.getInt(); - dz = readBuffer.getInt(); - for (int i = 0; i < button.length; i ++) - button[i] = readBuffer.get() != (byte)0; - readBuffer.position(readBuffer.position() + (MOUSE_EVENT_STRIDE - MOUSE_EVENT_SIZE)); - return true; - } else - return false; - - } - - - /** - * Native method to read the gamepad buffer - * - * @param readBufferAddress the address of the mouse buffer - * @return the number of mouse events read - */ - private static native int nRead(int readBufferAddress); - - - /** - * Reads the mouse buffer. - */ - public static void read() { - assert created : "The mouse has not been created."; - assert readBuffer != null : "Mouse buffering has not been enabled."; - readBuffer.clear(); - readBuffer.limit(nRead(readBufferAddress) * MOUSE_EVENT_SIZE); + return Mouse.buttons[button]; } - - - -} +} \ No newline at end of file |
|
From: Brian M. <ma...@us...> - 2003-02-08 19:29:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv5868 Modified Files: org_lwjgl_input_Mouse.h Log Message: new Mouse implementation, rewritten to better fit Controller structure Index: org_lwjgl_input_Mouse.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Mouse.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Mouse.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_input_Mouse.h 24 Aug 2002 21:17:37 -0000 1.2 +++ org_lwjgl_input_Mouse.h 8 Feb 2003 19:29:54 -0000 1.3 @@ -9,16 +9,12 @@ #endif /* Inaccessible static: _00024assertionsDisabled */ /* Inaccessible static: created */ -/* Inaccessible static: button */ +/* Inaccessible static: buttons */ /* Inaccessible static: dx */ /* Inaccessible static: dy */ -/* Inaccessible static: dz */ -/* Inaccessible static: readBuffer */ -/* Inaccessible static: readBufferAddress */ -#undef org_lwjgl_input_Mouse_MOUSE_EVENT_SIZE -#define org_lwjgl_input_Mouse_MOUSE_EVENT_SIZE 20L -#undef org_lwjgl_input_Mouse_MOUSE_EVENT_STRIDE -#define org_lwjgl_input_Mouse_MOUSE_EVENT_STRIDE 32L +/* Inaccessible static: dwheel */ +/* Inaccessible static: buttonCount */ +/* Inaccessible static: hasWheel */ /* Inaccessible static: class_000240 */ /* * Class: org_lwjgl_input_Mouse @@ -51,38 +47,6 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll (JNIEnv *, jclass); - -/* - * Class: org_lwjgl_input_Mouse - * Method: nGetNumButtons - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNumButtons - (JNIEnv *, jclass); - -/* - * Class: org_lwjgl_input_Mouse - * Method: nHasZValue - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nHasZValue - (JNIEnv *, jclass); - -/* - * Class: org_lwjgl_input_Mouse - * Method: nEnableBuffer - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nEnableBuffer - (JNIEnv *, jclass); - -/* - * Class: org_lwjgl_input_Mouse - * Method: nRead - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nRead - (JNIEnv *, jclass, jint); #ifdef __cplusplus } |
|
From: Elias N. <eli...@us...> - 2003-02-08 16:33:03
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv876/win32 Modified Files: org_lwjgl_input_Keyboard.cpp Log Message: Removed dead code Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_input_Keyboard.cpp 7 Feb 2003 21:53:39 -0000 1.7 +++ org_lwjgl_input_Keyboard.cpp 8 Feb 2003 16:33:00 -0000 1.8 @@ -194,11 +194,9 @@ int num_chars; int num_events = 0; - do { - ret = lpdiKeyboard->Acquire(); - if (ret != DI_OK && ret != S_FALSE) - return 0; - } while (ret != DI_OK && ret != S_FALSE); + ret = lpdiKeyboard->Acquire(); + if (ret != DI_OK && ret != S_FALSE) + return 0; ret = lpdiKeyboard->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), @@ -307,4 +305,4 @@ jobject newBuffer = env->NewDirectByteBuffer(&readBuffer, KEYBOARD_BUFFER_SIZE); env->SetStaticObjectField(clazz, fid_readBuffer, newBuffer); return KEYBOARD_BUFFER_SIZE; -} \ No newline at end of file +} |
|
From: Brian M. <ma...@us...> - 2003-02-08 01:02:38
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv30264 Modified Files: org_lwjgl_Display.cpp Log Message: added minimize button, disabling close button since we have no mechnism to notify the user of a close 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.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- org_lwjgl_Display.cpp 7 Feb 2003 23:21:01 -0000 1.17 +++ org_lwjgl_Display.cpp 8 Feb 2003 01:02:34 -0000 1.18 @@ -305,7 +305,7 @@ windowflags = WS_POPUP | WS_VISIBLE; } else { exstyle = 0; - windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE; + windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU; } isFullscreen = fullscreen == JNI_TRUE; @@ -341,6 +341,10 @@ dll_handle, NULL); env->ReleaseStringUTFChars(title, titleString); + + // Disable close button + HMENU SysMen = GetSystemMenu(hwnd, false); + EnableMenuItem(SysMen, SC_CLOSE, MF_BYCOMMAND | MF_DISABLED); // And we never look at windowClass again... |