Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
4.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef INPUTENUMS_H
  7. #define INPUTENUMS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // Standard maximum +/- value of a joystick axis
  12. #define MAX_BUTTONSAMPLE 32768
  13. #if !defined( _X360 )
  14. #define INVALID_USER_ID -1
  15. #else
  16. #define INVALID_USER_ID XBX_INVALID_USER_ID
  17. #endif
  18. //-----------------------------------------------------------------------------
  19. // Forward declarations:
  20. //-----------------------------------------------------------------------------
  21. enum
  22. {
  23. MAX_JOYSTICKS = 1,
  24. MOUSE_BUTTON_COUNT = 5,
  25. MAX_NOVINT_DEVICES = 2,
  26. };
  27. #if defined( LINUX )
  28. // Linux has a slightly different mapping order on the joystick axes
  29. enum JoystickAxis_t
  30. {
  31. JOY_AXIS_X = 0,
  32. JOY_AXIS_Y,
  33. JOY_AXIS_Z,
  34. JOY_AXIS_U,
  35. JOY_AXIS_R,
  36. JOY_AXIS_V,
  37. MAX_JOYSTICK_AXES,
  38. };
  39. #else
  40. enum JoystickAxis_t
  41. {
  42. JOY_AXIS_X = 0,
  43. JOY_AXIS_Y,
  44. JOY_AXIS_Z,
  45. JOY_AXIS_R,
  46. JOY_AXIS_U,
  47. JOY_AXIS_V,
  48. MAX_JOYSTICK_AXES,
  49. };
  50. #endif
  51. //-----------------------------------------------------------------------------
  52. // Extra mouse codes
  53. //-----------------------------------------------------------------------------
  54. enum
  55. {
  56. MS_WM_XBUTTONDOWN = 0x020B,
  57. MS_WM_XBUTTONUP = 0x020C,
  58. MS_WM_XBUTTONDBLCLK = 0x020D,
  59. MS_MK_BUTTON4 = 0x0020,
  60. MS_MK_BUTTON5 = 0x0040,
  61. };
  62. //-----------------------------------------------------------------------------
  63. // Events
  64. //-----------------------------------------------------------------------------
  65. enum InputEventType_t
  66. {
  67. IE_ButtonPressed = 0, // m_nData contains a ButtonCode_t
  68. IE_ButtonReleased, // m_nData contains a ButtonCode_t
  69. IE_ButtonDoubleClicked, // m_nData contains a ButtonCode_t
  70. IE_AnalogValueChanged, // m_nData contains an AnalogCode_t, m_nData2 contains the value
  71. IE_FirstSystemEvent = 100,
  72. IE_Quit = IE_FirstSystemEvent,
  73. IE_ControllerInserted, // m_nData contains the controller ID
  74. IE_ControllerUnplugged, // m_nData contains the controller ID
  75. IE_FirstVguiEvent = 1000, // Assign ranges for other systems that post user events here
  76. IE_FirstAppEvent = 2000,
  77. };
  78. struct InputEvent_t
  79. {
  80. int m_nType; // Type of the event (see InputEventType_t)
  81. int m_nTick; // Tick on which the event occurred
  82. int m_nData; // Generic 32-bit data, what it contains depends on the event
  83. int m_nData2; // Generic 32-bit data, what it contains depends on the event
  84. int m_nData3; // Generic 32-bit data, what it contains depends on the event
  85. };
  86. //-----------------------------------------------------------------------------
  87. // Steam Controller Enums
  88. //-----------------------------------------------------------------------------
  89. #define MAX_STEAM_CONTROLLERS 8
  90. typedef enum
  91. {
  92. SK_NULL,
  93. SK_BUTTON_A,
  94. SK_BUTTON_B,
  95. SK_BUTTON_X,
  96. SK_BUTTON_Y,
  97. SK_BUTTON_UP,
  98. SK_BUTTON_RIGHT,
  99. SK_BUTTON_DOWN,
  100. SK_BUTTON_LEFT,
  101. SK_BUTTON_LEFT_BUMPER,
  102. SK_BUTTON_RIGHT_BUMPER,
  103. SK_BUTTON_LEFT_TRIGGER,
  104. SK_BUTTON_RIGHT_TRIGGER,
  105. SK_BUTTON_LEFT_GRIP,
  106. SK_BUTTON_RIGHT_GRIP,
  107. SK_BUTTON_LPAD_TOUCH,
  108. SK_BUTTON_RPAD_TOUCH,
  109. SK_BUTTON_LPAD_CLICK,
  110. SK_BUTTON_RPAD_CLICK,
  111. SK_BUTTON_LPAD_UP,
  112. SK_BUTTON_LPAD_RIGHT,
  113. SK_BUTTON_LPAD_DOWN,
  114. SK_BUTTON_LPAD_LEFT,
  115. SK_BUTTON_RPAD_UP,
  116. SK_BUTTON_RPAD_RIGHT,
  117. SK_BUTTON_RPAD_DOWN,
  118. SK_BUTTON_RPAD_LEFT,
  119. SK_BUTTON_SELECT,
  120. SK_BUTTON_START,
  121. SK_BUTTON_STEAM,
  122. SK_BUTTON_INACTIVE_START,
  123. SK_VBUTTON_F1, // These are "virtual" buttons. Useful if you want to have flow that maps an action to button code to be interpreted by some UI that accepts keystrokes, but you
  124. SK_VBUTTON_F2, // don't want to map to real button (perhaps because it would be interpreted by UI in a way you don't like).
  125. SK_VBUTTON_F3,
  126. SK_VBUTTON_F4,
  127. SK_VBUTTON_F5,
  128. SK_VBUTTON_F6,
  129. SK_VBUTTON_F7,
  130. SK_VBUTTON_F8,
  131. SK_VBUTTON_F9,
  132. SK_VBUTTON_F10,
  133. SK_VBUTTON_F11,
  134. SK_VBUTTON_F12,
  135. SK_MAX_KEYS
  136. } sKey_t;
  137. enum ESteamPadAxis
  138. {
  139. LEFTPAD_AXIS_X,
  140. LEFTPAD_AXIS_Y,
  141. RIGHTPAD_AXIS_X,
  142. RIGHTPAD_AXIS_Y,
  143. LEFT_TRIGGER_AXIS,
  144. RIGHT_TRIGGER_AXIS,
  145. GYRO_AXIS_PITCH,
  146. GYRO_AXIS_ROLL,
  147. GYRO_AXIS_YAW,
  148. MAX_STEAMPADAXIS = GYRO_AXIS_YAW
  149. };
  150. enum
  151. {
  152. LASTINPUT_KBMOUSE = 0,
  153. LASTINPUT_CONTROLLER = 1,
  154. LASTINPUT_STEAMCONTROLLER = 2
  155. };
  156. enum GameActionSet_t
  157. {
  158. GAME_ACTION_SET_NONE = -1,
  159. GAME_ACTION_SET_MENUCONTROLS = 0,
  160. GAME_ACTION_SET_FPSCONTROLS,
  161. GAME_ACTION_SET_IN_GAME_HUD,
  162. GAME_ACTION_SET_SPECTATOR,
  163. };
  164. enum GameActionSetFlags_t
  165. {
  166. GAME_ACTION_SET_FLAGS_NONE = 0,
  167. GAME_ACTION_SET_FLAGS_TAUNTING = (1<<0),
  168. };
  169. enum JoystickType_t
  170. {
  171. INPUT_TYPE_GENERIC_JOYSTICK = 0,
  172. INPUT_TYPE_X360,
  173. INPUT_TYPE_STEAMCONTROLLER,
  174. };
  175. #endif // INPUTENUMS_H