Mercurial > sdl-ios-xcode
comparison src/haptic/darwin/SDL_syshaptic.c @ 2533:0c8cea99c4b8 gsoc2008_force_feedback
Added SDL_HAPTIC_RAMP support for darwin.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Fri, 18 Jul 2008 19:21:36 +0000 |
parents | 688cad3f6090 |
children | e597de8dccd5 |
comparison
equal
deleted
inserted
replaced
2532:688cad3f6090 | 2533:0c8cea99c4b8 |
---|---|
568 | 568 |
569 break; | 569 break; |
570 | 570 |
571 case SDL_HAPTIC_RAMP: | 571 case SDL_HAPTIC_RAMP: |
572 hap_ramp = &src->ramp; | 572 hap_ramp = &src->ramp; |
573 ramp = SDL_malloc(sizeof(FFRAMPFORCE)); | |
574 if (ramp == NULL) { | |
575 SDL_OutOfMemory(); | |
576 return -1; | |
577 } | |
578 | |
579 /* Specifics */ | |
580 ramp->lMagnitude = CONVERT(hap_ramp->start); | |
581 ramp->lEnd = CONVERT(hap_ramp->end); | |
582 | |
583 /* Generics */ | |
584 dest->dwDuration = hap_ramp->length * 1000; /* In microseconds. */ | |
585 dest->dwTriggerButton = FFJOFS_BUTTON(hap_ramp->button); | |
586 dest->dwTriggerRepeatInterval = hap_ramp->interval; | |
587 dest->dwStartDelay = hap_ramp->delay * 1000; /* In microseconds. */ | |
588 | |
589 /* Direction. */ | |
590 if (SDL_SYS_SetDirection(dest, &hap_ramp->direction, dest->cAxes) < 0) { | |
591 return -1; | |
592 } | |
593 | |
594 /* Envelope */ | |
595 envelope->dwAttackLevel = CONVERT(hap_ramp->attack_level); | |
596 envelope->dwAttackTime = hap_ramp->attack_length * 1000; | |
597 envelope->dwFadeLevel = CONVERT(hap_ramp->fade_level); | |
598 envelope->dwFadeTime = hap_ramp->fade_length * 1000; | |
573 | 599 |
574 break; | 600 break; |
575 | 601 |
576 | 602 |
577 default: | 603 default: |