2
0

Input.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.CompilerServices;
  5. using System.Text;
  6. namespace BansheeEngine
  7. {
  8. /// <summary>
  9. /// Contains data about a button input event.
  10. /// </summary>
  11. public struct ButtonEvent
  12. {
  13. internal ButtonCode buttonCode;
  14. internal int deviceIdx;
  15. /// <summary>
  16. /// Creates a new button input event. For runtime use only.
  17. /// </summary>
  18. /// <param name="buttonCode">Button code this event is referring to.</param>
  19. /// <param name="deviceIdx">Index of the device that the event originated from.</param>
  20. internal ButtonEvent(ButtonCode buttonCode, int deviceIdx)
  21. {
  22. this.buttonCode = buttonCode;
  23. this.deviceIdx = deviceIdx;
  24. }
  25. /// <summary>
  26. /// Button code this event is referring to.
  27. /// </summary>
  28. public ButtonCode Button { get { return buttonCode; } }
  29. /// <summary>
  30. /// Index of the device that the event originated from.
  31. /// </summary>
  32. public int DeviceIndex { get { return deviceIdx; } }
  33. /// <summary>
  34. /// Query is the pressed button a keyboard button.
  35. /// </summary>
  36. public bool IsKeyboard { get { return ((int)buttonCode & 0xC0000000) == 0; }}
  37. /// <summary>
  38. /// Query is the pressed button a mouse button.
  39. /// </summary>
  40. public bool IsMouse { get { return ((int)buttonCode & 0x80000000) != 0; } }
  41. /// <summary>
  42. /// Query is the pressed button a gamepad button.
  43. /// </summary>
  44. public bool IsGamepad { get { return ((int)buttonCode & 0x40000000) != 0; } }
  45. };
  46. /// <summary>
  47. /// Pointer buttons. Generally these correspond to mouse buttons, but may be used in some form for touch input as well.
  48. /// </summary>
  49. public enum PointerButton // Note: Must match C++ enum PointerEventButton
  50. {
  51. Left, Middle, Right, Count
  52. };
  53. /// <summary>
  54. /// Event that gets sent out when user interacts with the screen in some way, usually by moving the mouse cursor or
  55. /// using touch input.
  56. /// </summary>
  57. public struct PointerEvent
  58. {
  59. internal Vector2I _screenPos;
  60. internal Vector2I _delta;
  61. internal PointerButton _button;
  62. internal bool _shift;
  63. internal bool _control;
  64. internal bool _alt;
  65. internal float _mouseWheelScrollAmount;
  66. /// <summary>
  67. /// Creates a new pointer event. For runtime use only.
  68. /// </summary>
  69. /// <param name="screenPos">Screen position where the input event occurred.</param>
  70. /// <param name="delta">Change in movement since last sent event.</param>
  71. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  72. /// (e.g. move events don't correspond to a button.</param>
  73. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  74. /// <param name="control">Is control button on the keyboard being held down.</param>
  75. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  76. /// <param name="mouseWheelScrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  77. /// move events.</param>
  78. internal PointerEvent(Vector2I screenPos, Vector2I delta, PointerButton button,
  79. bool shift, bool control, bool alt, float mouseWheelScrollAmount)
  80. {
  81. _screenPos = screenPos;
  82. _delta = delta;
  83. _button = button;
  84. _shift = shift;
  85. _control = control;
  86. _alt = alt;
  87. _mouseWheelScrollAmount = mouseWheelScrollAmount;
  88. }
  89. /// <summary>
  90. /// Screen position where the input event occurred.
  91. /// </summary>
  92. public Vector2I ScreenPos { get { return _screenPos; } }
  93. /// <summary>
  94. /// Change in movement since last sent event.
  95. /// </summary>
  96. public Vector2I Delta { get { return _delta; } }
  97. /// <summary>
  98. /// Button that triggered the pointer event. Might be irrelevant depending on event type.
  99. /// (e.g. move events don't correspond to a button.
  100. /// </summary>
  101. public PointerButton Button { get { return _button; } }
  102. /// <summary>
  103. /// Is shift button on the keyboard being held down.
  104. /// </summary>
  105. public bool Shift { get { return _shift; } }
  106. /// <summary>
  107. /// Is control button on the keyboard being held down.
  108. /// </summary>
  109. public bool Control { get { return _control; } }
  110. /// <summary>
  111. /// Is alt button on the keyboard being held down.
  112. /// </summary>
  113. public bool Alt { get { return _alt; } }
  114. /// <summary>
  115. /// If mouse wheel is being scrolled, what is the amount. Only relevant for move events.
  116. /// </summary>
  117. public float ScrollAmount { get { return _mouseWheelScrollAmount; } }
  118. }
  119. /// <summary>
  120. /// Event that gets sent out when user inputs some text. These events may be preceeded by normal button events if user
  121. /// is typing on a keyboard.
  122. /// </summary>
  123. public struct TextInputEvent
  124. {
  125. internal int textChar;
  126. /// <summary>
  127. /// Creates a new text input event. For runtime use only.
  128. /// </summary>
  129. /// <param name="textChar">Character the that was input.</param>
  130. internal TextInputEvent(int textChar)
  131. {
  132. this.textChar = textChar;
  133. }
  134. /// <summary>
  135. /// Character the that was input.
  136. /// </summary>
  137. public int Char { get { return textChar; } }
  138. }
  139. /// <summary>
  140. /// Allows you to query and receive events from all connected input devices.
  141. /// </summary>
  142. public static class Input
  143. {
  144. public delegate void ButtonEventDelegate(ButtonEvent ev);
  145. public delegate void TextInputEventDelegate(TextInputEvent ev);
  146. public delegate void PointerEventDelegate(PointerEvent ev);
  147. /// <summary>
  148. /// Triggered when a button on any device is pressed.
  149. /// </summary>
  150. public static event ButtonEventDelegate OnButtonDown;
  151. /// <summary>
  152. /// Triggered when a button on any device is released.
  153. /// </summary>
  154. public static event ButtonEventDelegate OnButtonUp;
  155. /// <summary>
  156. /// Triggered when a textual character is entered.
  157. /// </summary>
  158. public static event TextInputEventDelegate OnCharInput;
  159. /// <summary>
  160. /// Triggered when the pointing device (mouse, touch) is moved.
  161. /// </summary>
  162. public static event PointerEventDelegate OnPointerMoved;
  163. /// <summary>
  164. /// Triggered when a button on the pointing device (mouse, touch) is pressed.
  165. /// </summary>
  166. public static event PointerEventDelegate OnPointerPressed;
  167. /// <summary>
  168. /// Triggered when a button on the pointing device (mouse, touch) is released.
  169. /// </summary>
  170. public static event PointerEventDelegate OnPointerReleased;
  171. /// <summary>
  172. /// Triggered when a button on the pointing device (mouse, touch) is pressed twice in rappid succession.
  173. /// </summary>
  174. public static event PointerEventDelegate OnPointerDoubleClick;
  175. /// <summary>
  176. /// Returns value of the specified input axis.
  177. /// </summary>
  178. /// <param name="axis">Type of axis to query.</param>
  179. /// <param name="deviceIdx">Index of the device in case more than one is hooked up (0 - primary).</param>
  180. /// <returns>Value of the axis in range [-1.0, 1.0]. Canan be outside the range for devices with unbound axes
  181. /// (e.g. mouse).</returns>
  182. public static float GetAxisValue(InputAxis axis, int deviceIdx = 0)
  183. {
  184. return Internal_GetAxisValue(axis, deviceIdx);
  185. }
  186. /// <summary>
  187. /// Query if the provided button is currently being held (this frame or previous frames).
  188. /// </summary>
  189. /// <param name="code">Code of the button to query.</param>
  190. /// <param name="deviceIdx">Device to query the button on (0 - primary).</param>
  191. /// <returns>True if the button is held.</returns>
  192. public static bool IsButtonHeld(ButtonCode code, int deviceIdx = 0)
  193. {
  194. return Internal_IsButtonHeld(code, deviceIdx);
  195. }
  196. /// <summary>
  197. /// Query if the provided button is currently being released (only true for one frame).
  198. /// </summary>
  199. /// <param name="code">Code of the button to query.</param>
  200. /// <param name="deviceIdx">Device to query the button on (0 - primary).</param>
  201. /// <returns>True if the button is being released.</returns>
  202. public static bool IsButtonUp(ButtonCode code, int deviceIdx = 0)
  203. {
  204. return Internal_IsButtonUp(code, deviceIdx);
  205. }
  206. /// <summary>
  207. /// Query if the provided button is currently being pressed (only true for one frame).
  208. /// </summary>
  209. /// <param name="code">Code of the button to query.</param>
  210. /// <param name="deviceIdx">Device to query the button on (0 - primary).</param>
  211. /// <returns>True if the button is being pressed.</returns>
  212. public static bool IsButtonDown(ButtonCode code, int deviceIdx = 0)
  213. {
  214. return Internal_IsButtonDown(code, deviceIdx);
  215. }
  216. /// <summary>
  217. /// Query if the provided pointer button is currently being held (this frame or previous frames).
  218. /// </summary>
  219. /// <param name="code">Code of the button to query.</param>
  220. /// <returns>True if the button is being held.</returns>
  221. public static bool IsPointerButtonHeld(PointerButton code)
  222. {
  223. return Internal_IsPointerButtonHeld(code);
  224. }
  225. /// <summary>
  226. /// Query if the provided pointer button is currently being being released (only true for one frame).
  227. /// </summary>
  228. /// <param name="code">Code of the button to query.</param>
  229. /// <returns>True if the button is being released.</returns>
  230. public static bool IsPointerButtonUp(PointerButton code)
  231. {
  232. return Internal_IsPointerButtonUp(code);
  233. }
  234. /// <summary>
  235. /// Query if the provided pointer button is currently being being pressed (only true for one frame).
  236. /// </summary>
  237. /// <param name="code">Code of the button to query.</param>
  238. /// <returns>True if the button is being pressed.</returns>
  239. public static bool IsPointerButtonDown(PointerButton code)
  240. {
  241. return Internal_IsPointerButtonDown(code);
  242. }
  243. /// <summary>
  244. /// Query has the left pointer button been double-clicked this frame.
  245. /// </summary>
  246. /// <returns>True if double-click occurred.</returns>
  247. public static bool IsPointerDoubleClicked()
  248. {
  249. return Internal_IsPointerDoubleClicked();
  250. }
  251. /// <summary>
  252. /// Returns position of the pointer (e.g. mouse cursor) relative to the screen.
  253. /// </summary>
  254. public static Vector2I PointerPosition
  255. {
  256. get
  257. {
  258. Vector2I value;
  259. Internal_GetPointerPosition(out value);
  260. return value;
  261. }
  262. }
  263. /// <summary>
  264. /// Returns difference between last and current pointer position.
  265. /// </summary>
  266. public static Vector2I PointerDelta
  267. {
  268. get
  269. {
  270. Vector2I value;
  271. Internal_GetPointerDelta(out value);
  272. return value;
  273. }
  274. }
  275. /// <summary>
  276. /// Triggered by runtime when a button is pressed.
  277. /// </summary>
  278. /// <param name="code">Code of the pressed button.</param>
  279. /// <param name="deviceIdx">Device the event originated from.</param>
  280. private static void Internal_TriggerButtonDown(ButtonCode code, int deviceIdx)
  281. {
  282. ButtonEvent ev = new ButtonEvent(code, deviceIdx);
  283. if (OnButtonDown != null)
  284. OnButtonDown(ev);
  285. }
  286. /// <summary>
  287. /// Triggered by runtime when a button is released.
  288. /// </summary>
  289. /// <param name="code">Code of the released button.</param>
  290. /// <param name="deviceIdx">Device the event originated from.</param>
  291. private static void Internal_TriggerButtonUp(ButtonCode code, int deviceIdx)
  292. {
  293. ButtonEvent ev = new ButtonEvent(code, deviceIdx);
  294. if (OnButtonUp != null)
  295. OnButtonUp(ev);
  296. }
  297. /// <summary>
  298. /// Triggered by runtime when character is input.
  299. /// </summary>
  300. /// <param name="textChar">Code of input character.</param>
  301. private static void Internal_TriggerCharInput(int textChar)
  302. {
  303. TextInputEvent ev = new TextInputEvent(textChar);
  304. if (OnCharInput != null)
  305. OnCharInput(ev);
  306. }
  307. /// <summary>
  308. /// Triggers when some pointing device (mouse cursor, touch) moves.
  309. /// </summary>
  310. /// <param name="screenPos">Screen position where the input event occurred.</param>
  311. /// <param name="delta">Change in movement since last sent event.</param>
  312. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  313. /// (e.g. move events don't correspond to a button.</param>
  314. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  315. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  316. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  317. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  318. /// move events.</param>
  319. private static void Internal_TriggerPointerMove(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  320. bool ctrl, bool alt, float scrollAmount)
  321. {
  322. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  323. if (OnPointerMoved != null)
  324. OnPointerMoved(ev);
  325. }
  326. /// <summary>
  327. /// Triggers when some pointing device (mouse cursor, touch) button is pressed.
  328. /// </summary>
  329. /// <param name="screenPos">Screen position where the input event occurred.</param>
  330. /// <param name="delta">Change in movement since last sent event.</param>
  331. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  332. /// (e.g. move events don't correspond to a button.</param>
  333. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  334. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  335. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  336. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  337. /// move events.</param>
  338. private static void Internal_TriggerPointerPressed(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  339. bool ctrl, bool alt, float scrollAmount)
  340. {
  341. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  342. if (OnPointerPressed != null)
  343. OnPointerPressed(ev);
  344. }
  345. /// <summary>
  346. /// Triggers when some pointing device (mouse cursor, touch) button is released.
  347. /// </summary>
  348. /// <param name="screenPos">Screen position where the input event occurred.</param>
  349. /// <param name="delta">Change in movement since last sent event.</param>
  350. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  351. /// (e.g. move events don't correspond to a button.</param>
  352. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  353. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  354. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  355. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  356. /// move events.</param>
  357. private static void Internal_TriggerPointerReleased(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  358. bool ctrl, bool alt, float scrollAmount)
  359. {
  360. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  361. if (OnPointerReleased != null)
  362. OnPointerReleased(ev);
  363. }
  364. /// <summary>
  365. /// Triggers when some pointing device (mouse cursor, touch) button is double clicked.
  366. /// </summary>
  367. /// <param name="screenPos">Screen position where the input event occurred.</param>
  368. /// <param name="delta">Change in movement since last sent event.</param>
  369. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  370. /// (e.g. move events don't correspond to a button.</param>
  371. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  372. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  373. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  374. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  375. /// move events.</param>
  376. private static void Internal_TriggerPointerDoubleClick(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  377. bool ctrl, bool alt, float scrollAmount)
  378. {
  379. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  380. if (OnPointerDoubleClick != null)
  381. OnPointerDoubleClick(ev);
  382. }
  383. [MethodImpl(MethodImplOptions.InternalCall)]
  384. private static extern float Internal_GetAxisValue(InputAxis axis, int deviceIdx);
  385. [MethodImpl(MethodImplOptions.InternalCall)]
  386. private static extern bool Internal_IsButtonHeld(ButtonCode keyCode, int deviceIdx);
  387. [MethodImpl(MethodImplOptions.InternalCall)]
  388. private static extern bool Internal_IsButtonUp(ButtonCode keyCode, int deviceIdx);
  389. [MethodImpl(MethodImplOptions.InternalCall)]
  390. private static extern bool Internal_IsButtonDown(ButtonCode keyCode, int deviceIdx);
  391. [MethodImpl(MethodImplOptions.InternalCall)]
  392. private static extern bool Internal_IsPointerDoubleClicked();
  393. [MethodImpl(MethodImplOptions.InternalCall)]
  394. private static extern bool Internal_IsPointerButtonHeld(PointerButton keyCode);
  395. [MethodImpl(MethodImplOptions.InternalCall)]
  396. private static extern bool Internal_IsPointerButtonUp(PointerButton keyCode);
  397. [MethodImpl(MethodImplOptions.InternalCall)]
  398. private static extern bool Internal_IsPointerButtonDown(PointerButton keyCode);
  399. [MethodImpl(MethodImplOptions.InternalCall)]
  400. private static extern void Internal_GetPointerPosition(out Vector2I position);
  401. [MethodImpl(MethodImplOptions.InternalCall)]
  402. private static extern void Internal_GetPointerDelta(out Vector2I delta);
  403. }
  404. /// <summary>
  405. /// Contains all possible input buttons, including keyboard scan codes, mouse buttons and gamepad buttons.
  406. /// </summary>
  407. public enum ButtonCode : uint // Note: Must match C++ enum ButtonCode
  408. {
  409. Unassigned = 0x00,
  410. Escape = 0x01,
  411. Num1 = 0x02,
  412. Num2 = 0x03,
  413. Num3 = 0x04,
  414. Num4 = 0x05,
  415. Num5 = 0x06,
  416. Num6 = 0x07,
  417. Num7 = 0x08,
  418. Num8 = 0x09,
  419. Num9 = 0x0A,
  420. Num0 = 0x0B,
  421. Minus = 0x0C,
  422. Equals = 0x0D,
  423. Back = 0x0E,
  424. Tab = 0x0F,
  425. Q = 0x10,
  426. W = 0x11,
  427. E = 0x12,
  428. R = 0x13,
  429. T = 0x14,
  430. Y = 0x15,
  431. U = 0x16,
  432. I = 0x17,
  433. O = 0x18,
  434. P = 0x19,
  435. LeftBracket = 0x1A,
  436. RightBracket = 0x1B,
  437. Return = 0x1C,
  438. LeftControl = 0x1D,
  439. A = 0x1E,
  440. S = 0x1F,
  441. D = 0x20,
  442. F = 0x21,
  443. G = 0x22,
  444. H = 0x23,
  445. J = 0x24,
  446. K = 0x25,
  447. L = 0x26,
  448. Semicolon = 0x27,
  449. Apostrophe = 0x28,
  450. Grave = 0x29,
  451. LeftShift = 0x2A,
  452. Backslash = 0x2B,
  453. Z = 0x2C,
  454. X = 0x2D,
  455. C = 0x2E,
  456. V = 0x2F,
  457. B = 0x30,
  458. N = 0x31,
  459. M = 0x32,
  460. Comma = 0x33,
  461. Period = 0x34,
  462. Slash = 0x35,
  463. RightShift = 0x36,
  464. KeypadMultiply = 0x37,
  465. LeftMenu = 0x38,
  466. Space = 0x39,
  467. CapsLock = 0x3A,
  468. F1 = 0x3B,
  469. F2 = 0x3C,
  470. F3 = 0x3D,
  471. F4 = 0x3E,
  472. F5 = 0x3F,
  473. F6 = 0x40,
  474. F7 = 0x41,
  475. F8 = 0x42,
  476. F9 = 0x43,
  477. F10 = 0x44,
  478. NumLock = 0x45,
  479. ScrollLock = 0x46,
  480. Keypad7 = 0x47,
  481. Keypad8 = 0x48,
  482. Keypad9 = 0x49,
  483. KeypadSubtract = 0x4A,
  484. Keypad4 = 0x4B,
  485. Keypad5 = 0x4C,
  486. Keypad6 = 0x4D,
  487. KeypadAdd = 0x4E,
  488. Keypad1 = 0x4F,
  489. Keypad2 = 0x50,
  490. Keypad3 = 0x51,
  491. Keypad0 = 0x52,
  492. KeypadDecimal = 0x53,
  493. F11 = 0x57,
  494. F12 = 0x58,
  495. F13 = 0x64,
  496. F14 = 0x65,
  497. F15 = 0x66,
  498. KeypadEquals = 0x8D,
  499. At = 0x91,
  500. Colon = 0x92,
  501. NumpadEnter = 0x9C,
  502. RightControl = 0x9D,
  503. KeypadComma = 0xB3,
  504. KeypadDivide = 0xB5,
  505. RightMenu = 0xB8,
  506. Pause = 0xC5,
  507. Home = 0xC7,
  508. Up = 0xC8,
  509. PageUp = 0xC9,
  510. Left = 0xCB,
  511. Right = 0xCD,
  512. End = 0xCF,
  513. Down = 0xD0,
  514. PageDown = 0xD1,
  515. Insert = 0xD2,
  516. Delete = 0xD3,
  517. LeftWindows = 0xDB,
  518. RightWindows = 0xDC,
  519. MouseLeft = 0x800000EE,
  520. MouseRight = 0x800000EF,
  521. MouseMiddle = 0x800000F0,
  522. MouseBtn4 = 0x800000F1,
  523. MouseBtn5 = 0x800000F2,
  524. MouseBtn6 = 0x800000F3,
  525. MouseBtn7 = 0x800000F4,
  526. MouseBtn8 = 0x800000F5,
  527. MouseBtn9 = 0x800000F6,
  528. MouseBtn10 = 0x800000F7,
  529. MouseBtn11 = 0x800000F8,
  530. MouseBtn12 = 0x800000F9,
  531. MouseBtn13 = 0x800000FA,
  532. MouseBtn14 = 0x800000FB,
  533. MouseBtn15 = 0x800000FC,
  534. MouseBtn16 = 0x800000FD,
  535. GamepadA = 0x4000010F,
  536. GamepadB = 0x40000110,
  537. GamepadX = 0x40000111,
  538. GamepadY = 0x40000112,
  539. GamepadLB = 0x40000113,
  540. GamepadRB = 0x40000114,
  541. GamepadLS = 0x40000115,
  542. GamepadRS = 0x40000116,
  543. GamepadBack = 0x40000117,
  544. GamepadStart = 0x40000118,
  545. GamepadDPadLeft = 0x40000119,
  546. GamepadDPadRight = 0x4000011A,
  547. GamepadDPadUp = 0x4000011B,
  548. GamepadDPatDown = 0x4000011C,
  549. GamepadBtn1 = 0x4000011D,
  550. GamepadBtn2 = 0x4000011E,
  551. GamepadBtn3 = 0x4000011F,
  552. GamepadBtn4 = 0x40000120,
  553. GamepadBtn5 = 0x40000121,
  554. GamepadBtn6 = 0x40000122,
  555. GamepadBtn7 = 0x40000123,
  556. GamepadBtn8 = 0x40000124,
  557. GamepadBtn9 = 0x40000125,
  558. GamepadBtn10 = 0x40000126,
  559. GamepadBtn11 = 0x40000127,
  560. GamepadBtn12 = 0x40000128,
  561. GamepadBtn13 = 0x40000129,
  562. GamepadBtn14 = 0x4000012A,
  563. GamepadBtn15 = 0x4000012B,
  564. GamepadBtn16 = 0x4000012C,
  565. Count = 249,
  566. NumKeys = 203, // IMPORTANT: Make sure to update these if you modify the values above
  567. NumMouseButtons = 16,
  568. NumGamepadButtons = 30,
  569. };
  570. /// <summary>
  571. /// Available types of input axes.
  572. /// </summary>
  573. public enum InputAxis // Note: Must match C++ enum InputBox
  574. {
  575. MouseX,
  576. MouseY,
  577. MouseZ,
  578. LeftStickX,
  579. LeftStickY,
  580. RightStickX,
  581. RightStickY,
  582. LeftTrigger,
  583. RightTrigger,
  584. Count // Keep at end
  585. };
  586. }