Mercurial > sdl-ios-xcode
diff src/haptic/linux/SDL_syshaptic.c @ 2517:37c13c12c878 gsoc2008_force_feedback
Broke API by introducing iterations to SDL_HapticRunEffects().
Fixed minor issues.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Thu, 10 Jul 2008 17:54:08 +0000 |
parents | 030fc4375e63 |
children | 07a5b225b9c9 |
line wrap: on
line diff
--- a/src/haptic/linux/SDL_syshaptic.c Thu Jul 10 17:52:57 2008 +0000 +++ b/src/haptic/linux/SDL_syshaptic.c Thu Jul 10 17:54:08 2008 +0000 @@ -36,6 +36,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <linux/limits.h> +#include <limits.h> /* INT_MAX */ #include <string.h> #include <errno.h> #include <math.h> @@ -672,14 +673,17 @@ * Runs an effect. */ int -SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect) +SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect, int iterations) { struct input_event run; /* Prepare to run the effect */ run.type = EV_FF; run.code = effect->hweffect->effect.id; - run.value = 1; + if (iterations == SDL_HAPTIC_INFINITY) + run.value = INT_MAX; + else + run.value = iterations; if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) { SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));