comparison src/haptic/win32/SDL_syshaptic.c @ 2645:269ba4f28d0e gsoc2008_force_feedback

Added support for pausing/unpausing haptic devices.
author Edgar Simo <bobbens@gmail.com>
date Sun, 24 Aug 2008 17:17:45 +0000
parents a0845d7f4398
children 9408be170bff
comparison
equal deleted inserted replaced
2644:ef0ba67154c1 2645:269ba4f28d0e
464 if (!FAILED(ret)) { /* Autocenter is supported. */ 464 if (!FAILED(ret)) { /* Autocenter is supported. */
465 haptic->supported |= SDL_HAPTIC_AUTOCENTER; 465 haptic->supported |= SDL_HAPTIC_AUTOCENTER;
466 } 466 }
467 467
468 /* Status is always supported. */ 468 /* Status is always supported. */
469 haptic->supported |= SDL_HAPTIC_STATUS; 469 haptic->supported |= SDL_HAPTIC_STATUS | SDL_HAPTIC_PAUSE;
470 470
471 /* Check maximum effects. */ 471 /* Check maximum effects. */
472 haptic->neffects = 128; /* This is not actually supported as thus under windows, 472 haptic->neffects = 128; /* This is not actually supported as thus under windows,
473 there is no way to tell the number of EFFECTS that a 473 there is no way to tell the number of EFFECTS that a
474 device can hold, so we'll just use a "random" number 474 device can hold, so we'll just use a "random" number
1299 DI_SetError("Setting autocenter",ret); 1299 DI_SetError("Setting autocenter",ret);
1300 return -1; 1300 return -1;
1301 } 1301 }
1302 1302
1303 return 0; 1303 return 0;
1304 1304 }
1305
1306
1307 /*
1308 * Pauses the device.
1309 */
1310 int
1311 SDL_SYS_HapticPause(SDL_Haptic * haptic)
1312 {
1313 HRESULT ret;
1314
1315 /* Pause the device. */
1316 ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
1317 DISFFC_PAUSE );
1318 if (FAILED(ret)) {
1319 DI_SetError("Pausing the device",ret);
1320 return -1;
1321 }
1322
1323 return 0;
1324 }
1325
1326
1327 /*
1328 * Pauses the device.
1329 */
1330 int
1331 SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
1332 {
1333 HRESULT ret;
1334
1335 /* Unpause the device. */
1336 ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
1337 DISFFC_CONTINUE );
1338 if (FAILED(ret)) {
1339 DI_SetError("Pausing the device",ret);
1340 return -1;
1341 }
1342
1343 return 0;
1305 } 1344 }
1306 1345
1307 1346
1308 #endif /* SDL_HAPTIC_DINPUT */ 1347 #endif /* SDL_HAPTIC_DINPUT */