diff 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
line wrap: on
line diff
--- a/src/haptic/win32/SDL_syshaptic.c	Tue Aug 12 20:49:31 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Sun Aug 24 17:17:45 2008 +0000
@@ -466,7 +466,7 @@
    }
 
    /* Status is always supported. */
-   haptic->supported |= SDL_HAPTIC_STATUS;
+   haptic->supported |= SDL_HAPTIC_STATUS | SDL_HAPTIC_PAUSE;
 
    /* Check maximum effects. */
    haptic->neffects = 128; /* This is not actually supported as thus under windows,
@@ -1301,7 +1301,46 @@
    }
   
    return 0;
+}
 
+
+/*
+ * Pauses the device.
+ */
+int
+SDL_SYS_HapticPause(SDL_Haptic * haptic)
+{
+   HRESULT ret;
+
+   /* Pause the device. */
+   ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
+                                                       DISFFC_PAUSE );
+   if (FAILED(ret)) {
+      DI_SetError("Pausing the device",ret);
+      return -1;
+   }
+   
+   return 0;
+}
+
+
+/*
+ * Pauses the device.
+ */
+int
+SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
+{
+   HRESULT ret;
+
+   /* Unpause the device. */
+   ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
+                                                       DISFFC_CONTINUE );
+   if (FAILED(ret)) {
+      DI_SetError("Pausing the device",ret);
+      return -1;
+   }
+   
+   return 0;
 }