src/haptic/SDL_haptic.c
branchgsoc2008_force_feedback
changeset 2483 9d52368ebcf5
parent 2480 b883974445fc
child 2484 666472fd4cb0
--- 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;
+}
+
+