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-09 15:49:02
|
Update of /cvsroot/java-game-lib/LWJGL/platform_build/win32_ms_cmdline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19989/platform_build/win32_ms_cmdline Modified Files: build.bat Log Message: Fix win32 build script Index: build.bat =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/platform_build/win32_ms_cmdline/build.bat,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- build.bat 24 Oct 2004 20:42:20 -0000 1.8 +++ build.bat 9 Dec 2004 15:48:49 -0000 1.9 @@ -10,7 +10,7 @@ set LINKEROPTS=/link /LIBPATH:"%ALHOME%\libs" /LIBPATH:"%EAXHOME%\Libs" /LIBPATH:"%DXHOME%\Lib" /LIBPATH:"%PLTSDKHOME%\Lib" /LIBPATH:"%CHOME%\Lib" set LIBS=dinput.lib dxguid.lib OpenAL32.lib alut.lib eaxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib -for %%x in (..\..\src\native\win32\*.cpp) do cl %COPTIONS% %%x +for %%x in (..\..\src\native\win32\*.c) do cl %COPTIONS% %%x for %%x in (..\..\src\native\common\*.c) do cl %COPTIONS% %%x for %%x in (..\..\src\native\common\arb\*.c) do cl %COPTIONS% %%x for %%x in (..\..\src\native\common\nv\*.c) do cl %COPTIONS% %%x |
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17551/src/native/win32 Added Files: LWJGL.c display.c extgl_wgl.c org_lwjgl_Sys.c org_lwjgl_input_Controller.c org_lwjgl_input_Cursor.c org_lwjgl_input_Keyboard.c org_lwjgl_input_Mouse.c org_lwjgl_opengl_Display.c org_lwjgl_opengl_Pbuffer.c Removed Files: LWJGL.cpp display.cpp extgl_wgl.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Controller.cpp org_lwjgl_input_Cursor.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Display.cpp org_lwjgl_opengl_Pbuffer.cpp Log Message: Converted win32 specific native source from C++->C (removes the strange debug flag behaviour exhibited by SourceLimitTest.java) --- NEW FILE: LWJGL.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' 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 * "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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: LWJGL.c,v 1.1 2004/12/09 15:36:13 elias_naur Exp $ * * Basic DLL stub. * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdio.h> HINSTANCE dll_handle; /* * DLL entry point for Windows. Called when Java loads the .dll */ BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module DWORD fdwReason, // reason for calling function LPVOID lpvReserved // reserved ) { dll_handle = hinstDLL; return TRUE; // Success } --- org_lwjgl_opengl_Display.cpp DELETED --- --- NEW FILE: org_lwjgl_input_Controller.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' 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 * "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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Controller.c,v 1.1 2004/12/09 15:36:13 elias_naur Exp $ * * Win32 controller handling. * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ #undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x0500 #include "Window.h" #include "org_lwjgl_input_Controller.h" #include <dinput.h> #include "common_tools.h" #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 HINSTANCE dll_handle; static IDirectInput* cDI; // DI instance static IDirectInputDevice2* cDIDevice; // DI Device instance static DIJOYSTATE2 cJS; // State of Controller static int cButtoncount = 0; // Temporary buttoncount static bool cHasx; // Temporary xaxis check static bool cHasrx; // Temporary rotational xaxis check static bool cHasy; // Temporary yaxis check static bool cHasry; // Temporary rotational yaxis check static bool cHasz; // Temporary zaxis check static bool cHasrz; // Temporary rotational zaxis check static bool cHaspov; // Temporary pov check static bool cHasslider; // Temporary slider check static bool cCreate_success; // bool used to determine successfull creation static bool cFirstTimeInitialization = true; // boolean to determine first time initialization // Cached fields of Controller.java static jfieldID fidCButtonCount; static jfieldID fidCHasXAxis; static jfieldID fidCHasRXAxis; static jfieldID fidCHasYAxis; static jfieldID fidCHasRYAxis; static jfieldID fidCHasZAxis; static jfieldID fidCHasRZAxis; static jfieldID fidCHasPOV; static jfieldID fidCHasSlider; static jfieldID fidCButtons; static jfieldID fidCX; static jfieldID fidCRX; static jfieldID fidCY; static jfieldID fidCRY; static jfieldID fidCZ; static jfieldID fidCRZ; static jfieldID fidCPOV; static jfieldID fidCSlider; // Function prototypes (defined in the cpp file, since header file is generic across platforms void EnumerateControllerCapabilities(); void EnumerateControllers(); BOOL CALLBACK EnumControllerCallback(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef); BOOL CALLBACK EnumControllerObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef); void ShutdownController(); void CreateController(LPCDIDEVICEINSTANCE lpddi); void SetupController(); void InitializeControllerFields(JNIEnv *env, jclass clsController); void CacheControllerFields(JNIEnv *env, jclass clsController); void UpdateControllerFields(JNIEnv *env, jclass clsController); void SetControllerCapabilities(JNIEnv *env, jclass clsController); /** * Initializes any field ids */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_initIDs(JNIEnv * env, jclass clazz) { /* Cache fields in Controller */ CacheControllerFields(env, clazz); } /** * Called when the Controller instance is to be created */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) { // Create the DirectInput object. HRESULT hr; hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL); if (FAILED(hr)) { ShutdownController(); throwException(env, "DirectInputCreate failed\n"); return; } /* Find all Controllers */ EnumerateControllers(); if (!cCreate_success) { ShutdownController(); throwException(env, "Failed to enumerate."); return; } /* check that we got at least 1 controller */ if (cDIDevice == NULL) { ShutdownController(); throwException(env, "No devices found."); return; } //check for first time initialization - need to detect capabilities if (cFirstTimeInitialization) { cFirstTimeInitialization = false; /* Enumerate capabilities of Controller */ EnumerateControllerCapabilities(); if (!cCreate_success) { ShutdownController(); throwException(env, "Falied to enumerate capabilities."); return; } /* Do setup of Controller */ SetupController(); /* Initialize any fields on the Controller */ InitializeControllerFields(env, clazz); /* Set capabilities */ SetControllerCapabilities(env, clazz); } else { if(cCreate_success) { /* Do setup of Controller */ SetupController(); /* Initialize any fields on the Controller */ InitializeControllerFields(env, clazz); } } /* Aquire the Controller */ hr = IDirectInputDevice_Acquire(cDIDevice); if(FAILED(hr)) { ShutdownController(); throwException(env, "Acquire failed"); return; } } /* * Class: org_lwjgl_input_Controller * Method: nDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nDestroy(JNIEnv *env, jclass clazz) { ShutdownController(); } /* * Class: org_lwjgl_input_Controller * Method: nPoll * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nPoll(JNIEnv * env, jclass clazz) { HRESULT hRes; // poll the Controller to read the current state hRes = IDirectInputDevice2_Poll(cDIDevice); if (FAILED(hRes)) { printfDebug("Poll fail\n"); //check if we need to reaquire if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { IDirectInputDevice_Acquire(cDIDevice); printfDebug("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); } return; } UpdateControllerFields(env, clazz); } /** * Shutdown DI */ static void ShutdownController() { // release device if (cDIDevice != NULL) { IDirectInputDevice_Unacquire(cDIDevice); IDirectInputDevice_Release(cDIDevice); cDIDevice = NULL; } } /** * Enumerates the capabilities of the Controller attached to the system */ static void EnumerateControllerCapabilities() { HRESULT hr; hr = IDirectInputDevice_EnumObjects(cDIDevice, EnumControllerObjectsCallback, NULL, DIDFT_ALL); if FAILED(hr) { printfDebug("EnumObjects failed\n"); cCreate_success = false; return; } cCreate_success = true; } /** * Enumerates the Controllers attached to the system */ static void EnumerateControllers() { HRESULT hr; hr = IDirectInput_EnumDevices(cDI, DIDEVTYPE_JOYSTICK, EnumControllerCallback, 0, DIEDFL_ATTACHEDONLY); if FAILED(hr) { printfDebug("EnumDevices failed\n"); cCreate_success = false; return; } cCreate_success = true; } /** * Callback from EnumDevices. Called for each Controller attached to the system */ BOOL CALLBACK EnumControllerCallback(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef) { /* Add the Controller */ CreateController(pdinst); /* just stop after 1st Controller */ return DIENUM_STOP; } /** * Callback from EnumObjects. Called for each "object" on the Controller. */ BOOL CALLBACK EnumControllerObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { printfDebug("found %s\n", lpddoi->tszName); if(IsEqualGUID(&lpddoi->guidType, &GUID_Button)) { cButtoncount++; } else if(IsEqualGUID(&lpddoi->guidType, &GUID_XAxis)) { cHasx = true; } else if(IsEqualGUID(&lpddoi->guidType, &GUID_YAxis)) { cHasy = true; } else if(IsEqualGUID(&lpddoi->guidType, &GUID_ZAxis)) { cHasz = true; } else if (IsEqualGUID(&lpddoi->guidType, &GUID_POV)) { cHaspov = true; } else if (IsEqualGUID(&lpddoi->guidType, &GUID_Slider)) { cHasslider = true; } else if (IsEqualGUID(&lpddoi->guidType, &GUID_RxAxis)) { cHasrx = true; } else if (IsEqualGUID(&lpddoi->guidType, &GUID_RyAxis)) { cHasry = true; } else if (IsEqualGUID(&lpddoi->guidType, &GUID_RzAxis)) { cHasrz = true; } else { printfDebug("Unhandled object found: %s\n", lpddoi->tszName); } return DIENUM_CONTINUE; } /** * Creates the specified device as a Controller */ static void CreateController(LPCDIDEVICEINSTANCE lpddi) { HRESULT hr; hr = IDirectInput_CreateDevice(cDI, &lpddi->guidInstance, (LPDIRECTINPUTDEVICE*) &cDIDevice, NULL); if FAILED(hr) { printfDebug("CreateDevice failed\n"); cCreate_success = false; return; } cCreate_success = true; } /** * Sets up the Controller properties */ static void SetupController() { DIPROPRANGE diprg; // set Controller data format if(IDirectInputDevice_SetDataFormat(cDIDevice, &c_dfDIJoystick2) != DI_OK) { printfDebug("SetDataFormat failed\n"); cCreate_success = false; return; } // set the cooperative level if(IDirectInputDevice_SetCooperativeLevel(cDIDevice, getCurrentHWND(), DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { printfDebug("SetCooperativeLevel failed\n"); cCreate_success = false; return; } // set range to (-1000 ... +1000) // This lets us test against 0 to see which way the stick is pointed. diprg.diph.dwSize = sizeof(diprg); diprg.diph.dwHeaderSize = sizeof(diprg.diph); diprg.diph.dwHow = DIPH_BYOFFSET; diprg.lMin = CONTROLLER_AXISMIN; diprg.lMax = CONTROLLER_AXISMAX; // set X-axis if(cHasx) { diprg.diph.dwObj = DIJOFS_X; if(IDirectInputDevice_SetProperty(cDIDevice, DIPROP_RANGE, &diprg.diph) != DI_OK) { printfDebug("SetProperty(DIJOFS_X) failed\n"); cCreate_success = false; return; } } // set RX-axis if(cHasrx) { diprg.diph.dwObj = DIJOFS_RX; if(IDirectInputDevice_SetProperty(cDIDevice, DIPROP_RANGE, &diprg.diph) != DI_OK) { printfDebug("SetProperty(DIJOFS_RX) failed\n"); cCreate_success = false; return; } } // set Y-axis if(cHasy) { diprg.diph.dwObj = DIJOFS_Y; if(IDirectInputDevice_SetProperty(cDIDevice, DIPROP_RANGE, &diprg.diph) != DI_OK) { printfDebug("SetProperty(DIJOFS_Y) failed\n"); cCreate_success = false; return; } } // set RY-axis if(cHasry) { diprg.diph.dwObj = DIJOFS_RY; if(IDirectInputDevice_SetProperty(cDIDevice, DIPROP_RANGE, &diprg.diph) != DI_OK) { printfDebug("SetProperty(DIJOFS_RY) failed\n"); cCreate_success = false; return; } } // set Z-axis if(cHasz) { diprg.diph.dwObj = DIJOFS_Z; if(IDirectInputDevice_SetProperty(cDIDevice, DIPROP_RANGE, &diprg.diph) != DI_OK) { printfDebug("SetProperty(DIJOFS_Z) failed\n"); cCreate_success = false; return; } } // set RZ-axis if(cHasrz) { diprg.diph.dwObj = DIJOFS_RZ; if(IDirectInputDevice_SetProperty(cDIDevice, DIPROP_RANGE, &diprg.diph) != DI_OK) { printfDebug("SetProperty(DIJOFS_RZ) failed\n"); cCreate_success = false; return; } } // // Lastly slider // using z axis since we're running dx 5 // if(cHasslider) { diprg.diph.dwObj = DIJOFS_Z; if(IDirectInputDevice_SetProperty(cDIDevice, DIPROP_RANGE, &diprg.diph) != DI_OK) { printfDebug("SetProperty(DIJOFS_Z(SLIDER)) failed\n"); cCreate_success = false; return; } } cCreate_success = true; } /** * Sets the fields on the Controller */ static void InitializeControllerFields(JNIEnv *env, jclass clsController) { //create buttons array jbooleanArray cButtonsArray = (*env)->NewBooleanArray(env, cButtoncount); //set buttons array (*env)->SetStaticObjectField(env, clsController, fidCButtons, cButtonsArray); } /** * Updates the fields on the Controller */ static void UpdateControllerFields(JNIEnv *env, jclass clsController) { int i; jbyteArray buttonsArray; HRESULT hRes; // get data from the Controller hRes = IDirectInputDevice_GetDeviceState(cDIDevice, 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 || hRes == DIERR_NOTACQUIRED) { IDirectInputDevice_Acquire(cDIDevice); printfDebug("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); } printfDebug("Error getting controller state: %d\n", hRes); return; } //axis's if(cHasx) { (*env)->SetStaticIntField(env, clsController, fidCX, cJS.lX); } if(cHasy) { (*env)->SetStaticIntField(env, clsController, fidCY, cJS.lY); } if(cHasz) { (*env)->SetStaticIntField(env, clsController, fidCZ, cJS.lZ); } //rotational axis if(cHasrx) { (*env)->SetStaticIntField(env, clsController, fidCRX, cJS.lRx); } if(cHasry) { (*env)->SetStaticIntField(env, clsController, fidCRY, cJS.lRy); } if(cHasrz) { (*env)->SetStaticIntField(env, clsController, fidCRZ, cJS.lRz); } //buttons for (i = 0; i < cButtoncount; i++) { if (cJS.rgbButtons[i] != 0) { cJS.rgbButtons[i] = 1; } else { cJS.rgbButtons[i] = 0; } } buttonsArray = (jbyteArray) (*env)->GetStaticObjectField(env, clsController, fidCButtons); (*env)->SetByteArrayRegion(env, buttonsArray, 0, cButtoncount, (jbyte *)cJS.rgbButtons); //pov if(cHaspov) { (*env)->SetStaticIntField(env, clsController, fidCPOV, cJS.rgdwPOV[0]); } //slider if(cHasslider) { (*env)->SetStaticIntField(env, clsController, fidCSlider, cJS.lZ); } } /** * Sets the capabilities of the Controller */ static void SetControllerCapabilities(JNIEnv *env, jclass clsController) { //set buttoncount (*env)->SetStaticIntField(env, clsController, fidCButtonCount, cButtoncount); //set axis (*env)->SetStaticBooleanField(env, clsController, fidCHasXAxis, cHasx); (*env)->SetStaticBooleanField(env, clsController, fidCHasYAxis, cHasy); (*env)->SetStaticBooleanField(env, clsController, fidCHasZAxis, cHasz); //set rotational axis (*env)->SetStaticBooleanField(env, clsController, fidCHasRXAxis, cHasrx); (*env)->SetStaticBooleanField(env, clsController, fidCHasRYAxis, cHasry); (*env)->SetStaticBooleanField(env, clsController, fidCHasRZAxis, cHasrz); //set pov (*env)->SetStaticBooleanField(env, clsController, fidCHasPOV, cHaspov); //set slider (*env)->SetStaticBooleanField(env, clsController, fidCHasSlider, cHasslider); } /** * Caches the field ids for quicker access */ static void CacheControllerFields(JNIEnv *env, jclass clsController) { fidCButtonCount = (*env)->GetStaticFieldID(env, clsController, "buttonCount", "I"); fidCHasXAxis = (*env)->GetStaticFieldID(env, clsController, "hasXAxis", "Z"); fidCHasRXAxis = (*env)->GetStaticFieldID(env, clsController, "hasRXAxis", "Z"); fidCHasYAxis = (*env)->GetStaticFieldID(env, clsController, "hasYAxis", "Z"); fidCHasRYAxis = (*env)->GetStaticFieldID(env, clsController, "hasRYAxis", "Z"); fidCHasZAxis = (*env)->GetStaticFieldID(env, clsController, "hasZAxis", "Z"); fidCHasRZAxis = (*env)->GetStaticFieldID(env, clsController, "hasRZAxis", "Z"); fidCHasPOV = (*env)->GetStaticFieldID(env, clsController, "hasPOV", "Z"); fidCHasSlider = (*env)->GetStaticFieldID(env, clsController, "hasSlider", "Z"); fidCButtons = (*env)->GetStaticFieldID(env, clsController, "buttons", "[Z"); fidCX = (*env)->GetStaticFieldID(env, clsController, "x", "I"); fidCRX = (*env)->GetStaticFieldID(env, clsController, "rx", "I"); fidCY = (*env)->GetStaticFieldID(env, clsController, "y", "I"); fidCRY = (*env)->GetStaticFieldID(env, clsController, "ry", "I"); fidCZ = (*env)->GetStaticFieldID(env, clsController, "z", "I"); fidCRZ = (*env)->GetStaticFieldID(env, clsController, "rz", "I"); fidCPOV = (*env)->GetStaticFieldID(env, clsController, "pov", "I"); fidCSlider = (*env)->GetStaticFieldID(env, clsController, "slider", "I"); } --- org_lwjgl_opengl_Pbuffer.cpp DELETED --- --- NEW FILE: extgl_wgl.c --- /* ---------------------------------------------------------------------------- Copyright (c) 2001-2002, Lev Povalahev All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The name of the author 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 "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 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------*/ /* Lev Povalahev le...@gm... http://www.uni-karlsruhe.de/~uli2/ */ #include <stdio.h> #include <string.h> #include "extgl.h" #include "extgl_wgl.h" #include "common_tools.h" /* WGL_EXT_etxension_string */ wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT = NULL; /* WGL_ARB_extension_string */ wglGetExtensionsStringARBPROC wglGetExtensionsStringARB = NULL; /* WGL_ARB_pbuffer */ wglCreatePbufferARBPROC wglCreatePbufferARB = NULL; wglGetPbufferDCARBPROC wglGetPbufferDCARB = NULL; wglReleasePbufferDCARBPROC wglReleasePbufferDCARB = NULL; wglDestroyPbufferARBPROC wglDestroyPbufferARB = NULL; wglQueryPbufferARBPROC wglQueryPbufferARB = NULL; /* WGL_ARB_pixel_format */ wglGetPixelFormatAttribivARBPROC wglGetPixelFormatAttribivARB = NULL; wglGetPixelFormatAttribfvARBPROC wglGetPixelFormatAttribfvARB = NULL; wglChoosePixelFormatARBPROC wglChoosePixelFormatARB = NULL; /* WGL_ARB_render_texture */ wglBindTexImageARBPROC wglBindTexImageARB = NULL; wglReleaseTexImageARBPROC wglReleaseTexImageARB = NULL; wglSetPbufferAttribARBPROC wglSetPbufferAttribARB = NULL; /* WGL_EXT_swap_control */ wglSwapIntervalEXTPROC wglSwapIntervalEXT = NULL; wglGetSwapIntervalEXTPROC wglGetSwapIntervalEXT = NULL; /* WGL_ARB_make_current_read */ wglMakeContextCurrentARBPROC wglMakeContextCurrentARB = NULL; wglGetCurrentReadDCARBPROC wglGetCurrentReadDCARB = NULL; /** returns true if the extention is available */ static bool WGLQueryExtension(JNIEnv *env, const char *name) { const GLubyte *extensions; if (wglGetExtensionsStringARB == NULL) if (wglGetExtensionsStringEXT == NULL) return false; else extensions = (GLubyte*)wglGetExtensionsStringEXT(); else extensions = (GLubyte*)wglGetExtensionsStringARB(wglGetCurrentDC()); return extgl_QueryExtension(env, extensions, name); } static void extgl_InitWGLARBPbuffer(JNIEnv *env) { ExtFunction functions[] = { {"wglCreatePbufferARB", (void **)&wglCreatePbufferARB}, {"wglGetPbufferDCARB", (void **)&wglGetPbufferDCARB}, {"wglReleasePbufferDCARB", (void **)&wglReleasePbufferDCARB}, {"wglDestroyPbufferARB", (void **)&wglDestroyPbufferARB}, {"wglQueryPbufferARB", (void **)&wglQueryPbufferARB}}; if (extgl_Extensions.WGL_ARB_pbuffer) extgl_Extensions.WGL_ARB_pbuffer = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBPixelFormat(JNIEnv *env) { ExtFunction functions[] = { {"wglGetPixelFormatAttribivARB", (void **)&wglGetPixelFormatAttribivARB}, {"wglGetPixelFormatAttribfvARB", (void **)&wglGetPixelFormatAttribfvARB}, {"wglChoosePixelFormatARB", (void **)&wglChoosePixelFormatARB}}; if (extgl_Extensions.WGL_ARB_pixel_format) extgl_Extensions.WGL_ARB_pixel_format = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBRenderTexture(JNIEnv *env) { ExtFunction functions[] = { {"wglBindTexImageARB", (void **)&wglBindTexImageARB}, {"wglReleaseTexImageARB", (void **)&wglReleaseTexImageARB}, {"wglSetPbufferAttribARB", (void **)&wglSetPbufferAttribARB}}; if (extgl_Extensions.WGL_ARB_render_texture) extgl_Extensions.WGL_ARB_render_texture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLEXTSwapControl(JNIEnv *env) { ExtFunction functions[] = { {"wglSwapIntervalEXT", (void **)&wglSwapIntervalEXT}, {"wglGetSwapIntervalEXT", (void **)&wglGetSwapIntervalEXT}}; if (extgl_Extensions.WGL_EXT_swap_control) extgl_Extensions.WGL_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitWGLARBMakeCurrentRead(JNIEnv *env) { ExtFunction functions[] = { {"wglMakeContextCurrentARB", (void **)&wglMakeContextCurrentARB}, {"wglGetCurrentReadDCARB", (void **)&wglGetCurrentReadDCARB}}; if (extgl_Extensions.WGL_ARB_make_current_read) extgl_Extensions.WGL_ARB_make_current_read = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } static void extgl_InitSupportedWGLExtensions(JNIEnv *env) { extgl_Extensions.WGL_ARB_buffer_region = WGLQueryExtension(env, "WGL_ARB_buffer_region"); extgl_Extensions.WGL_ARB_make_current_read = WGLQueryExtension(env, "WGL_ARB_make_current_read"); extgl_Extensions.WGL_ARB_multisample = WGLQueryExtension(env, "WGL_ARB_multisample"); extgl_Extensions.WGL_ARB_pbuffer = WGLQueryExtension(env, "WGL_ARB_pbuffer"); extgl_Extensions.WGL_ARB_pixel_format = WGLQueryExtension(env, "WGL_ARB_pixel_format"); extgl_Extensions.WGL_ARB_render_texture = WGLQueryExtension(env, "WGL_ARB_render_texture"); extgl_Extensions.WGL_EXT_swap_control = WGLQueryExtension(env, "WGL_EXT_swap_control"); extgl_Extensions.WGL_NV_render_depth_texture = WGLQueryExtension(env, "WGL_NV_render_depth_texture"); extgl_Extensions.WGL_NV_render_texture_rectangle = WGLQueryExtension(env, "WGL_NV_render_texture_rectangle"); } void extgl_InitWGL(JNIEnv *env) { ExtFunction functions[] = { {"wglGetExtensionsStringARB", (void **)&wglGetExtensionsStringARB}, {"wglGetExtensionsStringEXT", (void **)&wglGetExtensionsStringEXT}}; extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); extgl_Extensions.WGL_ARB_extensions_string = wglGetExtensionsStringARB != NULL; extgl_Extensions.WGL_EXT_extensions_string = wglGetExtensionsStringEXT != NULL; extgl_InitSupportedWGLExtensions(env); extgl_InitWGLARBMakeCurrentRead(env); extgl_InitWGLEXTSwapControl(env); extgl_InitWGLARBRenderTexture(env); extgl_InitWGLARBPixelFormat(env); extgl_InitWGLARBPbuffer(env); //extgl_InitWGLARBBufferRegion(env); } --- NEW FILE: display.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' 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 * "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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: display.c,v 1.1 2004/12/09 15:36:13 elias_naur Exp $ * * Win32 specific library for display handling. * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #include <windows.h> #include <jni.h> #include "display.h" #include "common_tools.h" #define WINDOWCLASSNAME "LWJGLWINDOW" #define GAMMA_SIZE (3*256) static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env); static jobjectArray GetAvailableDisplayModes(JNIEnv * env); static char * getDriver(); static bool modeSet = false; // Whether we've done a display mode change static WORD originalGamma[GAMMA_SIZE]; // Original gamma settings static WORD currentGamma[GAMMA_SIZE]; // Current gamma settings static DEVMODE devmode; // Now we'll remember this value for the future extern HWND display_hwnd; // Handle to the window extern RECT clientSize; jobjectArray getAvailableDisplayModes(JNIEnv *env) { jobjectArray result = GetAvailableDisplayModesEx(env); if (result == NULL) { printfDebug("Extended display mode selection failed, using fallback\n"); result = GetAvailableDisplayModes(env); } return result; } /** * Choose displaymodes using extended codepath (multiple displaydevices) */ static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env) { typedef BOOL (WINAPI * EnumDisplayDevicesAPROC)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags); typedef BOOL (WINAPI * EnumDisplaySettingsExAPROC)(IN LPCSTR lpszDeviceName, IN DWORD iModeNum, OUT LPDEVMODEA lpDevMode, IN DWORD dwFlags); EnumDisplayDevicesAPROC EnumDisplayDevicesA; EnumDisplaySettingsExAPROC EnumDisplaySettingsExA; HMODULE lib_handle = LoadLibrary("user32.dll"); int i = 0, j = 0, n = 0; int AvailableModes = 0; DISPLAY_DEVICE DisplayDevice; DEVMODE DevMode; jclass displayModeClass; jobjectArray ret; jmethodID displayModeConstructor; if (lib_handle == NULL) { printfDebug("Could not load user32.dll\n"); return NULL; } EnumDisplayDevicesA = (EnumDisplayDevicesAPROC)GetProcAddress(lib_handle, "EnumDisplayDevicesA"); if (EnumDisplayDevicesA == NULL) return NULL; EnumDisplaySettingsExA = (EnumDisplaySettingsExAPROC)GetProcAddress(lib_handle, "EnumDisplaySettingsExA"); if (EnumDisplaySettingsExA == NULL) return NULL; ZeroMemory(&DevMode, sizeof(DEVMODE)); ZeroMemory(&DisplayDevice, sizeof(DISPLAY_DEVICE)); DevMode.dmSize = sizeof(DEVMODE); DisplayDevice.cb = sizeof(DISPLAY_DEVICE); //enumerate all displays, and all of their displaymodes while(EnumDisplayDevicesA(NULL, i++, &DisplayDevice, 0) != 0) { // continue if mirroring device if((DisplayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) != 0) { continue; } // go ahead printfDebug("Querying %s device\n", DisplayDevice.DeviceString); j = 0; while(EnumDisplaySettingsExA((const char *) DisplayDevice.DeviceName, j++, &DevMode, 0) != 0) { if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { AvailableModes++; } } } printfDebug("Found %d displaymodes\n", AvailableModes); // now that we have the count create the classes, and add 'em all - we'll remove dups in Java // Allocate an array of DisplayModes big enough displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); ret = (*env)->NewObjectArray(env, AvailableModes, displayModeClass, NULL); displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "<init>", "(IIII)V"); i = 0, n = 0; while(EnumDisplayDevicesA(NULL, i++, &DisplayDevice, 0) != 0) { // continue if mirroring device if((DisplayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) != 0) { continue; } j = 0; while(EnumDisplaySettingsExA((const char *) DisplayDevice.DeviceName, j++, &DevMode, 0) != 0) { // Filter out indexed modes if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { jobject displayMode; displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, DevMode.dmPelsWidth, DevMode.dmPelsHeight, DevMode.dmBitsPerPel, DevMode.dmDisplayFrequency); (*env)->SetObjectArrayElement(env, ret, n++, displayMode); } } } FreeLibrary(lib_handle); return ret; } /** * Choose displaymodes using standard codepath (single displaydevice) */ static jobjectArray GetAvailableDisplayModes(JNIEnv * env) { int i = 0, j = 0, n = 0; int AvailableModes = 0; DEVMODE DevMode; jclass displayModeClass; jobjectArray ret; jmethodID displayModeConstructor; ZeroMemory(&DevMode, sizeof(DEVMODE)); DevMode.dmSize = sizeof(DEVMODE); //enumerate all displaymodes while(EnumDisplaySettings(NULL, j++, &DevMode) != 0) { if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { AvailableModes++; } } printfDebug("Found %d displaymodes\n", AvailableModes); // now that we have the count create the classes, and add 'em all - we'll remove dups in Java // Allocate an array of DisplayModes big enough displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); ret = (*env)->NewObjectArray(env, AvailableModes, displayModeClass, NULL); displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "<init>", "(IIII)V"); i = 0, j = 0, n = 0; while(EnumDisplaySettings(NULL, j++, &DevMode) != 0) { // Filter out indexed modes if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { jobject displayMode; displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, DevMode.dmPelsWidth, DevMode.dmPelsHeight, DevMode.dmBitsPerPel, DevMode.dmDisplayFrequency); (*env)->SetObjectArrayElement(env, ret, n++, displayMode); } } return ret; } void switchDisplayMode(JNIEnv * env, jobject mode) { jclass cls_displayMode = (*env)->GetObjectClass(env, mode); jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); jfieldID fid_bpp = (*env)->GetFieldID(env, cls_displayMode, "bpp", "I"); jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I"); int width = (*env)->GetIntField(env, mode, fid_width); int height = (*env)->GetIntField(env, mode, fid_height); int bpp = (*env)->GetIntField(env, mode, fid_bpp); int freq = (*env)->GetIntField(env, mode, fid_freq); LONG cdsret; devmode.dmSize = sizeof(DEVMODE); devmode.dmBitsPerPel = bpp; devmode.dmPelsWidth = width; devmode.dmPelsHeight = height; devmode.dmDisplayFlags = 0; devmode.dmDisplayFrequency = freq; devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFLAGS; if (freq != 0) devmode.dmFields |= DM_DISPLAYFREQUENCY; cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { // Failed: so let's check to see if it's a wierd dual screen display printfDebug("Failed to set display mode... assuming dual monitors\n"); devmode.dmPelsWidth = width * 2; cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { printfDebug("Failed to set display mode using dual monitors\n"); throwException(env, "Failed to set display mode."); return; } } modeSet = true; } int getGammaRampLength(void) { return 256; } void setGammaRamp(JNIEnv * env, jobject gammaRampBuffer) { int i; float scaledRampEntry; WORD rampEntry; HDC screenDC; const float *gammaRamp = (const float *)(*env)->GetDirectBufferAddress(env, gammaRampBuffer); // Turn array of floats into array of RGB WORDs for (i = 0; i < 256; i ++) { scaledRampEntry = gammaRamp[i]*0xffff; rampEntry = (WORD)scaledRampEntry; currentGamma[i] = rampEntry; currentGamma[i + 256] = rampEntry; currentGamma[i + 512] = rampEntry; } screenDC = GetDC(NULL); if (SetDeviceGammaRamp(screenDC, currentGamma) == FALSE) { throwException(env, "Failed to set device gamma."); } ReleaseDC(NULL, screenDC); } jobject initDisplay(JNIEnv * env) { int width; int height; int bpp; int freq; jclass jclass_DisplayMode; jmethodID ctor; jobject newMode; // Determine the current screen resolution // Get the screen HDC screenDC = GetDC(NULL); if (!screenDC) { throwException(env, "Couldn't get screen DC!"); return NULL; } // Get the device caps width = GetDeviceCaps(screenDC, HORZRES); height = GetDeviceCaps(screenDC, VERTRES); bpp = GetDeviceCaps(screenDC, BITSPIXEL); freq = GetDeviceCaps(screenDC, VREFRESH); if (freq <= 1) freq = 0; // Unknown jclass_DisplayMode = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); ctor = (*env)->GetMethodID(env, jclass_DisplayMode, "<init>", "(IIII)V"); newMode = (*env)->NewObject(env, jclass_DisplayMode, ctor, width, height, bpp, freq); // Get the default gamma ramp if (GetDeviceGammaRamp(screenDC, originalGamma) == FALSE) { printfDebug("Failed to get initial device gamma\n"); } memcpy(currentGamma, originalGamma, sizeof(WORD)*GAMMA_SIZE); ReleaseDC(NULL, screenDC); return newMode; } void resetDisplayMode(JNIEnv * env) { // Return device gamma to normal HDC screenDC = GetDC(NULL); if (!SetDeviceGammaRamp(screenDC, originalGamma)) { printfDebug("Could not reset device gamma\n"); } ReleaseDC(NULL, screenDC); if (modeSet) { modeSet = false; // Under Win32, all we have to do is: ChangeDisplaySettings(NULL, 0); // And we'll call init() again to put the correct mode back in Display if (env != NULL) initDisplay(env); } } /* * Put display settings back to what they were when the window is maximized. */ void restoreDisplayMode(void) { // Restore gamma HDC screenDC = GetDC(NULL); LONG cdsret; if (!SetDeviceGammaRamp(screenDC, currentGamma)) { printfDebug("Could not restore device gamma\n"); } ReleaseDC(NULL, screenDC); if (!modeSet) { printfDebug("Attempting to restore the display mode\n"); modeSet = true; cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { printfDebug("Failed to restore display mode\n"); } } } static char * getDriver() { #define MY_BUFSIZE 256 HKEY hKey; static TCHAR szAdapterKey[MY_BUFSIZE], szDriverValue[MY_BUFSIZE]; DWORD dwBufLen = MY_BUFSIZE; LONG lRet; if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DeviceMap\\Video"), 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) return NULL; lRet = RegQueryValueEx(hKey, TEXT("\\Device\\Video0"), NULL, NULL, (LPBYTE)szAdapterKey, &dwBufLen); RegCloseKey(hKey); if(lRet != ERROR_SUCCESS) return NULL; printfDebug("Adapter key: %s\n", szAdapterKey); // szAdapterKey now contains something like \Registry\Machine\System\CurrentControlSet\Control\Video\{B70DBD2A-90C4-41CF-A58E-F3BA69F1A6BC}\0000 // We'll check for the first chunk: if (strnicmp("\\Registry\\Machine", szAdapterKey, 17) == 0) { // Yes, it's right, so let's look for that key now TCHAR szDriverKey[MY_BUFSIZE]; strcpy(szDriverKey, &szAdapterKey[18]); if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT(szDriverKey), 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) return NULL; lRet = RegQueryValueEx(hKey, TEXT("InstalledDisplayDrivers"), NULL, NULL, (LPBYTE)szDriverValue, &dwBufLen); RegCloseKey(hKey); } if(lRet != ERROR_SUCCESS) return NULL; return szDriverValue; } jstring getAdapter(JNIEnv * env) { jstring ret = NULL; char *driver = getDriver(); if (driver == NULL) { return NULL; } ret = NewStringNative(env, driver); return ret; } jstring getVersion(JNIEnv * env) { jstring ret = NULL; TCHAR driverDLL[256] = "\0"; DWORD var = 0; DWORD dwInfoSize; LPVOID lpInfoBuff; BOOL bRetval; char *driver = getDriver(); if (driver == NULL) { return NULL; } strcat(driverDLL, driver); strcat(driverDLL, ".dll"); dwInfoSize = GetFileVersionInfoSize(driverDLL, &var); lpInfoBuff = malloc(dwInfoSize); bRetval = GetFileVersionInfo(driverDLL, 0, dwInfoSize, lpInfoBuff); if (bRetval == 0) { } else { VS_FIXEDFILEINFO * fxdFileInfo; UINT uiLen = 0; bRetval = VerQueryValue(lpInfoBuff, TEXT("\\"), (void **) &fxdFileInfo, &uiLen); if (bRetval != 0) { TCHAR version[256]; TCHAR ms[10], ls[10]; sprintf(ms, "%d.%d\0", fxdFileInfo->dwProductVersionMS >> 16, fxdFileInfo->dwProductVersionMS & 0xFFFF); sprintf(ls, "%d.%d\0", fxdFileInfo->dwProductVersionLS >> 16, fxdFileInfo->dwProductVersionLS & 0xFFFF); sprintf(version, "%s.%s\0", ms, ls); ret = NewStringNative(env, version); } } free(lpInfoBuff); return ret; } --- org_lwjgl_input_Keyboard.cpp DELETED --- --- NEW FILE: org_lwjgl_input_Mouse.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' 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 * "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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_input_Mouse.c,v 1.1 2004/12/09 15:36:13 elias_naur Exp $ * * Win32 mouse handling. * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ #undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x0300 #include "Window.h" #include <dinput.h> #include "common_tools.h" #include "org_lwjgl_opengl_Win32Display.h" #include "org_lwjgl_input_Mouse.h" #define EVENT_SIZE 5 extern HINSTANCE dll_handle; // Handle to the LWJGL dll static LPDIRECTINPUT lpdi = NULL; // DirectInput static LPDIRECTINPUTDEVICE mDIDevice; // DI Device instance static int mButtoncount = 0; // Temporary buttoncount static bool mHaswheel; // Temporary wheel check static bool mCreate_success; // bool used to determine successfull creation static bool mFirstTimeInitialization = true; // boolean to determine first time initialization static bool mouse_grabbed; static int mouseMask = DISCL_NONEXCLUSIVE | DISCL_FOREGROUND; /* These accumulated deltas track the cursor position from Windows messages */ static int accum_dx; static int accum_dy; static int accum_dwheel; static int last_x; static int last_y; static event_queue_t event_queue; static bool buffer_enabled; // 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 UpdateMouseFields(JNIEnv *env, jobject coord_buffer_obj, jobject button_buffer_obj); static int transformY(int y) { RECT clientRect; GetClientRect(getCurrentHWND(), &clientRect); return (clientRect.bottom - clientRect.top) - 1 - y; } static bool putMouseEventWithCoords(jint button, jint state, jint coord1, jint coord2, jint dz) { jint event[] = {button, state, coord1, coord2, dz}; return putEvent(&event_queue, event); } static bool putMouseEvent(jint button, jint state, jint dz) { if (mouse_grabbed) return putMouseEventWithCoords(button, state, 0, 0, dz); else return putMouseEventWithCoords(button, state, last_x, last_y, dz); } static void resetCursorPos(void) { accum_dx = accum_dy = 0; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_hasWheel(JNIEnv *env, jobject self) { return mHaswheel; } 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_opengl_Win32Display_createMouse(JNIEnv *env, jobject self) { HRESULT ret; initEventQueue(&event_queue, EVENT_SIZE); last_x = last_y = accum_dx = accum_dy = accum_dwheel = 0; buffer_enabled = false; // Create input ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION) { throwException(env, "Failed to create DirectInput"); return; } /* skip enumeration, since we only want system mouse */ CreateMouse(); //check for first time initialization - need to detect capabilities if (mFirstTimeInitialization) { mFirstTimeInitialization = false; /* Enumerate capabilities of Mouse */ EnumerateMouseCapabilities(); if (!mCreate_success) { throwException(env, "Failed to enumerate."); ShutdownMouse(); return; } /* Do setup of Mouse */ SetupMouse(); } else { if(mCreate_success) { /* Do setup of Mouse */ SetupMouse(); } } /* Aquire the Mouse */ ret = IDirectInputDevice_Acquire(mDIDevice); if(FAILED(ret)) { printfDebug("Failed to acquire mouse\n"); } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_enableMouseBuffer(JNIEnv * env, jobject self) { buffer_enabled = true; } void handleMouseScrolled(int event_dwheel) { if(mCreate_success) { accum_dwheel += event_dwheel; putMouseEvent(-1, 0, event_dwheel); } } void handleMouseMoved(int x, int y) { int dx; int dy; if(mCreate_success) { y = transformY(y); dx = x - last_x; dy = y - last_y; accum_dx += dx; accum_dy += dy; last_x = x; last_y = y; if (mouse_grabbed) { putMouseEventWithCoords(-1, 0, dx, dy, 0); } else { putMouseEventWithCoords(-1, 0, x, y, 0); } } } void handleMouseButton(int button, int state) { if(mCreate_success) { putMouseEvent(button, state, 0); } } static void copyDXEvents(int num_di_events, DIDEVICEOBJECTDATA *di_buffer) { int buffer_index = 0; int dx = 0, dy = 0, dwheel = 0; int button_state; int i; for (i = 0; i < num_di_events; i++) { button_state = (di_buffer[i].dwData & 0x80) != 0 ? 1 : 0; switch (di_buffer[i].dwOfs) { case DIMOFS_BUTTON0: putMouseEventWithCoords(0, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON1: putMouseEventWithCoords(1, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON2: putMouseEventWithCoords(2, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_BUTTON3: putMouseEventWithCoords(3, button_state, dx, -dy, dwheel); dx = dy = dwheel = 0; break; case DIMOFS_X: dx += di_buffer[i].dwData; break; case DIMOFS_Y: dy += di_buffer[i].dwData; break; case DIMOFS_Z: dwheel += di_buffer[i].dwData; break; } } if (dx != 0 || dy != 0 || dwheel != 0) putMouseEventWithCoords(-1, 0, dx, -dy, dwheel); } static void readDXBuffer() { DIDEVICEOBJECTDATA rgdod[EVENT_BUFFER_SIZE]; DWORD num_di_events = EVENT_BUFFER_SIZE; HRESULT ret; ret = IDirectInputDevice_Acquire(mDIDevice); if (ret != DI_OK && ret != S_FALSE) return; ret = IDirectInputDevice_GetDeviceData(mDIDevice, sizeof(DIDEVICEOBJECTDATA), rgdod, &num_di_events, 0); if (ret == DI_OK) { copyDXEvents(num_di_events, rgdod); } else if (ret == DI_BUFFEROVERFLOW) { printfDebug("Buffer overflowed\n"); } else if (ret == DIERR_INPUTLOST) { printfDebug("Input lost\n"); } else if (ret == DIERR_NOTACQUIRED) { printfDebug("not acquired\n"); } else if (ret == DIERR_INVALIDPARAM) { printfDebug("invalid parameter\n"); } else if (ret == DIERR_NOTBUFFERED) { printfDebug("not buffered\n"); } else if (ret == DIERR_NOTINITIALIZED) { printfDebug("not inited\n"); } else { printfDebug("unknown keyboard error\n"); } } 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(env, buffer_obj) + buffer_position; int buffer_size = ((*env)->GetDirectBufferCapacity(env, buffer_obj))/sizeof(jint) - buffer_position; if (mouse_grabbed) { readDXBuffer(); } else { handleMessages(); } return copyEvents(&event_queue, buffer_ptr, buffer_size); } 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_opengl_Win32Display_setNativeCursor (JNIEnv *env, jobject self, jobject handle_buffer) { HCURSOR *cursor_handle; HCURSOR cursor; if (mDIDevice == NULL) throwException(env, "null device!"); if (handle_buffer != NULL) { cursor_handle = (HCURSOR *)(*env)->GetDirectBufferAddress(env, handle_buffer); cursor = *cursor_handle; SetClassLong(getCurrentHWND(), GCL_HCURSOR, (LONG)cursor); SetCursor(cursor); } else { SetClassLong(getCurrentHWND(), GCL_HCURSOR, (LONG)NULL); SetCursor(LoadCursor(NULL, IDC_ARROW)); } } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMaxCursorSize (JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Win32Display_getMinCursorSize (JNIEnv *env, jobject self) { return GetSystemMetrics(SM_CXCURSOR); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyMouse(JNIEnv *env, jobject self) { ShutdownMouse(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_pollMouse(JNIEnv * env, jobject self, jobject coord_buffer_obj, jobject button_buffer_obj) { IDirectInputDevice_Acquire(mDIDevice); UpdateMouseFields(env, coord_buffer_obj, button_buffer_obj); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_grabMouse (JNIEnv * env, jobject self, jboolean grab) { IDirectInputDevice_Unacquire(mDIDevice); if(grab) { if (!mouse_grabbed) { mouse_grabbed = true; ShowCursor(false); mouseMask = DISCL_EXCLUSIVE | DISCL_FOREGROUND; } } else { if (mouse_grabbed) { mouse_grabbed = false; ShowCursor(true); mouseMask = DISCL_NONEXCLUSIVE | DISCL_FOREGROUND; } } IDirectInputDevice_Unacquire(mDIDevice); if (IDirectInputDevice_SetCooperativeLevel(mDIDevice, getCurrentHWND(), mouseMask) != DI_OK) { throwException(env, "Could not set the CooperativeLevel."); return; } IDirectInputDevice_Acquire(mDIDevice); initEventQueue(&event_queue, EVENT_SIZE); } /** * Shutdown DI */ static void ShutdownMouse() { // release device if (mDIDevice != NULL) { IDirectInputDevice_Unacquire(mDIDevice); IDirectInputDevice_Release(mDIDevice); mDIDevice = NULL; } // Release DirectInput if (lpdi != NULL) { printfDebug("Destroying directinput\n"); IDirectInput_Release(lpdi); lpdi = NULL; } mCreate_success = false; } /** * Enumerates the capabilities of the Mouse attached to the system */ static void EnumerateMouseCapabilities() { HRESULT hr; hr = IDirectInputDevice_EnumObjects(mDIDevice, EnumMouseObjectsCallback, NULL, DIDFT_ALL); if FAILED(hr) { printfDebug("EnumObjects failed\n"); mCreate_success = false; return; } //check for > 4 buttons - need to clamp since we're using dx 5 if(mButtoncount > 4) { mButtoncount = 4; printfDebug("WARNING: Clamping to 4 mouse buttons\n"); } mCreate_success = true; } /** * Callback from EnumObjects. Called for each "object" on the Mouse. */ static BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { printfDebug("found %s\n", lpddoi->tszName); if(IsEqualGUID(&lpddoi->guidType, &GUID_Button)) { mButtoncount++; } else if(IsEqualGUID(&lpddoi->guidType, &GUID_XAxis)) { } else if(IsEqualGUID(&lpddoi->guidType, &GUID_YAxis)) { } else if(IsEqualGUID(&lpddoi->guidType, &GUID_ZAxis)) { mHaswheel = true; } else { printfDebug("Unhandled object found: %s\n", lpddoi->tszName); } return DIENUM_CONTINUE; } /** * Creates the specified device as a Mouse */ static void CreateMouse() { HRESULT hr; hr = IDirectInput_CreateDevice(lpdi, &GUID_SysMouse, &mDIDevice, NULL); if FAILED(hr) { printfDebug("CreateDevice failed\n"); mCreate_success = false; return; } mCreate_success = true; } /** * Sets up the Mouse properties */ static void SetupMouse() { DIPROPDWORD dipropdw; // set Mouse data format if(IDirectInputDevice_SetDataFormat(mDIDevice, &c_dfDIMouse) != DI_OK) { printfDebug("SetDataFormat failed\n"); mCreate_success = false; return; } dipropdw.diph.dwSize = sizeof(DIPROPDWORD); dipropdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); dipropdw.diph.dwObj = 0; dipropdw.diph.dwHow = DIPH_DEVICE; dipropdw.dwData = EVENT_BUFFER_SIZE; IDirectInputDevice_SetProperty(mDIDevice, DIPROP_BUFFERSIZE, &dipropdw.diph); // set the cooperative level if (IDirectInputDevice_SetCooperativeLevel(mDIDevice, getCurrentHWND(), mouseMask) != DI_OK) { printfDebug("SetCooperativeLevel failed\n"); mCreate_success = false; return; } mCreate_success = true; resetCursorPos(); } static int cap(int val, int min, int max) { if (val < min) return min; else if (val > max) return max; else return val; } /** * Updates the fields on the Mouse */ static void UpdateMouseFields(JNIEnv *env, jobject coord_buffer_obj, jobject button_buffer_obj) { HRESULT hRes; DIMOUSESTATE diMouseState; // State of Mouse int i, j; int *coords = (int *)(*env)->GetDirectBufferAddress(env, coord_buffer_obj); int coords_length = (int)(*env)->GetDirectBufferCapacity(env, coord_buffer_obj); unsigned char *buttons_buffer = (unsigned char *)(*env)->GetDirectBufferAddress(env, button_buffer_obj); int num_buttons; int buttons_length = (int)(*env)->GetDirectBufferCapacity(env, button_buffer_obj); if (coords_length < 3) { printfDebug("ERROR: Not enough space in coords array: %d < 3\n", coords_length); return; } handleMessages(); // get data from the Mouse hRes = IDirectInputDevice_GetDeviceState(mDIDevice, sizeof(DIMOUSESTATE), &diMouseState); if (hRes != DI_OK) { // Don't allow the mouse to drift when failed diMouseState.lX = 0; diMouseState.lY = 0; diMouseState.lZ = 0; // did the read fail because we lost input for some reason? // if so, then attempt to reacquire. if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { hRes = IDirectInputDevice_Acquire(mDIDevice); if (hRes != DI_OK) return; } else { printfDebug("Error getting mouse state: %d\n", hRes); return; } } if (mouse_grabbed) { coords[0] = diMouseState.lX; coords[1] = -diMouseState.lY; coords[2] = diMouseState.lZ; } else { coords[0] = last_x; coords[1] = last_y; coords[2] = accum_dwheel; accum_dx = accum_dy = accum_dwheel = 0; } for (i = 0; i < mButtoncount; i++) { if (diMouseState.rgbButtons[i] != 0) { diMouseState.rgbButtons[i] = JNI_TRUE; } else { diMouseState.rgbButtons[i] = JNI_FALSE; } } num_buttons = mButtoncount; if (num_buttons > buttons_length) num_buttons = buttons_length; for (j = 0; j < num_buttons; j++) buttons_buffer[j] = (unsigned char)diMouseState.rgbButtons[j]; } --- display.cpp DELETED --- --- NEW FILE: org_lwjgl_Sys.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' 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 * "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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_Sys.c,v 1.1 2004/12/09 15:36:13 elias_naur Exp $ * * Win32 system library. * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #include "Window.h" #include "org_lwjgl_Sys.h" #include "org_lwjgl_opengl_Win32Display.h" #include "common_tools.h" #include <malloc.h> unsigned __int64 hires_timer_freq = 0; // Hires timer frequency unsigned __int64 hires_timer = 0; // Hires timer current time /* * Class: org_lwjgl_Sys * Method: getTimerResolution * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution (JNIEnv * env, jclass clazz) { QueryPerformanc... [truncated message content] |