Better handling of direction axes. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Tue, 05 Aug 2008 16:02:56 +0000
branchgsoc2008_force_feedback
changeset 26044eee4d565368
parent 2603 a84ce5ae8936
child 2605 0ea3be6e81a7
Better handling of direction axes.
src/haptic/darwin/SDL_syshaptic.c
src/haptic/win32/SDL_syshaptic.c
     1.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Tue Aug 05 15:56:35 2008 +0000
     1.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Tue Aug 05 16:02:56 2008 +0000
     1.3 @@ -555,14 +555,18 @@
     1.4        case SDL_HAPTIC_CARTESIAN:
     1.5           effect->dwFlags |= FFEFF_CARTESIAN;
     1.6           rglDir[0] = dir->dir[0];
     1.7 -         rglDir[1] = dir->dir[1];
     1.8 -         rglDir[2] = dir->dir[2];
     1.9 +         if (naxes > 1)
    1.10 +            rglDir[1] = dir->dir[1];
    1.11 +         if (naxes > 2)
    1.12 +            rglDir[2] = dir->dir[2];
    1.13           return 0;
    1.14        case SDL_HAPTIC_SPHERICAL:
    1.15           effect->dwFlags |= FFEFF_SPHERICAL;
    1.16           rglDir[0] = dir->dir[0];
    1.17 -         rglDir[1] = dir->dir[1];
    1.18 -         rglDir[2] = dir->dir[2];
    1.19 +         if (naxes > 1)
    1.20 +            rglDir[1] = dir->dir[1];
    1.21 +         if (naxes > 2)
    1.22 +            rglDir[2] = dir->dir[2];
    1.23           return 0;
    1.24  
    1.25        default:
     2.1 --- a/src/haptic/win32/SDL_syshaptic.c	Tue Aug 05 15:56:35 2008 +0000
     2.2 +++ b/src/haptic/win32/SDL_syshaptic.c	Tue Aug 05 16:02:56 2008 +0000
     2.3 @@ -568,14 +568,18 @@
     2.4        case SDL_HAPTIC_CARTESIAN:
     2.5           effect->dwFlags |= DIEFF_CARTESIAN;
     2.6           rglDir[0] = dir->dir[0];
     2.7 -         rglDir[1] = dir->dir[1];
     2.8 -         rglDir[2] = dir->dir[2];
     2.9 +         if (naxes > 1)
    2.10 +            rglDir[1] = dir->dir[1];
    2.11 +         if (naxes > 2)
    2.12 +            rglDir[2] = dir->dir[2];
    2.13           return 0;
    2.14        case SDL_HAPTIC_SPHERICAL:
    2.15           effect->dwFlags |= DIEFF_SPHERICAL;
    2.16           rglDir[0] = dir->dir[0];
    2.17 -         rglDir[1] = dir->dir[1];
    2.18 -         rglDir[2] = dir->dir[2];
    2.19 +         if (naxes > 1)
    2.20 +            rglDir[1] = dir->dir[1];
    2.21 +         if (naxes > 2)
    2.22 +            rglDir[2] = dir->dir[2];
    2.23           return 0;
    2.24  
    2.25        default: