From: Ingo Ruhnke Date: Sun, 14 Mar 2004 17:01:45 +0000 (+0000) Subject: - larger joystick dead zone for analog stick noise X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a858e0c68e702b2df71f8fae4df570ad8e900259;p=supertux.git - larger joystick dead zone for analog stick noise SVN-Revision: 217 --- 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 */