2
0

Input.cs 25 KB

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