Input.cs 24 KB

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