diff options
Diffstat (limited to 'src/i_joystick.h')
-rw-r--r-- | src/i_joystick.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/i_joystick.h b/src/i_joystick.h index 93895de7..7c28eb6c 100644 --- a/src/i_joystick.h +++ b/src/i_joystick.h @@ -45,6 +45,24 @@ // Create a button axis value from two button values. #define CREATE_BUTTON_AXIS(neg, pos) (BUTTON_AXIS | (neg) | ((pos) << 8)) +// If this bit is set in an axis value, the axis is not actually a +// joystick axis, but is a "hat" axis. This means that we read (one of) +// the hats on the joystick. +#define HAT_AXIS 0x20000 + +#define IS_HAT_AXIS(axis) ((axis) >= 0 && ((axis) & HAT_AXIS) != 0) + +// Get the hat number from a hat axis value. +#define HAT_AXIS_HAT(axis) ((axis) & 0xff) +// Which axis of the hat? (horizonal or vertical) +#define HAT_AXIS_DIRECTION(axis) (((axis) >> 8) & 0xff) + +#define CREATE_HAT_AXIS(hat, direction) \ + (HAT_AXIS | (hat) | ((direction) << 8)) + +#define HAT_AXIS_HORIZONTAL 1 +#define HAT_AXIS_VERTICAL 2 + void I_InitJoystick(void); void I_ShutdownJoystick(void); void I_UpdateJoystick(void); |