comparison 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
comparison
equal deleted inserted replaced
2644:ef0ba67154c1 2645:269ba4f28d0e
374 3 : features.numFfAxes; 374 3 : features.numFfAxes;
375 /* Actually store the axes we want to use */ 375 /* Actually store the axes we want to use */
376 SDL_memcpy( haptic->hwdata->axes, features.ffAxes, haptic->naxes * sizeof(Uint8)); 376 SDL_memcpy( haptic->hwdata->axes, features.ffAxes, haptic->naxes * sizeof(Uint8));
377 377
378 /* Always supported features. */ 378 /* Always supported features. */
379 supported |= SDL_HAPTIC_STATUS; 379 supported |= SDL_HAPTIC_STATUS | SDL_HAPTIC_PAUSE;
380 380
381 haptic->supported = supported; 381 haptic->supported = supported;
382 return 0;; 382 return 0;;
383 } 383 }
384 384
1219 SDL_SetError("Haptic: Error setting autocenter: %s.", FFStrError(ret)); 1219 SDL_SetError("Haptic: Error setting autocenter: %s.", FFStrError(ret));
1220 return -1; 1220 return -1;
1221 } 1221 }
1222 1222
1223 return 0; 1223 return 0;
1224 1224 }
1225
1226
1227 /*
1228 * Pauses the device.
1229 */
1230 int
1231 SDL_SYS_HapticPause(SDL_Haptic * haptic)
1232 {
1233 HRESULT ret;
1234
1235 ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
1236 FFSFFC_PAUSE);
1237 if (ret != FF_OK) {
1238 SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
1239 return -1;
1240 }
1241
1242 return 0;
1243 }
1244
1245
1246 /*
1247 * Unpauses the device.
1248 */
1249 int
1250 SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
1251 {
1252 HRESULT ret;
1253
1254 ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
1255 FFSFFC_CONTINUE);
1256 if (ret != FF_OK) {
1257 SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
1258 return -1;
1259 }
1260
1261 return 0;
1225 } 1262 }
1226 1263
1227 1264
1228 #endif /* SDL_HAPTIC_IOKIT */ 1265 #endif /* SDL_HAPTIC_IOKIT */