comparison src/haptic/win32/SDL_syshaptic.c @ 2569:806919b319d4 gsoc2008_force_feedback

Another set of fixes to try to get haptic subsystem compiling on windows.
author Edgar Simo <bobbens@gmail.com>
date Thu, 31 Jul 2008 16:13:37 +0000
parents 5ad98a77bacb
children 53bb7d21928d
comparison
equal deleted inserted replaced
2568:5ad98a77bacb 2569:806919b319d4
198 /* Prepare the haptic device. */ 198 /* Prepare the haptic device. */
199 SDL_Haptic *haptic = (SDL_Haptic*) pv; 199 SDL_Haptic *haptic = (SDL_Haptic*) pv;
200 haptic->supported = 0; 200 haptic->supported = 0;
201 201
202 /* Get supported. */ 202 /* Get supported. */
203 switch (pei->guid) {
204 case GUID_Spring:
205 haptic->supported |= SDL_HAPTIC_SPRING;
206 break;
207 case GUID_Damper:
208 haptic->supported |= SDL_HAPTIC_DAMPER;
209 break;
210 case GUID_Inertia:
211 haptic->supported |= SDL_HAPTIC_INERTIA;
212 break;
213 case GUID_Friction:
214 haptic->supported |= SDL_HAPTIC_FRICTION;
215 break;
216 case GUID_ConstantForce:
217 haptic->supported |= SDL_HAPTIC_CONSTANT;
218 break;
219 case GUID_CustomForce:
220 haptic->supported |= SDL_HAPTIC_CUSTOM;
221 break;
222 case GUID_Sine:
223 haptic->supported |= SDL_HAPTIC_SINE;
224 break;
225 case GUID_Square:
226 haptic->supported |= SDL_HAPTIC_SQUARE;
227 break;
228 case GUID_Triangle:
229 haptic->supported |= SDL_HAPTIC_TRIANGLE;
230 break;
231 case GUID_SawtoothUp:
232 haptic->supported |= SDL_HAPTIC_SAWTOOTHUP;
233 break;
234 case GUID_SawtoothDown:
235 haptic->supported |= SDL_HAPTIC_SAWTOOTHDOWN;
236 break;
237 case GUID_RampForce:
238 haptic->supported |= SDL_HAPTIC_RAMP;
239 break;
240
241 default:
242 break;
243 }
244 /*
203 EFFECT_TEST(GUID_Spring, SDL_HAPTIC_SPRING); 245 EFFECT_TEST(GUID_Spring, SDL_HAPTIC_SPRING);
204 EFFECT_TEST(GUID_Damper, SDL_HAPTIC_DAMPER); 246 EFFECT_TEST(GUID_Damper, SDL_HAPTIC_DAMPER);
205 EFFECT_TEST(GUID_Inertia, SDL_HAPTIC_INERTIA); 247 EFFECT_TEST(GUID_Inertia, SDL_HAPTIC_INERTIA);
206 EFFECT_TEST(GUID_Friction, SDL_HAPTIC_FRICTION); 248 EFFECT_TEST(GUID_Friction, SDL_HAPTIC_FRICTION);
207 EFFECT_TEST(GUID_ConstantForce, SDL_HAPTIC_CONSTANT); 249 EFFECT_TEST(GUID_ConstantForce, SDL_HAPTIC_CONSTANT);
210 EFFECT_TEST(GUID_Square, SDL_HAPTIC_SQUARE); 252 EFFECT_TEST(GUID_Square, SDL_HAPTIC_SQUARE);
211 EFFECT_TEST(GUID_Triangle, SDL_HAPTIC_TRIANGLE); 253 EFFECT_TEST(GUID_Triangle, SDL_HAPTIC_TRIANGLE);
212 EFFECT_TEST(GUID_SawtoothUp, SDL_HAPTIC_SAWTOOTHUP); 254 EFFECT_TEST(GUID_SawtoothUp, SDL_HAPTIC_SAWTOOTHUP);
213 EFFECT_TEST(GUID_SawtoothDown, SDL_HAPTIC_SAWTOOTHDOWN); 255 EFFECT_TEST(GUID_SawtoothDown, SDL_HAPTIC_SAWTOOTHDOWN);
214 EFFECT_TEST(GUID_RampForce, SDL_HAPTIC_RAMP); 256 EFFECT_TEST(GUID_RampForce, SDL_HAPTIC_RAMP);
257 */
215 258
216 /* Check for more. */ 259 /* Check for more. */
217 return DIENUM_CONTINUE; 260 return DIENUM_CONTINUE;
218 } 261 }
219 262
244 goto creat_err; 287 goto creat_err;
245 } 288 }
246 SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata)); 289 SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
247 290
248 /* Open the device */ 291 /* Open the device */
249 ret = IDirectInput_CreateDevice( dinput, &instance, 292 ret = IDirectInput_CreateDevice( dinput, &instance.guidInstance,
250 guidInstance, &device ); 293 &device, NULL );
251 if (FAILED(ret)) { 294 if (FAILED(ret)) {
252 DI_SetError("Creating DirectInput device",ret); 295 DI_SetError("Creating DirectInput device",ret);
253 goto creat_err; 296 goto creat_err;
254 } 297 }
255 298
298 } 341 }
299 342
300 343
301 /* Get capabilities. */ 344 /* Get capabilities. */
302 ret = IDirectInputDevice2_GetCapabilities( haptic->hwdata->device, 345 ret = IDirectInputDevice2_GetCapabilities( haptic->hwdata->device,
303 haptic->hwdata->capabilities ); 346 &haptic->hwdata->capabilities );
304 if (FAILED(ret)) { 347 if (FAILED(ret)) {
305 DI_SetError("Getting device capabilities",ret); 348 DI_SetError("Getting device capabilities",ret);
306 goto acquire_err; 349 goto acquire_err;
307 } 350 }
308 351