Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
2516:6da022b18314 | 2517:37c13c12c878 |
---|---|
34 #include <sys/ioctl.h> | 34 #include <sys/ioctl.h> |
35 #include <sys/types.h> | 35 #include <sys/types.h> |
36 #include <sys/stat.h> | 36 #include <sys/stat.h> |
37 #include <fcntl.h> | 37 #include <fcntl.h> |
38 #include <linux/limits.h> | 38 #include <linux/limits.h> |
39 #include <limits.h> /* INT_MAX */ | |
39 #include <string.h> | 40 #include <string.h> |
40 #include <errno.h> | 41 #include <errno.h> |
41 #include <math.h> | 42 #include <math.h> |
42 | 43 |
43 #ifndef M_PI | 44 #ifndef M_PI |
670 | 671 |
671 /* | 672 /* |
672 * Runs an effect. | 673 * Runs an effect. |
673 */ | 674 */ |
674 int | 675 int |
675 SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect) | 676 SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect, int iterations) |
676 { | 677 { |
677 struct input_event run; | 678 struct input_event run; |
678 | 679 |
679 /* Prepare to run the effect */ | 680 /* Prepare to run the effect */ |
680 run.type = EV_FF; | 681 run.type = EV_FF; |
681 run.code = effect->hweffect->effect.id; | 682 run.code = effect->hweffect->effect.id; |
682 run.value = 1; | 683 if (iterations == SDL_HAPTIC_INFINITY) |
684 run.value = INT_MAX; | |
685 else | |
686 run.value = iterations; | |
683 | 687 |
684 if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) { | 688 if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) { |
685 SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno)); | 689 SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno)); |
686 return -1; | 690 return -1; |
687 } | 691 } |