From 74e1b8b7548e6d14eb9be748279e8100a766cf04 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 19 Apr 2014 01:12:13 -0400 Subject: 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. --- src/d_event.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/d_event.h') diff --git a/src/d_event.h b/src/d_event.h index 25334a96..230f3fa5 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -49,10 +49,30 @@ typedef enum // Event structure. typedef struct { - evtype_t type; - int data1; // keys / mouse/joystick buttons - int data2; // mouse/joystick x move - int data3; // mouse/joystick y move + evtype_t type; + + // Event-related data that depends on the type of event: + // + // ev_keydown/ev_keyup: + // data1: Key code (from doomkeys.h) of the key that was + // pressed or released. + // data2: Ascii text of the character that was pressed, + // shifted appropriately (eg. '$' if 4 was pressed + // while shift was held). + // + // ev_mouse: + // data1: Bitfield of buttons currently held down. + // (bit 0 = left; bit 1 = right; bit 2 = middle). + // data2: X axis mouse movement (turn). + // data3: Y axis mouse movement (forward/backward). + // + // ev_joystick: + // data1: Bitfield of buttons currently pressed. + // data2: X axis mouse movement (turn). + // data3: Y axis mouse movement (forward/backward). + // data4: Third axis mouse movement (strafe). + + int data1, data2, data3, data4; } event_t; -- cgit v1.2.3