comparison src/haptic/win32/SDL_syshaptic.c @ 2626:53dd30491c71 gsoc2008_force_feedback

Added SDL_HAPTIC_STATUS support to windows haptic port.
author Edgar Simo <bobbens@gmail.com>
date Wed, 06 Aug 2008 10:11:35 +0000
parents 6deba05725ac
children 43a0416b3707
comparison
equal deleted inserted replaced
2625:9bad8efcb75e 2626:53dd30491c71
462 ret = IDirectInputDevice2_SetProperty( haptic->hwdata->device, 462 ret = IDirectInputDevice2_SetProperty( haptic->hwdata->device,
463 DIPROP_AUTOCENTER, &dipdw.diph ); 463 DIPROP_AUTOCENTER, &dipdw.diph );
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
468 /* Status is always supported. */
469 haptic->supported |= SDL_HAPTIC_STATUS;
467 470
468 /* Check maximum effects. */ 471 /* Check maximum effects. */
469 haptic->neffects = 128; /* TODO actually figure this out. */ 472 haptic->neffects = 128; /* TODO actually figure this out. */
470 haptic->nplaying = 128; 473 haptic->nplaying = 128;
471 474
1229 * Gets the status of a haptic effect. 1232 * Gets the status of a haptic effect.
1230 */ 1233 */
1231 int 1234 int
1232 SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect * effect) 1235 SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect * effect)
1233 { 1236 {
1234 SDL_SetError("Haptic: Status not supported."); 1237 HRESULT ret;
1235 return -1; 1238 DWORD status;
1239
1240 ret = IDirectInputEffect_GetEffectStatus(effect->hweffect->ref, &status);
1241 if (FAILED(ret)) {
1242 DI_SetError("Getting effect status",ret);
1243 return -1;
1244 }
1245
1246 if (status == 0) return SDL_FALSE;
1247 return SDL_TRUE;
1236 } 1248 }
1237 1249
1238 1250
1239 /* 1251 /*
1240 * Sets the gain. 1252 * Sets the gain.