comparison src/joystick/win32/SDL_dxjoystick.c @ 2580:64fa227c01ce gsoc2008_force_feedback

Added the concept of the HelperWindow to help with DirectInput.
author Edgar Simo <bobbens@gmail.com>
date Mon, 04 Aug 2008 11:22:01 +0000
parents bd2a6c70cb29
children acd5da848404
comparison
equal deleted inserted replaced
2579:bd2a6c70cb29 2580:64fa227c01ce
65 #define AXIS_MAX 32767 /* maximum value for axis coordinate */ 65 #define AXIS_MAX 32767 /* maximum value for axis coordinate */
66 #define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */ 66 #define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */
67 67
68 /* external variables referenced. */ 68 /* external variables referenced. */
69 extern HINSTANCE SDL_Instance; 69 extern HINSTANCE SDL_Instance;
70 extern HWND SDL_Window; 70 extern HWND SDL_HelperWindow;
71 71
72 72
73 /* local variables */ 73 /* local variables */
74 static LPDIRECTINPUT dinput = NULL; 74 static LPDIRECTINPUT dinput = NULL;
75 extern HRESULT(WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion, 75 extern HRESULT(WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion,
248 248
249 /* Aquire shared access. Exclusive access is required for forces, 249 /* Aquire shared access. Exclusive access is required for forces,
250 * though. */ 250 * though. */
251 result = 251 result =
252 IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata-> 252 IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata->
253 InputDevice, SDL_Window, 253 InputDevice, SDL_HelperWindow,
254 DISCL_EXCLUSIVE | 254 DISCL_EXCLUSIVE |
255 DISCL_BACKGROUND); 255 DISCL_BACKGROUND);
256 if (FAILED(result)) { 256 if (FAILED(result)) {
257 SetDIerror("IDirectInputDevice2::SetCooperativeLevel", result); 257 SetDIerror("IDirectInputDevice2::SetCooperativeLevel", result);
258 return (-1); 258 return (-1);