summaryrefslogtreecommitdiff
path: root/src/i_joystick.c
diff options
context:
space:
mode:
authorSimon Howard2008-09-11 21:03:48 +0000
committerSimon Howard2008-09-11 21:03:48 +0000
commitb868352951acee0e556d702e5e90aa67d9a2b39e (patch)
treeb07b281ae6be155d2b80fdc09c2daa3c3132d238 /src/i_joystick.c
parentd863f019a2d19f1146d92c4db71883ab2ead87ec (diff)
downloadchocolate-doom-b868352951acee0e556d702e5e90aa67d9a2b39e.tar.gz
chocolate-doom-b868352951acee0e556d702e5e90aa67d9a2b39e.tar.bz2
chocolate-doom-b868352951acee0e556d702e5e90aa67d9a2b39e.zip
Refactor configuration file system to allow configuration file variables
to be bound in a distributed fashion around the program. Remove dependency of m_config.c on doom/. Subversion-branch: /branches/raven-branch Subversion-revision: 1222
Diffstat (limited to 'src/i_joystick.c')
-rw-r--r--src/i_joystick.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/i_joystick.c b/src/i_joystick.c
index 1547e569..d11d3084 100644
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -35,6 +35,8 @@
#include "d_event.h"
#include "i_joystick.h"
+#include "m_config.h"
+
// When an axis is within the dead zone, it is set to zero.
// This is 5% of the full range:
@@ -46,23 +48,23 @@ static SDL_Joystick *joystick = NULL;
// Standard default.cfg Joystick enable/disable
-extern int usejoystick;
+static int usejoystick = 0;
// Joystick to use, as an SDL joystick index:
-int joystick_index = -1;
+static int joystick_index = -1;
// Which joystick axis to use for horizontal movement, and whether to
// invert the direction:
-int joystick_x_axis = 0;
-int joystick_x_invert = 0;
+static int joystick_x_axis = 0;
+static int joystick_x_invert = 0;
// Which joystick axis to use for vertical movement, and whether to
// invert the direction:
-int joystick_y_axis = 1;
-int joystick_y_invert = 0;
+static int joystick_y_axis = 1;
+static int joystick_y_invert = 0;
void I_InitJoystick(void)
{
@@ -184,3 +186,13 @@ void I_UpdateJoystick(void)
}
}
+void I_BindJoystickVariables(void)
+{
+ M_BindVariable("use_joystick", &usejoystick);
+ 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_x_invert", &joystick_x_invert);
+ M_BindVariable("joystick_y_invert", &joystick_y_invert);
+}
+