comparison src/haptic/win32/SDL_syshaptic.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 72c4ac55f73c
children b4b3beaea5b5
comparison
equal deleted inserted replaced
2579:bd2a6c70cb29 2580:64fa227c01ce
34 34
35 #define DIRECTINPUT_VERSION 0x0700 /* Need at least DirectX 7 for dwStartDelay */ 35 #define DIRECTINPUT_VERSION 0x0700 /* Need at least DirectX 7 for dwStartDelay */
36 #include <dinput.h> 36 #include <dinput.h>
37 #include <dxerr.h> 37 #include <dxerr.h>
38 #ifdef _MSC_VER 38 #ifdef _MSC_VER
39 # pragma comment (lib, "dxerr.lib") 39 # pragma comment (lib, "dinput8.lib")
40 # pragma comment (lib, "dxguid.lib")
41 # pragma comment (lib, "dxerr.lib")
40 #endif /* _MSC_VER */ 42 #endif /* _MSC_VER */
41 43
42 /* an ISO hack for VisualC++ */ 44 /* an ISO hack for VisualC++ */
43 #ifdef _MSC_VER 45 #ifdef _MSC_VER
44 #define snprintf _snprintf 46 #define snprintf _snprintf
86 88
87 /* 89 /*
88 * External stuff. 90 * External stuff.
89 */ 91 */
90 extern HINSTANCE SDL_Instance; 92 extern HINSTANCE SDL_Instance;
91 extern HWND SDL_Window; 93 extern HWND SDL_HelperWindow;
92 94
93 95
94 /* 96 /*
95 * Prototypes. 97 * Prototypes.
96 */ 98 */
272 goto query_err; 274 goto query_err;
273 } 275 }
274 276
275 /* Grab it exclusively to use force feedback stuff. */ 277 /* Grab it exclusively to use force feedback stuff. */
276 ret =IDirectInputDevice2_SetCooperativeLevel( haptic->hwdata->device, 278 ret =IDirectInputDevice2_SetCooperativeLevel( haptic->hwdata->device,
277 SDL_Window, 279 SDL_HelperWindow,
278 DISCL_EXCLUSIVE | DISCL_BACKGROUND ); 280 DISCL_EXCLUSIVE | DISCL_BACKGROUND );
279 if (FAILED(ret)) { 281 if (FAILED(ret)) {
280 DI_SetError("Setting cooperative level to exclusive",ret); 282 DI_SetError("Setting cooperative level to exclusive",ret);
281 goto acquire_err; 283 goto acquire_err;
282 } 284 }