# HG changeset patch # User Edgar Simo # Date 1216408896 0 # Node ID 0c8cea99c4b8901a4d2cdf2e46153b878c12eff8 # Parent 688cad3f6090cf577ab7faef4e2b6d388301d8b0 Added SDL_HAPTIC_RAMP support for darwin. diff -r 688cad3f6090 -r 0c8cea99c4b8 src/haptic/darwin/SDL_syshaptic.c --- a/src/haptic/darwin/SDL_syshaptic.c Fri Jul 18 19:16:03 2008 +0000 +++ b/src/haptic/darwin/SDL_syshaptic.c Fri Jul 18 19:21:36 2008 +0000 @@ -570,6 +570,32 @@ case SDL_HAPTIC_RAMP: hap_ramp = &src->ramp; + ramp = SDL_malloc(sizeof(FFRAMPFORCE)); + if (ramp == NULL) { + SDL_OutOfMemory(); + return -1; + } + + /* Specifics */ + ramp->lMagnitude = CONVERT(hap_ramp->start); + ramp->lEnd = CONVERT(hap_ramp->end); + + /* Generics */ + dest->dwDuration = hap_ramp->length * 1000; /* In microseconds. */ + dest->dwTriggerButton = FFJOFS_BUTTON(hap_ramp->button); + dest->dwTriggerRepeatInterval = hap_ramp->interval; + dest->dwStartDelay = hap_ramp->delay * 1000; /* In microseconds. */ + + /* Direction. */ + if (SDL_SYS_SetDirection(dest, &hap_ramp->direction, dest->cAxes) < 0) { + return -1; + } + + /* Envelope */ + envelope->dwAttackLevel = CONVERT(hap_ramp->attack_level); + envelope->dwAttackTime = hap_ramp->attack_length * 1000; + envelope->dwFadeLevel = CONVERT(hap_ramp->fade_level); + envelope->dwFadeTime = hap_ramp->fade_length * 1000; break;