summaryrefslogtreecommitdiff
path: root/src/setup/joystick.c
diff options
context:
space:
mode:
authorSimon Howard2014-04-19 01:12:13 -0400
committerSimon Howard2014-04-19 01:12:13 -0400
commit74e1b8b7548e6d14eb9be748279e8100a766cf04 (patch)
treeed10a7eb0605d8fd58e4bd8974a2994eb839976b /src/setup/joystick.c
parent64cdaabd292d54fe3637b4530eb610af2d46c647 (diff)
downloadchocolate-doom-74e1b8b7548e6d14eb9be748279e8100a766cf04.tar.gz
chocolate-doom-74e1b8b7548e6d14eb9be748279e8100a766cf04.tar.bz2
chocolate-doom-74e1b8b7548e6d14eb9be748279e8100a766cf04.zip
joystick: Add an axis to allow strafing.
Modern gamepads typically have 2-3 D-pads and joysticks. This means that it's desirable to be able to use one joystick for turning and another for strafing. Add another axis in addition to the current X and y axes that performs strafe movement.
Diffstat (limited to 'src/setup/joystick.c')
-rw-r--r--src/setup/joystick.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index 064ff99d..9e04ba0b 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -63,6 +63,11 @@ static int joystick_x_invert = 0;
static int joystick_y_axis = 1;
static int joystick_y_invert = 0;
+// Strafe axis.
+
+static int joystick_strafe_axis = -1;
+static int joystick_strafe_invert = 0;
+
static txt_button_t *joystick_button;
static int *all_joystick_buttons[] = {
@@ -438,7 +443,9 @@ void BindJoystickVariables(void)
M_BindVariable("joystick_index", &joystick_index);
M_BindVariable("joystick_x_axis", &joystick_x_axis);
M_BindVariable("joystick_y_axis", &joystick_y_axis);
+ M_BindVariable("joystick_strafe_axis", &joystick_strafe_axis);
M_BindVariable("joystick_x_invert", &joystick_x_invert);
M_BindVariable("joystick_y_invert", &joystick_y_invert);
+ M_BindVariable("joystick_strafe_invert",&joystick_strafe_invert);
}