Mercurial > sdl-ios-xcode
diff src/haptic/darwin/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 | b04679da6627 |
children | 9408be170bff |
line wrap: on
line diff
--- a/src/haptic/darwin/SDL_syshaptic.c Tue Aug 12 20:49:31 2008 +0000 +++ b/src/haptic/darwin/SDL_syshaptic.c Sun Aug 24 17:17:45 2008 +0000 @@ -376,7 +376,7 @@ SDL_memcpy( haptic->hwdata->axes, features.ffAxes, haptic->naxes * sizeof(Uint8)); /* Always supported features. */ - supported |= SDL_HAPTIC_STATUS; + supported |= SDL_HAPTIC_STATUS | SDL_HAPTIC_PAUSE; haptic->supported = supported; return 0;; @@ -1221,7 +1221,44 @@ } return 0; +} + +/* + * Pauses the device. + */ +int +SDL_SYS_HapticPause(SDL_Haptic * haptic) +{ + HRESULT ret; + + ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device, + FFSFFC_PAUSE); + if (ret != FF_OK) { + SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret)); + return -1; + } + + return 0; +} + + +/* + * Unpauses the device. + */ +int +SDL_SYS_HapticUnpause(SDL_Haptic * haptic) +{ + HRESULT ret; + + ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device, + FFSFFC_CONTINUE); + if (ret != FF_OK) { + SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret)); + return -1; + } + + return 0; }