Fixed linux directions being inverted. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Mon, 07 Jul 2008 16:58:16 +0000
branchgsoc2008_force_feedback
changeset 2502 5356ca0c36a3
parent 2501 ff12f79dfc8d
child 2503 84a634009a83
Fixed linux directions being inverted.
include/SDL_haptic.h
src/haptic/linux/SDL_syshaptic.c
--- a/include/SDL_haptic.h	Mon Jul 07 11:51:28 2008 +0000
+++ b/include/SDL_haptic.h	Mon Jul 07 16:58:16 2008 +0000
@@ -291,7 +291,7 @@
  *                    ^
  *                    |
  *                    |
- * (1)  East <----[ HAPTIC ]----> West (-1)
+ * (1)  West <----[ HAPTIC ]----> East (-1)
  *                    |
  *                    |
  *                    v
--- a/src/haptic/linux/SDL_syshaptic.c	Mon Jul 07 11:51:28 2008 +0000
+++ b/src/haptic/linux/SDL_syshaptic.c	Mon Jul 07 16:58:16 2008 +0000
@@ -341,7 +341,8 @@
 
    switch (dir->type) {
       case SDL_HAPTIC_POLAR:
-         tmp = ((dir->dir[0] % 36000) * 0xFFFF) / 36000;
+         /* Linux directions are inverted. */
+         tmp = (((18000 + dir->dir[0]) % 36000) * 0xFFFF) / 36000;
          return (Uint16) tmp;
          break;
       case SDL_HAPTIC_CARTESIAN: