Mercurial > sdl-ios-xcode
comparison src/haptic/linux/SDL_syshaptic.c @ 2519:af9df9662807 gsoc2008_force_feedback
More explicit with iterations and length.
Added spherical coordinates (not available on linux).
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Tue, 15 Jul 2008 15:53:48 +0000 |
parents | 07a5b225b9c9 |
children | 366d84fdf8d1 |
comparison
equal
deleted
inserted
replaced
2518:07a5b225b9c9 | 2519:af9df9662807 |
---|---|
670 | 670 |
671 /* | 671 /* |
672 * Runs an effect. | 672 * Runs an effect. |
673 */ | 673 */ |
674 int | 674 int |
675 SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect, int iterations) | 675 SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect, |
676 Uint32 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 if (iterations == SDL_HAPTIC_INFINITY) | 683 run.value = (iterations > INT_MAX) ? INT_MAX : iterations; |
683 run.value = INT_MAX; | |
684 else | |
685 run.value = iterations; | |
686 | 684 |
687 if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) { | 685 if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) { |
688 SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno)); | 686 SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno)); |
689 return -1; | 687 return -1; |
690 } | 688 } |