Mercurial > sdl-ios-xcode
comparison src/haptic/SDL_haptic.c @ 2505:abfcba0f3bd1 gsoc2008_force_feedback
Added SDL_HapticIndex.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Tue, 08 Jul 2008 19:23:03 +0000 |
parents | 0893fbf73b3d |
children | ba8e99fe92c1 |
comparison
equal
deleted
inserted
replaced
2504:e68c99a19a2f | 2505:abfcba0f3bd1 |
---|---|
57 return status; | 57 return status; |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 /* | 61 /* |
62 * Checks to see if the haptic device is valid | |
63 */ | |
64 static int | |
65 ValidHaptic(SDL_Haptic ** haptic) | |
66 { | |
67 int valid; | |
68 | |
69 if (*haptic == NULL) { | |
70 SDL_SetError("Haptic device hasn't been opened yet"); | |
71 valid = 0; | |
72 } else { | |
73 valid = 1; | |
74 } | |
75 return valid; | |
76 } | |
77 | |
78 | |
79 /* | |
62 * Returns the number of available devices. | 80 * Returns the number of available devices. |
63 */ | 81 */ |
64 int | 82 int |
65 SDL_NumHaptics(void) | 83 SDL_NumHaptics(void) |
66 { | 84 { |
129 return haptic; | 147 return haptic; |
130 } | 148 } |
131 | 149 |
132 | 150 |
133 /* | 151 /* |
152 * Returns the index to a haptic device. | |
153 */ | |
154 int | |
155 SDL_HapticIndex(SDL_Haptic * haptic) | |
156 { | |
157 if (!ValidHaptic(&haptic)) { | |
158 return -1; | |
159 } | |
160 | |
161 return haptic->index; | |
162 } | |
163 | |
164 | |
165 /* | |
134 * Returns SDL_TRUE if joystick has haptic features. | 166 * Returns SDL_TRUE if joystick has haptic features. |
135 */ | 167 */ |
136 int | 168 int |
137 SDL_JoystickIsHaptic(SDL_Joystick * joystick) | 169 SDL_JoystickIsHaptic(SDL_Joystick * joystick) |
138 { | 170 { |
202 return haptic; | 234 return haptic; |
203 } | 235 } |
204 | 236 |
205 | 237 |
206 /* | 238 /* |
207 * Checks to see if the haptic device is valid | |
208 */ | |
209 static int | |
210 ValidHaptic(SDL_Haptic ** haptic) | |
211 { | |
212 int valid; | |
213 | |
214 if (*haptic == NULL) { | |
215 SDL_SetError("Haptic device hasn't been opened yet"); | |
216 valid = 0; | |
217 } else { | |
218 valid = 1; | |
219 } | |
220 return valid; | |
221 } | |
222 | |
223 | |
224 /* | |
225 * Closes a SDL_Haptic device. | 239 * Closes a SDL_Haptic device. |
226 */ | 240 */ |
227 void | 241 void |
228 SDL_HapticClose(SDL_Haptic * haptic) | 242 SDL_HapticClose(SDL_Haptic * haptic) |
229 { | 243 { |