comparison 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
comparison
equal deleted inserted replaced
2488:8e2bdbccf7ff 2489:96adc8025331
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 #include "SDL_haptic_c.h" 24 #include "SDL_haptic_c.h"
25 #include "SDL_syshaptic.h" 25 #include "SDL_syshaptic.h"
26 #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
26 27
27 28
28 static Uint8 SDL_numhaptics = 0; 29 static Uint8 SDL_numhaptics = 0;
29 SDL_Haptic **SDL_haptics = NULL; 30 SDL_Haptic **SDL_haptics = NULL;
30 static SDL_Haptic *default_haptic = NULL; 31 static SDL_Haptic *default_haptic = NULL;
129 return haptic; 130 return haptic;
130 } 131 }
131 132
132 133
133 /* 134 /*
135 * Returns SDL_TRUE if joystick has haptic features.
136 */
137 int
138 SDL_JoystickIsHaptic(SDL_Joystick * joystick)
139 {
140 int ret;
141
142 if (!SDL_PrivateJoystickValid(&joystick)) {
143 return -1;
144 }
145
146 ret = SDL_SYS_JoystickIsHaptic(joystick);
147
148 if (ret > 0) return SDL_TRUE;
149 else if (ret == 0) return SDL_FALSE;
150 else return -1;
151 }
152
153
154 /*
155 * Opens a haptic device from a joystick.
156 */
157 SDL_Haptic *
158 SDL_HapticOpenFromJoystick(SDL_Joystick * joystick)
159 {
160 if (!SDL_PrivateJoystickValid(&joystick)) {
161 return -1;
162 }
163 return -1;
164 }
165
166
167 /*
134 * Checks to see if the haptic device is valid 168 * Checks to see if the haptic device is valid
135 */ 169 */
136 static int 170 static int
137 ValidHaptic(SDL_Haptic ** haptic) 171 ValidHaptic(SDL_Haptic ** haptic)
138 { 172 {