changeset 2604:4eee4d565368 gsoc2008_force_feedback

Better handling of direction axes.
author Edgar Simo <bobbens@gmail.com>
date Tue, 05 Aug 2008 16:02:56 +0000
parents a84ce5ae8936
children 0ea3be6e81a7
files src/haptic/darwin/SDL_syshaptic.c src/haptic/win32/SDL_syshaptic.c
diffstat 2 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/haptic/darwin/SDL_syshaptic.c	Tue Aug 05 15:56:35 2008 +0000
+++ b/src/haptic/darwin/SDL_syshaptic.c	Tue Aug 05 16:02:56 2008 +0000
@@ -555,14 +555,18 @@
       case SDL_HAPTIC_CARTESIAN:
          effect->dwFlags |= FFEFF_CARTESIAN;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
       case SDL_HAPTIC_SPHERICAL:
          effect->dwFlags |= FFEFF_SPHERICAL;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
 
       default:
--- a/src/haptic/win32/SDL_syshaptic.c	Tue Aug 05 15:56:35 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Tue Aug 05 16:02:56 2008 +0000
@@ -568,14 +568,18 @@
       case SDL_HAPTIC_CARTESIAN:
          effect->dwFlags |= DIEFF_CARTESIAN;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
       case SDL_HAPTIC_SPHERICAL:
          effect->dwFlags |= DIEFF_SPHERICAL;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
 
       default: