Mercurial > sdl-ios-xcode
diff src/haptic/linux/SDL_syshaptic.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 | 22ce87690b41 |
line wrap: on
line diff
--- a/src/haptic/linux/SDL_syshaptic.c Thu Jul 17 16:08:46 2008 +0000 +++ b/src/haptic/linux/SDL_syshaptic.c Fri Jul 18 08:00:16 2008 +0000 @@ -493,6 +493,7 @@ static int SDL_SYS_ToFFEffect( struct ff_effect * dest, SDL_HapticEffect * src ) { + Uint32 tmp; SDL_HapticConstant *constant; SDL_HapticPeriodic *periodic; SDL_HapticCondition *condition; @@ -563,7 +564,9 @@ dest->u.periodic.period = CLAMP(periodic->period); dest->u.periodic.magnitude = periodic->magnitude; dest->u.periodic.offset = periodic->offset; - dest->u.periodic.phase = CLAMP(periodic->phase); + /* Phase is calculated based of offset from period and then clamped. */ + tmp = ((periodic->phase % 36000) * dest->u.periodic.period) / 36000; + dest->u.periodic.phase = CLAMP(tmp); /* Envelope */ dest->u.periodic.envelope.attack_length = CLAMP(periodic->attack_length);