From a858e0c68e702b2df71f8fae4df570ad8e900259 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sun, 14 Mar 2004 17:01:45 +0000 Subject: [PATCH] - larger joystick dead zone for analog stick noise SVN-Revision: 217 --- src/gameloop.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gameloop.c b/src/gameloop.c index 3eddc5ea7..f4727ee36 100644 --- a/src/gameloop.c +++ b/src/gameloop.c @@ -68,6 +68,8 @@ void drawstatus(void); void drawendscreen(void); void drawresultscreen(void); +#define JOYSTICK_DEAD_ZONE 4096 + void levelintro(void) { /* Level Intro: */ @@ -236,20 +238,20 @@ void game_event(void) switch(event.jaxis.axis) { case JOY_X: - if (event.jaxis.value < -1024) + if (event.jaxis.value < -JOYSTICK_DEAD_ZONE) tux.input.left = DOWN; - else if (event.jaxis.value > 1024) + else if (event.jaxis.value > JOYSTICK_DEAD_ZONE) tux.input.left = UP; - if (event.jaxis.value > 1024) + if (event.jaxis.value > JOYSTICK_DEAD_ZONE) tux.input.right = DOWN; - else if (event.jaxis.value < -1024) + else if (event.jaxis.value < -JOYSTICK_DEAD_ZONE) tux.input.right = UP; break; case JOY_Y: - if (event.jaxis.value > 1024) + if (event.jaxis.value > JOYSTICK_DEAD_ZONE) tux.input.down = DOWN; - else if (event.jaxis.value < -1024) + else if (event.jaxis.value < -JOYSTICK_DEAD_ZONE) tux.input.down = UP; /* Handle joystick for the menu */ -- 2.11.0