Added SDL_HAPTIC_RAMP support for darwin. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Fri, 18 Jul 2008 19:21:36 +0000
branchgsoc2008_force_feedback
changeset 25330c8cea99c4b8
parent 2532 688cad3f6090
child 2534 e597de8dccd5
Added SDL_HAPTIC_RAMP support for darwin.
src/haptic/darwin/SDL_syshaptic.c
     1.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Fri Jul 18 19:16:03 2008 +0000
     1.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Fri Jul 18 19:21:36 2008 +0000
     1.3 @@ -570,6 +570,32 @@
     1.4  
     1.5        case SDL_HAPTIC_RAMP:
     1.6           hap_ramp = &src->ramp;
     1.7 +         ramp = SDL_malloc(sizeof(FFRAMPFORCE));
     1.8 +         if (ramp == NULL) {
     1.9 +            SDL_OutOfMemory();
    1.10 +            return -1;
    1.11 +         }
    1.12 +
    1.13 +         /* Specifics */
    1.14 +         ramp->lMagnitude = CONVERT(hap_ramp->start);
    1.15 +         ramp->lEnd = CONVERT(hap_ramp->end);
    1.16 +
    1.17 +         /* Generics */
    1.18 +         dest->dwDuration = hap_ramp->length * 1000; /* In microseconds. */
    1.19 +         dest->dwTriggerButton = FFJOFS_BUTTON(hap_ramp->button);
    1.20 +         dest->dwTriggerRepeatInterval = hap_ramp->interval;
    1.21 +         dest->dwStartDelay = hap_ramp->delay * 1000; /* In microseconds. */
    1.22 +
    1.23 +         /* Direction. */
    1.24 +         if (SDL_SYS_SetDirection(dest, &hap_ramp->direction, dest->cAxes) < 0) {
    1.25 +            return -1;
    1.26 +         }
    1.27 +
    1.28 +         /* Envelope */
    1.29 +         envelope->dwAttackLevel = CONVERT(hap_ramp->attack_level);
    1.30 +         envelope->dwAttackTime = hap_ramp->attack_length * 1000;
    1.31 +         envelope->dwFadeLevel = CONVERT(hap_ramp->fade_level);
    1.32 +         envelope->dwFadeTime = hap_ramp->fade_length * 1000;
    1.33  
    1.34           break;
    1.35