Mercurial > sdl-ios-xcode
comparison src/haptic/SDL_haptic.c @ 2478:4fd783e0f34b gsoc2008_force_feedback
Added query functions for haptic devices.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Mon, 30 Jun 2008 17:28:34 +0000 |
parents | 97f75ea43a93 |
children | b9eb2cfe16cd |
comparison
equal
deleted
inserted
replaced
2477:97f75ea43a93 | 2478:4fd783e0f34b |
---|---|
195 SDL_free(SDL_haptics); | 195 SDL_free(SDL_haptics); |
196 SDL_haptics = NULL; | 196 SDL_haptics = NULL; |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 /* | |
201 * Returns the number of effects a haptic device has. | |
202 */ | |
203 int | |
204 SDL_HapticNumEffects(SDL_Haptic * haptic) | |
205 { | |
206 if (!ValidHaptic(&haptic)) { | |
207 return -1; | |
208 } | |
209 | |
210 return haptic->neffects; | |
211 } | |
212 | |
213 /* | |
214 * Returns supported effects by the device. | |
215 */ | |
216 unsigned int | |
217 SDL_HapticQueryEffects(SDL_Haptic * haptic) | |
218 { | |
219 if (!ValidHaptic(&haptic)) { | |
220 return -1; | |
221 } | |
222 | |
223 return haptic->supported; | |
224 } | |
225 | |
226 int | |
227 SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect) | |
228 { | |
229 if (!ValidHaptic(&haptic)) { | |
230 return -1; | |
231 } | |
232 | |
233 if ((haptic->supported & effect->type) != 0) | |
234 return SDL_TRUE; | |
235 return SDL_FALSE; | |
236 } | |
200 | 237 |
201 /* | 238 /* |
202 * Creates a new haptic effect. | 239 * Creates a new haptic effect. |
203 */ | 240 */ |
204 int | 241 int |