src/haptic/darwin/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2529 e1d5d16e88a8
parent 2528 50414589501e
child 2530 22ce87690b41
equal deleted inserted replaced
2528:50414589501e 2529:e1d5d16e88a8
   339 
   339 
   340 /*
   340 /*
   341  * Sets the direction.
   341  * Sets the direction.
   342  */
   342  */
   343 static int
   343 static int
   344 SDL_SYS_SetDirection( FFEFFECT * effect, SDL_HapticDirection *dir, int axes )
   344 SDL_SYS_SetDirection( FFEFFECT * effect, SDL_HapticDirection *dir, int naxes )
   345 {
   345 {
   346    LONG *rglDir;
   346    LONG *rglDir;
   347 
   347 
   348    /* Handle no axes a part. */
   348    /* Handle no axes a part. */
   349    if (naxes == 0) {
   349    if (naxes == 0) {
   350       effect->rglDirection = NULL;
   350       effect->rglDirection = NULL;
   351       return 0;
   351       return 0;
   352    }
   352    }
   353 
   353 
   354    /* Has axes. */
   354    /* Has axes. */
   355    rglDir = SDL_malloc( sizeof(LONG) * axes );
   355    rglDir = SDL_malloc( sizeof(LONG) * naxes );
   356    if (rglDir == NULL) {
   356    if (rglDir == NULL) {
   357       SDL_OutOfMemory();
   357       SDL_OutOfMemory();
   358       return -1;
   358       return -1;
   359    }
   359    }
   360    SDL_memset( rglDir, 0, sizeof(LONG) * axes );
   360    SDL_memset( rglDir, 0, sizeof(LONG) * naxes );
   361    effect->rglDirection = rglDir;
   361    effect->rglDirection = rglDir;
   362 
   362 
   363    switch (dir->type) {
   363    switch (dir->type) {
   364       case SDL_HAPTIC_POLAR:
   364       case SDL_HAPTIC_POLAR:
   365          effect->dwFlags |= FFEFF_POLAR;
   365          effect->dwFlags |= FFEFF_POLAR;