diff src/haptic/SDL_haptic.c @ 2479:b9eb2cfe16cd gsoc2008_force_feedback

Added some preliminary support for haptic effect control.
author Edgar Simo <bobbens@gmail.com>
date Mon, 30 Jun 2008 21:38:29 +0000
parents 4fd783e0f34b
children b883974445fc
line wrap: on
line diff
--- a/src/haptic/SDL_haptic.c	Mon Jun 30 17:28:34 2008 +0000
+++ b/src/haptic/SDL_haptic.c	Mon Jun 30 21:38:29 2008 +0000
@@ -273,6 +273,13 @@
    if (!ValidHaptic(&haptic)) {
       return -1;
    }
+
+   /* Run the effect */
+   if (SDL_SYS_HapticRunEffect(haptic,&haptic->effects[effect]) < 0) {
+      return -1;
+   }
+
+   return 0;
 }
 
 /*
@@ -284,6 +291,13 @@
    if (!ValidHaptic(&haptic)) {
       return;
    }
+
+   /* Not allocated */
+   if (haptic->effects[effect].hweffect == NULL) {
+      return;
+   }
+
+   SDL_SYS_HapticDestroyEffect(haptic, &haptic->effects[effect]);
 }