Input.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  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 game window (or viewport).
  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 position of the pointer (for example mouse cursor) relative to the screen.
  267. /// </summary>
  268. public static Vector2I PointerScreenPosition
  269. {
  270. get
  271. {
  272. Vector2I value;
  273. Internal_GetPointerScreenPosition(out value);
  274. return value;
  275. }
  276. }
  277. /// <summary>
  278. /// Returns difference between last and current pointer position.
  279. /// </summary>
  280. public static Vector2I PointerDelta
  281. {
  282. get
  283. {
  284. Vector2I value;
  285. Internal_GetPointerDelta(out value);
  286. return value;
  287. }
  288. }
  289. /// <summary>
  290. /// Triggered by runtime when a button is pressed.
  291. /// </summary>
  292. /// <param name="code">Code of the pressed button.</param>
  293. /// <param name="deviceIdx">Device the event originated from.</param>
  294. private static void Internal_TriggerButtonDown(ButtonCode code, int deviceIdx)
  295. {
  296. ButtonEvent ev = new ButtonEvent(code, deviceIdx);
  297. if (OnButtonDown != null)
  298. OnButtonDown(ev);
  299. }
  300. /// <summary>
  301. /// Triggered by runtime when a button is released.
  302. /// </summary>
  303. /// <param name="code">Code of the released button.</param>
  304. /// <param name="deviceIdx">Device the event originated from.</param>
  305. private static void Internal_TriggerButtonUp(ButtonCode code, int deviceIdx)
  306. {
  307. ButtonEvent ev = new ButtonEvent(code, deviceIdx);
  308. if (OnButtonUp != null)
  309. OnButtonUp(ev);
  310. }
  311. /// <summary>
  312. /// Triggered by runtime when character is input.
  313. /// </summary>
  314. /// <param name="textChar">Code of input character.</param>
  315. private static void Internal_TriggerCharInput(int textChar)
  316. {
  317. TextInputEvent ev = new TextInputEvent(textChar);
  318. if (OnCharInput != null)
  319. OnCharInput(ev);
  320. }
  321. /// <summary>
  322. /// Triggers when some pointing device (mouse cursor, touch) moves.
  323. /// </summary>
  324. /// <param name="screenPos">Screen position where the input event occurred.</param>
  325. /// <param name="delta">Change in movement since last sent event.</param>
  326. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  327. /// (for example move events don't correspond to a button.</param>
  328. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  329. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  330. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  331. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  332. /// move events.</param>
  333. private static void Internal_TriggerPointerMove(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  334. bool ctrl, bool alt, float scrollAmount)
  335. {
  336. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  337. if (OnPointerMoved != null)
  338. OnPointerMoved(ev);
  339. }
  340. /// <summary>
  341. /// Triggers when some pointing device (mouse cursor, touch) button is pressed.
  342. /// </summary>
  343. /// <param name="screenPos">Screen position where the input event occurred.</param>
  344. /// <param name="delta">Change in movement since last sent event.</param>
  345. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  346. /// (for example move events don't correspond to a button.</param>
  347. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  348. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  349. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  350. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  351. /// move events.</param>
  352. private static void Internal_TriggerPointerPressed(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  353. bool ctrl, bool alt, float scrollAmount)
  354. {
  355. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  356. if (OnPointerPressed != null)
  357. OnPointerPressed(ev);
  358. }
  359. /// <summary>
  360. /// Triggers when some pointing device (mouse cursor, touch) button is released.
  361. /// </summary>
  362. /// <param name="screenPos">Screen position where the input event occurred.</param>
  363. /// <param name="delta">Change in movement since last sent event.</param>
  364. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  365. /// (for example move events don't correspond to a button.</param>
  366. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  367. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  368. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  369. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  370. /// move events.</param>
  371. private static void Internal_TriggerPointerReleased(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  372. bool ctrl, bool alt, float scrollAmount)
  373. {
  374. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  375. if (OnPointerReleased != null)
  376. OnPointerReleased(ev);
  377. }
  378. /// <summary>
  379. /// Triggers when some pointing device (mouse cursor, touch) button is double clicked.
  380. /// </summary>
  381. /// <param name="screenPos">Screen position where the input event occurred.</param>
  382. /// <param name="delta">Change in movement since last sent event.</param>
  383. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  384. /// (for example move events don't correspond to a button.</param>
  385. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  386. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  387. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  388. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  389. /// move events.</param>
  390. private static void Internal_TriggerPointerDoubleClick(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  391. bool ctrl, bool alt, float scrollAmount)
  392. {
  393. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  394. if (OnPointerDoubleClick != null)
  395. OnPointerDoubleClick(ev);
  396. }
  397. [MethodImpl(MethodImplOptions.InternalCall)]
  398. private static extern float Internal_GetAxisValue(InputAxis axis, int deviceIdx);
  399. [MethodImpl(MethodImplOptions.InternalCall)]
  400. private static extern bool Internal_IsButtonHeld(ButtonCode keyCode, int deviceIdx);
  401. [MethodImpl(MethodImplOptions.InternalCall)]
  402. private static extern bool Internal_IsButtonUp(ButtonCode keyCode, int deviceIdx);
  403. [MethodImpl(MethodImplOptions.InternalCall)]
  404. private static extern bool Internal_IsButtonDown(ButtonCode keyCode, int deviceIdx);
  405. [MethodImpl(MethodImplOptions.InternalCall)]
  406. private static extern bool Internal_IsPointerDoubleClicked();
  407. [MethodImpl(MethodImplOptions.InternalCall)]
  408. private static extern bool Internal_IsPointerButtonHeld(PointerButton keyCode);
  409. [MethodImpl(MethodImplOptions.InternalCall)]
  410. private static extern bool Internal_IsPointerButtonUp(PointerButton keyCode);
  411. [MethodImpl(MethodImplOptions.InternalCall)]
  412. private static extern bool Internal_IsPointerButtonDown(PointerButton keyCode);
  413. [MethodImpl(MethodImplOptions.InternalCall)]
  414. private static extern void Internal_GetPointerPosition(out Vector2I position);
  415. [MethodImpl(MethodImplOptions.InternalCall)]
  416. private static extern void Internal_GetPointerScreenPosition(out Vector2I position);
  417. [MethodImpl(MethodImplOptions.InternalCall)]
  418. private static extern void Internal_GetPointerDelta(out Vector2I delta);
  419. }
  420. /// <summary>
  421. /// Contains all possible input buttons, including keyboard scan codes, mouse buttons and gamepad buttons.
  422. /// </summary>
  423. public enum ButtonCode : uint // Note: Must match C++ enum ButtonCode
  424. {
  425. Unassigned = 0x00,
  426. Escape = 0x01,
  427. Num1 = 0x02,
  428. Num2 = 0x03,
  429. Num3 = 0x04,
  430. Num4 = 0x05,
  431. Num5 = 0x06,
  432. Num6 = 0x07,
  433. Num7 = 0x08,
  434. Num8 = 0x09,
  435. Num9 = 0x0A,
  436. Num0 = 0x0B,
  437. Minus = 0x0C,
  438. Equals = 0x0D,
  439. Back = 0x0E,
  440. Tab = 0x0F,
  441. Q = 0x10,
  442. W = 0x11,
  443. E = 0x12,
  444. R = 0x13,
  445. T = 0x14,
  446. Y = 0x15,
  447. U = 0x16,
  448. I = 0x17,
  449. O = 0x18,
  450. P = 0x19,
  451. LeftBracket = 0x1A,
  452. RightBracket = 0x1B,
  453. Return = 0x1C,
  454. LeftControl = 0x1D,
  455. A = 0x1E,
  456. S = 0x1F,
  457. D = 0x20,
  458. F = 0x21,
  459. G = 0x22,
  460. H = 0x23,
  461. J = 0x24,
  462. K = 0x25,
  463. L = 0x26,
  464. Semicolon = 0x27,
  465. Apostrophe = 0x28,
  466. Grave = 0x29,
  467. LeftShift = 0x2A,
  468. Backslash = 0x2B,
  469. Z = 0x2C,
  470. X = 0x2D,
  471. C = 0x2E,
  472. V = 0x2F,
  473. B = 0x30,
  474. N = 0x31,
  475. M = 0x32,
  476. Comma = 0x33,
  477. Period = 0x34,
  478. Slash = 0x35,
  479. RightShift = 0x36,
  480. KeypadMultiply = 0x37,
  481. LeftMenu = 0x38,
  482. Space = 0x39,
  483. CapsLock = 0x3A,
  484. F1 = 0x3B,
  485. F2 = 0x3C,
  486. F3 = 0x3D,
  487. F4 = 0x3E,
  488. F5 = 0x3F,
  489. F6 = 0x40,
  490. F7 = 0x41,
  491. F8 = 0x42,
  492. F9 = 0x43,
  493. F10 = 0x44,
  494. NumLock = 0x45,
  495. ScrollLock = 0x46,
  496. Keypad7 = 0x47,
  497. Keypad8 = 0x48,
  498. Keypad9 = 0x49,
  499. KeypadSubtract = 0x4A,
  500. Keypad4 = 0x4B,
  501. Keypad5 = 0x4C,
  502. Keypad6 = 0x4D,
  503. KeypadAdd = 0x4E,
  504. Keypad1 = 0x4F,
  505. Keypad2 = 0x50,
  506. Keypad3 = 0x51,
  507. Keypad0 = 0x52,
  508. KeypadDecimal = 0x53,
  509. F11 = 0x57,
  510. F12 = 0x58,
  511. F13 = 0x64,
  512. F14 = 0x65,
  513. F15 = 0x66,
  514. KeypadEquals = 0x8D,
  515. At = 0x91,
  516. Colon = 0x92,
  517. NumpadEnter = 0x9C,
  518. RightControl = 0x9D,
  519. KeypadComma = 0xB3,
  520. KeypadDivide = 0xB5,
  521. RightMenu = 0xB8,
  522. Pause = 0xC5,
  523. Home = 0xC7,
  524. Up = 0xC8,
  525. PageUp = 0xC9,
  526. Left = 0xCB,
  527. Right = 0xCD,
  528. End = 0xCF,
  529. Down = 0xD0,
  530. PageDown = 0xD1,
  531. Insert = 0xD2,
  532. Delete = 0xD3,
  533. LeftWindows = 0xDB,
  534. RightWindows = 0xDC,
  535. MouseLeft = 0x800000EE,
  536. MouseRight = 0x800000EF,
  537. MouseMiddle = 0x800000F0,
  538. MouseBtn4 = 0x800000F1,
  539. MouseBtn5 = 0x800000F2,
  540. MouseBtn6 = 0x800000F3,
  541. MouseBtn7 = 0x800000F4,
  542. MouseBtn8 = 0x800000F5,
  543. MouseBtn9 = 0x800000F6,
  544. MouseBtn10 = 0x800000F7,
  545. MouseBtn11 = 0x800000F8,
  546. MouseBtn12 = 0x800000F9,
  547. MouseBtn13 = 0x800000FA,
  548. MouseBtn14 = 0x800000FB,
  549. MouseBtn15 = 0x800000FC,
  550. MouseBtn16 = 0x800000FD,
  551. GamepadA = 0x4000010F,
  552. GamepadB = 0x40000110,
  553. GamepadX = 0x40000111,
  554. GamepadY = 0x40000112,
  555. GamepadLB = 0x40000113,
  556. GamepadRB = 0x40000114,
  557. GamepadLS = 0x40000115,
  558. GamepadRS = 0x40000116,
  559. GamepadBack = 0x40000117,
  560. GamepadStart = 0x40000118,
  561. GamepadDPadLeft = 0x40000119,
  562. GamepadDPadRight = 0x4000011A,
  563. GamepadDPadUp = 0x4000011B,
  564. GamepadDPatDown = 0x4000011C,
  565. GamepadBtn1 = 0x4000011D,
  566. GamepadBtn2 = 0x4000011E,
  567. GamepadBtn3 = 0x4000011F,
  568. GamepadBtn4 = 0x40000120,
  569. GamepadBtn5 = 0x40000121,
  570. GamepadBtn6 = 0x40000122,
  571. GamepadBtn7 = 0x40000123,
  572. GamepadBtn8 = 0x40000124,
  573. GamepadBtn9 = 0x40000125,
  574. GamepadBtn10 = 0x40000126,
  575. GamepadBtn11 = 0x40000127,
  576. GamepadBtn12 = 0x40000128,
  577. GamepadBtn13 = 0x40000129,
  578. GamepadBtn14 = 0x4000012A,
  579. GamepadBtn15 = 0x4000012B,
  580. GamepadBtn16 = 0x4000012C,
  581. Count = 249,
  582. NumKeys = 203, // IMPORTANT: Make sure to update these if you modify the values above
  583. NumMouseButtons = 16,
  584. NumGamepadButtons = 30,
  585. };
  586. /// <summary>
  587. /// Available types of input axes.
  588. /// </summary>
  589. public enum InputAxis // Note: Must match C++ enum InputBox
  590. {
  591. MouseX,
  592. MouseY,
  593. MouseZ,
  594. LeftStickX,
  595. LeftStickY,
  596. RightStickX,
  597. RightStickY,
  598. LeftTrigger,
  599. RightTrigger,
  600. Count // Keep at end
  601. };
  602. }