src/haptic/SDL_haptic.c
branchgsoc2008_force_feedback
changeset 2489 96adc8025331
parent 2488 8e2bdbccf7ff
child 2490 be9b206d44af
     1.1 --- a/src/haptic/SDL_haptic.c	Tue Jul 01 18:35:05 2008 +0000
     1.2 +++ b/src/haptic/SDL_haptic.c	Wed Jul 02 08:24:35 2008 +0000
     1.3 @@ -23,6 +23,7 @@
     1.4  
     1.5  #include "SDL_haptic_c.h"
     1.6  #include "SDL_syshaptic.h"
     1.7 +#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
     1.8  
     1.9  
    1.10  static Uint8 SDL_numhaptics = 0;
    1.11 @@ -131,6 +132,39 @@
    1.12  
    1.13  
    1.14  /*
    1.15 + * Returns SDL_TRUE if joystick has haptic features.
    1.16 + */
    1.17 +int
    1.18 +SDL_JoystickIsHaptic(SDL_Joystick * joystick)
    1.19 +{
    1.20 +   int ret;
    1.21 +
    1.22 +   if (!SDL_PrivateJoystickValid(&joystick)) {
    1.23 +      return -1;
    1.24 +   }
    1.25 +
    1.26 +   ret = SDL_SYS_JoystickIsHaptic(joystick);
    1.27 +
    1.28 +   if (ret > 0) return SDL_TRUE;
    1.29 +   else if (ret == 0) return SDL_FALSE;
    1.30 +   else return -1;
    1.31 +}
    1.32 +
    1.33 +
    1.34 +/*
    1.35 + * Opens a haptic device from a joystick.
    1.36 + */
    1.37 +SDL_Haptic *
    1.38 +SDL_HapticOpenFromJoystick(SDL_Joystick * joystick)
    1.39 +{
    1.40 +   if (!SDL_PrivateJoystickValid(&joystick)) {
    1.41 +      return -1;
    1.42 +   }
    1.43 +   return -1;
    1.44 +}
    1.45 +
    1.46 +
    1.47 +/*
    1.48   * Checks to see if the haptic device is valid
    1.49   */
    1.50  static int