|
From: Elias N. <eli...@us...> - 2004-11-02 13:16:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30917/src/native/win32 Modified Files: org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Display.cpp Log Message: Win32Display Index: org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- org_lwjgl_input_Mouse.cpp 27 Sep 2004 13:43:34 -0000 1.64 +++ org_lwjgl_input_Mouse.cpp 2 Nov 2004 13:15:59 -0000 1.65 @@ -44,6 +44,7 @@ #include "Window.h" #include <dinput.h> #include "common_tools.h" +#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_input_Mouse.h" extern HINSTANCE dll_handle; // Handle to the LWJGL dll @@ -77,7 +78,7 @@ void CreateMouse(); void SetupMouse(); void InitializeMouseFields(); -void UpdateMouseFields(JNIEnv *env, jclass clsMouse, jobject coord_buffer_obj, jobject button_buffer_obj); +void UpdateMouseFields(JNIEnv *env, jobject coord_buffer_obj, jobject button_buffer_obj); static bool putMouseEvent(jint button, jint state, jint dx, jint dy, jint dz) { jint event[] = {button, state, dx, -dy, dz}; @@ -95,18 +96,18 @@ accum_dx = accum_dy = 0; } -JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nHasWheel(JNIEnv *, jclass) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_hasWheel(JNIEnv *env, jobject self) { return mHaswheel; } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetButtonCount(JNIEnv *, jclass) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getButtonCount(JNIEnv *env, jobject self) { return mButtoncount; } /** * Called when the Mouse instance is to be created */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createMouse(JNIEnv *env, jobject self) { HRESULT hr; initEventQueue(&event_queue, 5); @@ -149,7 +150,7 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nEnableBuffer(JNIEnv * env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableMouseBuffer(JNIEnv * env, jobject self) { buffer_enabled = true; } @@ -251,8 +252,8 @@ } } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nRead - (JNIEnv * env, jclass clazz, jobject buffer_obj, jint buffer_position) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_readMouse + (JNIEnv * env, jobject self, jobject buffer_obj, jint buffer_position) { jint* buffer_ptr = (jint *)env->GetDirectBufferAddress(buffer_obj) + buffer_position; int buffer_size = (env->GetDirectBufferCapacity(buffer_obj))/sizeof(jint) - buffer_position; @@ -264,14 +265,14 @@ return copyEvents(&event_queue, buffer_ptr, buffer_size); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getNativeCursorCaps + (JNIEnv *env, jobject self) { return org_lwjgl_input_Mouse_CURSOR_ONE_BIT_TRANSPARENCY; } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor - (JNIEnv *env, jclass clazz, jobject handle_buffer) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setNativeCursor + (JNIEnv *env, jobject self, jobject handle_buffer) { if (mDIDevice == NULL) throwException(env, "null device!"); @@ -286,29 +287,29 @@ } } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMaxCursorSize - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMaxCursorSize + (JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize - (JNIEnv *env, jclass clazz) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMinCursorSize + (JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyMouse(JNIEnv *env, jobject self) { ShutdownMouse(); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll(JNIEnv * env, jclass clazz, jobject coord_buffer_obj, jobject button_buffer_obj) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_pollMouse(JNIEnv * env, jobject self, jobject coord_buffer_obj, jobject button_buffer_obj) { mDIDevice->Acquire(); - UpdateMouseFields(env, clazz, coord_buffer_obj, button_buffer_obj); + UpdateMouseFields(env, coord_buffer_obj, button_buffer_obj); } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nGrabMouse - (JNIEnv * env, jclass clazz, jboolean grab) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_grabMouse + (JNIEnv * env, jobject self, jboolean grab) { mDIDevice->Unacquire(); if(grab) { @@ -443,7 +444,7 @@ /** * Updates the fields on the Mouse */ -static void UpdateMouseFields(JNIEnv *env, jclass clsMouse, jobject coord_buffer_obj, jobject button_buffer_obj) { +static void UpdateMouseFields(JNIEnv *env, jobject coord_buffer_obj, jobject button_buffer_obj) { HRESULT hRes; DIMOUSESTATE diMouseState; // State of Mouse Index: org_lwjgl_opengl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Display.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- org_lwjgl_opengl_Display.cpp 24 Oct 2004 17:29:24 -0000 1.28 +++ org_lwjgl_opengl_Display.cpp 2 Nov 2004 13:15:59 -0000 1.29 @@ -46,7 +46,7 @@ #include "common_tools.h" #include "extgl_wgl.h" #include "display.h" -#include "org_lwjgl_opengl_Display.h" +#include "org_lwjgl_opengl_Win32Display.h" static bool oneShotInitialised = false; // Registers the LWJGL window class @@ -525,8 +525,8 @@ * Method: nSetTitle * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSetTitle - (JNIEnv * env, jclass clazz, jstring title_obj) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setTitle + (JNIEnv * env, jobject self, jstring title_obj) { const char * title = env->GetStringUTFChars(title_obj, NULL); SetWindowText(display_hwnd, title); @@ -538,8 +538,8 @@ * Method: update * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nUpdate - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_update + (JNIEnv * env, jobject self) { handleMessages(); } @@ -550,8 +550,8 @@ * Method: swapBuffers * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_swapBuffers - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_swapBuffers + (JNIEnv * env, jobject self) { isDirty = false; SwapBuffers(display_hdc); @@ -562,8 +562,8 @@ * Method: nIsDirty * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsDirty - (JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isDirty + (JNIEnv *env, jobject self) { bool result = isDirty; isDirty = false; return result ? JNI_TRUE : JNI_FALSE; @@ -574,8 +574,8 @@ * Method: nIsVisible * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsVisible - (JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isVisible + (JNIEnv *env, jobject self) { return isMinimized ? JNI_FALSE : JNI_TRUE; } @@ -584,8 +584,8 @@ * Method: nIsCloseRequested * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsCloseRequested - (JNIEnv *, jclass) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isCloseRequested + (JNIEnv *env, jobject self) { bool saved = closerequested; closerequested = false; return saved; @@ -596,8 +596,8 @@ * Method: nIsActive * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Display_nIsActive - (JNIEnv *env, jclass clazz) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isActive + (JNIEnv *env, jobject self) { return isFocused; } @@ -606,8 +606,8 @@ * Method: nSetVSyncEnabled * Signature: (Z)Z */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSetVSyncEnabled - (JNIEnv * env, jclass clazz, jboolean sync) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setVSyncEnabled + (JNIEnv * env, jobject self, jboolean sync) { if (extgl_Extensions.WGL_EXT_swap_control) { if (sync == JNI_TRUE) { @@ -618,19 +618,19 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nMakeCurrent - (JNIEnv *env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_makeCurrent + (JNIEnv *env, jobject self) { BOOL result = wglMakeCurrent(display_hdc, display_hglrc); if (!result) throwException(env, "Could not make display context current"); } -JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Display_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz) { +JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Win32Display_getAvailableDisplayModes(JNIEnv *env, jobject self) { return getAvailableDisplayModes(env); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow(JNIEnv *env, jclass clazz, jobject mode, jboolean fullscreen, jint x, jint y) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createWindow(JNIEnv *env, jobject self, jobject mode, jboolean fullscreen, jint x, jint y) { closerequested = false; isMinimized = false; isFocused = true; @@ -668,35 +668,35 @@ SetFocus(display_hwnd); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nDestroyWindow(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyWindow(JNIEnv *env, jobject self) { closeWindow(display_hwnd, display_hdc); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jobject mode) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_switchDisplayMode(JNIEnv *env, jobject self, jobject mode) { switchDisplayMode(env, mode); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_resetDisplayMode(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_resetDisplayMode(JNIEnv *env, jobject self) { resetDisplayMode(env); } -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getGammaRampLength(JNIEnv *env, jobject self) { return getGammaRampLength(); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_setGammaRamp(JNIEnv *env, jclass clazz, jobject gamma_buffer) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setGammaRamp(JNIEnv *env, jobject self, jobject gamma_buffer) { setGammaRamp(env, gamma_buffer); } -JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Display_getAdapter(JNIEnv *env, jclass clazz) { +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Win32Display_getAdapter(JNIEnv *env, jobject self) { return getAdapter(env); } -JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Display_getVersion(JNIEnv *env, jclass clazz) { +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_Win32Display_getVersion(JNIEnv *env, jobject self) { return getVersion(env); } -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Display_init(JNIEnv *env, jclass clazz) { +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_Win32Display_init(JNIEnv *env, jobject self) { return initDisplay(env); } @@ -727,7 +727,7 @@ return true; } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_createContext(JNIEnv *env, jclass clazz, jobject pixel_format) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createContext(JNIEnv *env, jobject self, jobject pixel_format) { HWND dummy_hwnd = createWindow(0, 0, 1, 1, false, false); if (dummy_hwnd == NULL) { throwException(env, "Failed to create the window."); @@ -775,7 +775,7 @@ closeWindow(dummy_hwnd, dummy_hdc); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_destroyContext(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyContext(JNIEnv *env, jobject self) { wglMakeCurrent(NULL, NULL); // Delete the rendering context @@ -786,7 +786,7 @@ } } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nReshape(JNIEnv *env, jclass clazz, jint x, jint y, jint width, jint height) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_reshape(JNIEnv *env, jobject self, jint x, jint y, jint width, jint height) { if (isFullScreen) { return; } Index: org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- org_lwjgl_input_Keyboard.cpp 18 Oct 2004 20:29:52 -0000 1.37 +++ org_lwjgl_input_Keyboard.cpp 2 Nov 2004 13:15:59 -0000 1.38 @@ -43,6 +43,7 @@ #define DIRECTINPUT_VERSION 0x0300 #include "Window.h" #include <dinput.h> +#include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_input_Keyboard.h" #include "common_tools.h" @@ -57,13 +58,8 @@ static bool useUnicode; -/* - * Class: org_lwjgl_input_Keyboard - * Method: nCreate - * Signature: ()Z - */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createKeyboard + (JNIEnv * env, jobject self) { // Create input HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); @@ -112,8 +108,8 @@ * Method: nDestroy * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyKeyboard + (JNIEnv * env, jobject self) { // Release keyboard if (lpdiKeyboard != NULL) { @@ -134,8 +130,8 @@ * Method: nPoll * Signature: (I)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll - (JNIEnv * env, jclass clazz, jobject buffer) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_pollKeyboard + (JNIEnv * env, jobject self, jobject buffer) { HRESULT ret; do { @@ -166,8 +162,8 @@ lpdiKeyboard->GetDeviceState((DWORD)buffer_size, keyboardBuffer); } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead - (JNIEnv * env, jclass clazz, jobject buffer_obj, jint buffer_position) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_readKeyboard + (JNIEnv * env, jobject self, jobject buffer_obj, jint buffer_position) { static DIDEVICEOBJECTDATA rgdod[KEYBOARD_BUFFER_SIZE]; wchar_t transBufUnicode[KEYBOARD_BUFFER_SIZE]; @@ -272,8 +268,8 @@ * Method: nEnableTranslation * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation - (JNIEnv *, jclass) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableTranslation + (JNIEnv *env, jobject self) { // We can't do translation on DOS boxes it seems so we'll have to throw a wobbler // here: @@ -290,12 +286,12 @@ translationEnabled = true; } -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer - (JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableKeyboardBuffer + (JNIEnv * env, jobject self) { } -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nisStateKeySet(JNIEnv *env, jclass clazz, jint key) +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_isStateKeySet(JNIEnv *env, jobject self, jint key) { int state = org_lwjgl_input_Keyboard_STATE_UNKNOWN; switch(key) { |