src/haptic/darwin/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2561 3696b9ce8a37
parent 2559 42b682e85546
child 2562 c284ce0cd8e0
equal deleted inserted replaced
2560:2274406ba792 2561:3696b9ce8a37
   468  * Closes the haptic device.
   468  * Closes the haptic device.
   469  */
   469  */
   470 void
   470 void
   471 SDL_SYS_HapticClose(SDL_Haptic * haptic)
   471 SDL_SYS_HapticClose(SDL_Haptic * haptic)
   472 {
   472 {
   473    int i;
       
   474 
       
   475    if (haptic->hwdata) {
   473    if (haptic->hwdata) {
   476 
   474 
   477       /* Free the effects. */
   475       /* Free Effects. */
   478       for (i=0; i<haptic->neffects; i++) {        
       
   479          if (haptic->effects[i].hweffect != NULL) {
       
   480             SDL_SYS_HapticFreeFFEFFECT(&haptic->effects[i].hweffect->effect,
       
   481                                        haptic->effects[i].effect.type);
       
   482             SDL_free(haptic->effects[i].hweffect);
       
   483          } 
       
   484       }    
       
   485       SDL_free(haptic->effects);
   476       SDL_free(haptic->effects);
       
   477       haptic->effects = NULL;
   486       haptic->neffects = 0;
   478       haptic->neffects = 0;
   487 
   479 
   488       /* Clean up */
   480       /* Clean up */
   489       FFReleaseDevice(haptic->hwdata->device);
   481       FFReleaseDevice(haptic->hwdata->device);
   490 
   482