diff src/haptic/SDL_haptic.c @ 2483:9d52368ebcf5 gsoc2008_force_feedback

Setting effects memory to 0. Added SDL_HapticSetGain().
author Edgar Simo <bobbens@gmail.com>
date Tue, 01 Jul 2008 14:09:53 +0000
parents b883974445fc
children 666472fd4cb0
line wrap: on
line diff
--- a/src/haptic/SDL_haptic.c	Tue Jul 01 11:21:36 2008 +0000
+++ b/src/haptic/SDL_haptic.c	Tue Jul 01 14:09:53 2008 +0000
@@ -324,4 +324,26 @@
    SDL_SYS_HapticDestroyEffect(haptic, &haptic->effects[effect]);
 }
 
+/*
+ * Sets the global gain of the device.
+ */
+int
+SDL_HapticSetGain(SDL_Haptic * haptic, int gain )
+{
+   if (!ValidHaptic(&haptic)) {
+      return -1;
+   }
 
+   if ((gain < 0) || (gain > 100)) {
+      SDL_SetError("Haptic gain must be between 0 and 100.");
+      return -1;
+   }
+
+   if (SDL_SYS_HapticSetGain(haptic,gain) < 0) {
+      return -1;
+   }
+
+   return 0;
+}
+
+