diff src/haptic/SDL_haptic.c @ 2489:96adc8025331 gsoc2008_force_feedback

Exposed some of the joystick stuff to the haptic subsystem. Added SDL_JoystickIsHaptic().
author Edgar Simo <bobbens@gmail.com>
date Wed, 02 Jul 2008 08:24:35 +0000
parents 8e2bdbccf7ff
children be9b206d44af
line wrap: on
line diff
--- 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