summaryrefslogtreecommitdiff
path: root/src/i_joystick.h
diff options
context:
space:
mode:
authorSimon Howard2014-04-30 22:56:04 -0400
committerSimon Howard2014-04-30 22:56:04 -0400
commit4890591ba50bfc8b11cda684b223cb7c551e6dd3 (patch)
tree589edddb7f25d68f2f7f9b990b82078eca728491 /src/i_joystick.h
parent96ff3f7bc127889c9f47e4ec17faa445ade623f1 (diff)
downloadchocolate-doom-4890591ba50bfc8b11cda684b223cb7c551e6dd3.tar.gz
chocolate-doom-4890591ba50bfc8b11cda684b223cb7c551e6dd3.tar.bz2
chocolate-doom-4890591ba50bfc8b11cda684b223cb7c551e6dd3.zip
joystick: Add virtual-physical button mapping.
The solution to solving #386 is to add a layer of indirection: the game code can only support up to ~20 joystick buttons, but this doesn't matter as long as we never want to bind more than 20 buttons to actions anyway. Redefine the game's notion of buttons to be based on "virtual" joystick buttons, and map these buttons to physical (SDL) buttons based on configuration file variables.
Diffstat (limited to 'src/i_joystick.h')
-rw-r--r--src/i_joystick.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/i_joystick.h b/src/i_joystick.h
index 7c28eb6c..c9e5b380 100644
--- a/src/i_joystick.h
+++ b/src/i_joystick.h
@@ -27,6 +27,11 @@
#ifndef __I_JOYSTICK__
#define __I_JOYSTICK__
+// Number of "virtual" joystick buttons defined in configuration files.
+// This needs to be at least as large as the number of different key
+// bindings supported by the higher-level game code (joyb* variables).
+#define NUM_VIRTUAL_BUTTONS 10
+
// If this bit is set in a configuration file axis value, the axis is
// not actually a joystick axis, but instead is a "button axis". This
// means that instead of reading an SDL joystick axis, we read the