Mercurial > sdl-ios-xcode
diff 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 |
line wrap: on
line diff
--- a/src/haptic/SDL_haptic.c Mon Jul 07 18:42:10 2008 +0000 +++ b/src/haptic/SDL_haptic.c Tue Jul 08 19:23:03 2008 +0000 @@ -59,6 +59,24 @@ /* + * Checks to see if the haptic device is valid + */ +static int +ValidHaptic(SDL_Haptic ** haptic) +{ + int valid; + + if (*haptic == NULL) { + SDL_SetError("Haptic device hasn't been opened yet"); + valid = 0; + } else { + valid = 1; + } + return valid; +} + + +/* * Returns the number of available devices. */ int @@ -131,6 +149,20 @@ /* + * Returns the index to a haptic device. + */ +int +SDL_HapticIndex(SDL_Haptic * haptic) +{ + if (!ValidHaptic(&haptic)) { + return -1; + } + + return haptic->index; +} + + +/* * Returns SDL_TRUE if joystick has haptic features. */ int @@ -204,24 +236,6 @@ /* - * Checks to see if the haptic device is valid - */ -static int -ValidHaptic(SDL_Haptic ** haptic) -{ - int valid; - - if (*haptic == NULL) { - SDL_SetError("Haptic device hasn't been opened yet"); - valid = 0; - } else { - valid = 1; - } - return valid; -} - - -/* * Closes a SDL_Haptic device. */ void