summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i_joystick.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/i_joystick.c b/src/i_joystick.c
index b6333334..06d3679b 100644
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -37,6 +37,11 @@
#include "d_main.h"
#include "i_joystick.h"
+// When an axis is within the dead zone, it is set to zero.
+// This is 5% of the full range:
+
+#define DEAD_ZONE (32768 / 20)
+
static SDL_Joystick *joystick = NULL;
// Configuration variables:
@@ -158,6 +163,11 @@ static int GetAxisState(int axis, int invert)
result = -result;
}
+ if (result < DEAD_ZONE && result > -DEAD_ZONE)
+ {
+ result = 0;
+ }
+
return result;
}