Mercurial > sdl-ios-xcode
diff src/haptic/SDL_haptic.c @ 2526:2d88b82ce781 gsoc2008_force_feedback
More documentation.
SDL_HapticPeriodic.phase now should make sense.
More explicit if you try to update an effect type.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Fri, 18 Jul 2008 08:00:16 +0000 |
parents | 1a55848ce198 |
children | 2274406ba792 |
line wrap: on
line diff
--- a/src/haptic/SDL_haptic.c Thu Jul 17 16:08:46 2008 +0000 +++ b/src/haptic/SDL_haptic.c Fri Jul 18 08:00:16 2008 +0000 @@ -440,6 +440,8 @@ if (SDL_SYS_HapticNewEffect(haptic,&haptic->effects[i],effect) != 0) { return -1; /* Backend failed to create effect */ } + + SDL_memcpy(&haptic->effects[i].effect, effect, sizeof(SDL_HapticEffect)); return i; } } @@ -471,11 +473,18 @@ return -1; } + /* Can't change type dynamically. */ + if (data->type != haptic->effects[effect].effect.type) { + SDL_SetError("Haptic: Updating effect type is illegal."); + return -1; + } + /* Updates the effect */ if (SDL_SYS_HapticUpdateEffect(haptic,&haptic->effects[effect],data) < 0) { return -1; } + SDL_memcpy(&haptic->effects[effect].effect, data, sizeof(SDL_HapticEffect)); return 0; }