Input.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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. public static event ButtonEventDelegate OnButtonDown;
  148. public static event ButtonEventDelegate OnButtonUp;
  149. public static event TextInputEventDelegate OnCharInput;
  150. public static event PointerEventDelegate OnPointerMoved;
  151. public static event PointerEventDelegate OnPointerPressed;
  152. public static event PointerEventDelegate OnPointerReleased;
  153. public static event PointerEventDelegate OnPointerDoubleClick;
  154. /// <summary>
  155. /// Returns value of the specified input axis.
  156. /// </summary>
  157. /// <param name="axis">Type of axis to query.</param>
  158. /// <param name="deviceIdx">Index of the device in case more than one is hooked up (0 - primary).</param>
  159. /// <returns>Value of the axis in range [-1.0, 1.0]. Canan be outside the range for devices with unbound axes
  160. /// (e.g. mouse).</returns>
  161. public static float GetAxisValue(InputAxis axis, int deviceIdx = 0)
  162. {
  163. return Internal_GetAxisValue(axis, deviceIdx);
  164. }
  165. /// <summary>
  166. /// Query if the provided button is currently being held (this frame or previous frames).
  167. /// </summary>
  168. /// <param name="code">Code of the button to query.</param>
  169. /// <param name="deviceIdx">Device to query the button on (0 - primary).</param>
  170. /// <returns>True if the button is held.</returns>
  171. public static bool IsButtonHeld(ButtonCode code, int deviceIdx = 0)
  172. {
  173. return Internal_IsButtonHeld(code, deviceIdx);
  174. }
  175. /// <summary>
  176. /// Query if the provided button is currently being released (only true for one frame).
  177. /// </summary>
  178. /// <param name="code">Code of the button to query.</param>
  179. /// <param name="deviceIdx">Device to query the button on (0 - primary).</param>
  180. /// <returns>True if the button is being released.</returns>
  181. public static bool IsButtonUp(ButtonCode code, int deviceIdx = 0)
  182. {
  183. return Internal_IsButtonUp(code, deviceIdx);
  184. }
  185. /// <summary>
  186. /// Query if the provided button is currently being pressed (only true for one frame).
  187. /// </summary>
  188. /// <param name="code">Code of the button to query.</param>
  189. /// <param name="deviceIdx">Device to query the button on (0 - primary).</param>
  190. /// <returns>True if the button is being pressed.</returns>
  191. public static bool IsButtonDown(ButtonCode code, int deviceIdx = 0)
  192. {
  193. return Internal_IsButtonDown(code, deviceIdx);
  194. }
  195. /// <summary>
  196. /// Query if the provided pointer button is currently being held (this frame or previous frames).
  197. /// </summary>
  198. /// <param name="code">Code of the button to query.</param>
  199. /// <returns>True if the button is being held.</returns>
  200. public static bool IsPointerButtonHeld(PointerButton code)
  201. {
  202. return Internal_IsPointerButtonHeld(code);
  203. }
  204. /// <summary>
  205. /// Query if the provided pointer button is currently being being released (only true for one frame).
  206. /// </summary>
  207. /// <param name="code">Code of the button to query.</param>
  208. /// <returns>True if the button is being released.</returns>
  209. public static bool IsPointerButtonUp(PointerButton code)
  210. {
  211. return Internal_IsPointerButtonUp(code);
  212. }
  213. /// <summary>
  214. /// Query if the provided pointer button is currently being being pressed (only true for one frame).
  215. /// </summary>
  216. /// <param name="code">Code of the button to query.</param>
  217. /// <returns>True if the button is being pressed.</returns>
  218. public static bool IsPointerButtonDown(PointerButton code)
  219. {
  220. return Internal_IsPointerButtonDown(code);
  221. }
  222. /// <summary>
  223. /// Query has the left pointer button been double-clicked this frame.
  224. /// </summary>
  225. /// <returns>True if double-click occurred.</returns>
  226. public static bool IsPointerDoubleClicked()
  227. {
  228. return Internal_IsPointerDoubleClicked();
  229. }
  230. /// <summary>
  231. /// Returns position of the pointer (e.g. mouse cursor) relative to the screen.
  232. /// </summary>
  233. public static Vector2I PointerPosition
  234. {
  235. get
  236. {
  237. Vector2I value;
  238. Internal_GetPointerPosition(out value);
  239. return value;
  240. }
  241. }
  242. /// <summary>
  243. /// Returns difference between last and current pointer position.
  244. /// </summary>
  245. public static Vector2I PointerDelta
  246. {
  247. get
  248. {
  249. Vector2I value;
  250. Internal_GetPointerDelta(out value);
  251. return value;
  252. }
  253. }
  254. /// <summary>
  255. /// Triggered by runtime when a button is pressed.
  256. /// </summary>
  257. /// <param name="code">Code of the pressed button.</param>
  258. /// <param name="deviceIdx">Device the event originated from.</param>
  259. private static void Internal_TriggerButtonDown(ButtonCode code, int deviceIdx)
  260. {
  261. ButtonEvent ev = new ButtonEvent(code, deviceIdx);
  262. if (OnButtonDown != null)
  263. OnButtonDown(ev);
  264. }
  265. /// <summary>
  266. /// Triggered by runtime when a button is released.
  267. /// </summary>
  268. /// <param name="code">Code of the released button.</param>
  269. /// <param name="deviceIdx">Device the event originated from.</param>
  270. private static void Internal_TriggerButtonUp(ButtonCode code, int deviceIdx)
  271. {
  272. ButtonEvent ev = new ButtonEvent(code, deviceIdx);
  273. if (OnButtonUp != null)
  274. OnButtonUp(ev);
  275. }
  276. /// <summary>
  277. /// Triggered by runtime when character is input.
  278. /// </summary>
  279. /// <param name="textChar">Code of input character.</param>
  280. private static void Internal_TriggerCharInput(int textChar)
  281. {
  282. TextInputEvent ev = new TextInputEvent(textChar);
  283. if (OnCharInput != null)
  284. OnCharInput(ev);
  285. }
  286. /// <summary>
  287. /// Triggers when some pointing device (mouse cursor, touch) moves.
  288. /// </summary>
  289. /// <param name="screenPos">Screen position where the input event occurred.</param>
  290. /// <param name="delta">Change in movement since last sent event.</param>
  291. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  292. /// (e.g. move events don't correspond to a button.</param>
  293. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  294. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  295. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  296. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  297. /// move events.</param>
  298. private static void Internal_TriggerPointerMove(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  299. bool ctrl, bool alt, float scrollAmount)
  300. {
  301. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  302. if (OnPointerMoved != null)
  303. OnPointerMoved(ev);
  304. }
  305. /// <summary>
  306. /// Triggers when some pointing device (mouse cursor, touch) button is pressed.
  307. /// </summary>
  308. /// <param name="screenPos">Screen position where the input event occurred.</param>
  309. /// <param name="delta">Change in movement since last sent event.</param>
  310. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  311. /// (e.g. move events don't correspond to a button.</param>
  312. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  313. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  314. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  315. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  316. /// move events.</param>
  317. private static void Internal_TriggerPointerPressed(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  318. bool ctrl, bool alt, float scrollAmount)
  319. {
  320. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  321. if (OnPointerPressed != null)
  322. OnPointerPressed(ev);
  323. }
  324. /// <summary>
  325. /// Triggers when some pointing device (mouse cursor, touch) button is released.
  326. /// </summary>
  327. /// <param name="screenPos">Screen position where the input event occurred.</param>
  328. /// <param name="delta">Change in movement since last sent event.</param>
  329. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  330. /// (e.g. move events don't correspond to a button.</param>
  331. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  332. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  333. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  334. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  335. /// move events.</param>
  336. private static void Internal_TriggerPointerReleased(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  337. bool ctrl, bool alt, float scrollAmount)
  338. {
  339. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  340. if (OnPointerReleased != null)
  341. OnPointerReleased(ev);
  342. }
  343. /// <summary>
  344. /// Triggers when some pointing device (mouse cursor, touch) button is double clicked.
  345. /// </summary>
  346. /// <param name="screenPos">Screen position where the input event occurred.</param>
  347. /// <param name="delta">Change in movement since last sent event.</param>
  348. /// <param name="button">Button that triggered the pointer event. Might be irrelevant depending on event type.
  349. /// (e.g. move events don't correspond to a button.</param>
  350. /// <param name="shift">Is shift button on the keyboard being held down.</param>
  351. /// <param name="ctrl">Is control button on the keyboard being held down.</param>
  352. /// <param name="alt">Is alt button on the keyboard being held down.</param>
  353. /// <param name="scrollAmount">If mouse wheel is being scrolled, what is the amount. Only relevant for
  354. /// move events.</param>
  355. private static void Internal_TriggerPointerDoubleClick(Vector2I screenPos, Vector2I delta, PointerButton button, bool shift,
  356. bool ctrl, bool alt, float scrollAmount)
  357. {
  358. PointerEvent ev = new PointerEvent(screenPos, delta, button, shift, ctrl, alt, scrollAmount);
  359. if (OnPointerDoubleClick != null)
  360. OnPointerDoubleClick(ev);
  361. }
  362. [MethodImpl(MethodImplOptions.InternalCall)]
  363. private static extern float Internal_GetAxisValue(InputAxis axis, int deviceIdx);
  364. [MethodImpl(MethodImplOptions.InternalCall)]
  365. private static extern bool Internal_IsButtonHeld(ButtonCode keyCode, int deviceIdx);
  366. [MethodImpl(MethodImplOptions.InternalCall)]
  367. private static extern bool Internal_IsButtonUp(ButtonCode keyCode, int deviceIdx);
  368. [MethodImpl(MethodImplOptions.InternalCall)]
  369. private static extern bool Internal_IsButtonDown(ButtonCode keyCode, int deviceIdx);
  370. [MethodImpl(MethodImplOptions.InternalCall)]
  371. private static extern bool Internal_IsPointerDoubleClicked();
  372. [MethodImpl(MethodImplOptions.InternalCall)]
  373. private static extern bool Internal_IsPointerButtonHeld(PointerButton keyCode);
  374. [MethodImpl(MethodImplOptions.InternalCall)]
  375. private static extern bool Internal_IsPointerButtonUp(PointerButton keyCode);
  376. [MethodImpl(MethodImplOptions.InternalCall)]
  377. private static extern bool Internal_IsPointerButtonDown(PointerButton keyCode);
  378. [MethodImpl(MethodImplOptions.InternalCall)]
  379. private static extern void Internal_GetPointerPosition(out Vector2I position);
  380. [MethodImpl(MethodImplOptions.InternalCall)]
  381. private static extern void Internal_GetPointerDelta(out Vector2I delta);
  382. }
  383. /// <summary>
  384. /// Contains all possible input buttons, including keyboard scan codes, mouse buttons and gamepad buttons.
  385. /// </summary>
  386. public enum ButtonCode : uint // Note: Must match C++ enum ButtonCode
  387. {
  388. Unassigned = 0x00,
  389. Escape = 0x01,
  390. Num1 = 0x02,
  391. Num2 = 0x03,
  392. Num3 = 0x04,
  393. Num4 = 0x05,
  394. Num5 = 0x06,
  395. Num6 = 0x07,
  396. Num7 = 0x08,
  397. Num8 = 0x09,
  398. Num9 = 0x0A,
  399. Num0 = 0x0B,
  400. Minus = 0x0C,
  401. Equals = 0x0D,
  402. Back = 0x0E,
  403. Tab = 0x0F,
  404. Q = 0x10,
  405. W = 0x11,
  406. E = 0x12,
  407. R = 0x13,
  408. T = 0x14,
  409. Y = 0x15,
  410. U = 0x16,
  411. I = 0x17,
  412. O = 0x18,
  413. P = 0x19,
  414. LeftBracket = 0x1A,
  415. RightBracket = 0x1B,
  416. Return = 0x1C,
  417. LeftControl = 0x1D,
  418. A = 0x1E,
  419. S = 0x1F,
  420. D = 0x20,
  421. F = 0x21,
  422. G = 0x22,
  423. H = 0x23,
  424. J = 0x24,
  425. K = 0x25,
  426. L = 0x26,
  427. Semicolon = 0x27,
  428. Apostrophe = 0x28,
  429. Grave = 0x29,
  430. LeftShift = 0x2A,
  431. Backslash = 0x2B,
  432. Z = 0x2C,
  433. X = 0x2D,
  434. C = 0x2E,
  435. V = 0x2F,
  436. B = 0x30,
  437. N = 0x31,
  438. M = 0x32,
  439. Comma = 0x33,
  440. Period = 0x34,
  441. Slash = 0x35,
  442. RightShift = 0x36,
  443. KeypadMultiply = 0x37,
  444. LeftMenu = 0x38,
  445. Space = 0x39,
  446. CapsLock = 0x3A,
  447. F1 = 0x3B,
  448. F2 = 0x3C,
  449. F3 = 0x3D,
  450. F4 = 0x3E,
  451. F5 = 0x3F,
  452. F6 = 0x40,
  453. F7 = 0x41,
  454. F8 = 0x42,
  455. F9 = 0x43,
  456. F10 = 0x44,
  457. NumLock = 0x45,
  458. ScrollLock = 0x46,
  459. Keypad7 = 0x47,
  460. Keypad8 = 0x48,
  461. Keypad9 = 0x49,
  462. KeypadSubtract = 0x4A,
  463. Keypad4 = 0x4B,
  464. Keypad5 = 0x4C,
  465. Keypad6 = 0x4D,
  466. KeypadAdd = 0x4E,
  467. Keypad1 = 0x4F,
  468. Keypad2 = 0x50,
  469. Keypad3 = 0x51,
  470. Keypad0 = 0x52,
  471. KeypadDecimal = 0x53,
  472. F11 = 0x57,
  473. F12 = 0x58,
  474. F13 = 0x64,
  475. F14 = 0x65,
  476. F15 = 0x66,
  477. KeypadEquals = 0x8D,
  478. At = 0x91,
  479. Colon = 0x92,
  480. NumpadEnter = 0x9C,
  481. RightControl = 0x9D,
  482. KeypadComma = 0xB3,
  483. KeypadDivide = 0xB5,
  484. RightMenu = 0xB8,
  485. Pause = 0xC5,
  486. Home = 0xC7,
  487. Up = 0xC8,
  488. PageUp = 0xC9,
  489. Left = 0xCB,
  490. Right = 0xCD,
  491. End = 0xCF,
  492. Down = 0xD0,
  493. PageDown = 0xD1,
  494. Insert = 0xD2,
  495. Delete = 0xD3,
  496. LeftWindows = 0xDB,
  497. RightWindows = 0xDC,
  498. MouseLeft = 0x800000EE,
  499. MouseRight = 0x800000EF,
  500. MouseMiddle = 0x800000F0,
  501. MouseBtn4 = 0x800000F1,
  502. MouseBtn5 = 0x800000F2,
  503. MouseBtn6 = 0x800000F3,
  504. MouseBtn7 = 0x800000F4,
  505. MouseBtn8 = 0x800000F5,
  506. MouseBtn9 = 0x800000F6,
  507. MouseBtn10 = 0x800000F7,
  508. MouseBtn11 = 0x800000F8,
  509. MouseBtn12 = 0x800000F9,
  510. MouseBtn13 = 0x800000FA,
  511. MouseBtn14 = 0x800000FB,
  512. MouseBtn15 = 0x800000FC,
  513. MouseBtn16 = 0x800000FD,
  514. GamepadA = 0x4000010F,
  515. GamepadB = 0x40000110,
  516. GamepadX = 0x40000111,
  517. GamepadY = 0x40000112,
  518. GamepadLB = 0x40000113,
  519. GamepadRB = 0x40000114,
  520. GamepadLS = 0x40000115,
  521. GamepadRS = 0x40000116,
  522. GamepadBack = 0x40000117,
  523. GamepadStart = 0x40000118,
  524. GamepadDPadLeft = 0x40000119,
  525. GamepadDPadRight = 0x4000011A,
  526. GamepadDPadUp = 0x4000011B,
  527. GamepadDPatDown = 0x4000011C,
  528. GamepadBtn1 = 0x4000011D,
  529. GamepadBtn2 = 0x4000011E,
  530. GamepadBtn3 = 0x4000011F,
  531. GamepadBtn4 = 0x40000120,
  532. GamepadBtn5 = 0x40000121,
  533. GamepadBtn6 = 0x40000122,
  534. GamepadBtn7 = 0x40000123,
  535. GamepadBtn8 = 0x40000124,
  536. GamepadBtn9 = 0x40000125,
  537. GamepadBtn10 = 0x40000126,
  538. GamepadBtn11 = 0x40000127,
  539. GamepadBtn12 = 0x40000128,
  540. GamepadBtn13 = 0x40000129,
  541. GamepadBtn14 = 0x4000012A,
  542. GamepadBtn15 = 0x4000012B,
  543. GamepadBtn16 = 0x4000012C,
  544. Count = 249,
  545. NumKeys = 203, // IMPORTANT: Make sure to update these if you modify the values above
  546. NumMouseButtons = 16,
  547. NumGamepadButtons = 30,
  548. };
  549. /// <summary>
  550. /// Available types of input axes.
  551. /// </summary>
  552. public enum InputAxis // Note: Must match C++ enum InputBox
  553. {
  554. MouseX,
  555. MouseY,
  556. MouseZ,
  557. LeftStickX,
  558. LeftStickY,
  559. RightStickX,
  560. RightStickY,
  561. LeftTrigger,
  562. RightTrigger,
  563. Count // Keep at end
  564. };
  565. }