src/haptic/SDL_haptic.c
branchgsoc2008_force_feedback
changeset 2489 96adc8025331
parent 2488 8e2bdbccf7ff
child 2490 be9b206d44af
--- a/src/haptic/SDL_haptic.c	Tue Jul 01 18:35:05 2008 +0000
+++ b/src/haptic/SDL_haptic.c	Wed Jul 02 08:24:35 2008 +0000
@@ -23,6 +23,7 @@
 
 #include "SDL_haptic_c.h"
 #include "SDL_syshaptic.h"
+#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
 
 
 static Uint8 SDL_numhaptics = 0;
@@ -131,6 +132,39 @@
 
 
 /*
+ * Returns SDL_TRUE if joystick has haptic features.
+ */
+int
+SDL_JoystickIsHaptic(SDL_Joystick * joystick)
+{
+   int ret;
+
+   if (!SDL_PrivateJoystickValid(&joystick)) {
+      return -1;
+   }
+
+   ret = SDL_SYS_JoystickIsHaptic(joystick);
+
+   if (ret > 0) return SDL_TRUE;
+   else if (ret == 0) return SDL_FALSE;
+   else return -1;
+}
+
+
+/*
+ * Opens a haptic device from a joystick.
+ */
+SDL_Haptic *
+SDL_HapticOpenFromJoystick(SDL_Joystick * joystick)
+{
+   if (!SDL_PrivateJoystickValid(&joystick)) {
+      return -1;
+   }
+   return -1;
+}
+
+
+/*
  * Checks to see if the haptic device is valid
  */
 static int