InputEvents.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. //
  2. // Urho3D Engine
  3. // Copyright (c) 2008-2011 Lasse Öörni
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. // THE SOFTWARE.
  22. //
  23. #ifndef INPUT_INPUTEVENTS_H
  24. #define INPUT_INPUTEVENTS_H
  25. #include "Event.h"
  26. //! Mouse button pressed
  27. DEFINE_EVENT(EVENT_MOUSEBUTTONDOWN, MouseButtonDown)
  28. {
  29. EVENT_PARAM(P_BUTTON, Button); // int
  30. EVENT_PARAM(P_BUTTONS, Buttons); // int
  31. EVENT_PARAM(P_QUALIFIERS, Qualifiers); // int
  32. }
  33. //! Mouse button released
  34. DEFINE_EVENT(EVENT_MOUSEBUTTONUP, MouseButtonUp)
  35. {
  36. EVENT_PARAM(P_BUTTON, Button); // int
  37. EVENT_PARAM(P_BUTTONS, Buttons); // int
  38. EVENT_PARAM(P_QUALIFIERS, Qualifiers); // int
  39. }
  40. //! Mouse moved
  41. DEFINE_EVENT(EVENT_MOUSEMOVE, MouseMove)
  42. {
  43. EVENT_PARAM(P_X, X); // int
  44. EVENT_PARAM(P_Y, Y); // int
  45. EVENT_PARAM(P_BUTTONS, Buttons); // int
  46. EVENT_PARAM(P_QUALIFIERS, Qualifiers); // int
  47. }
  48. //! Mouse wheel moved
  49. DEFINE_EVENT(EVENT_MOUSEWHEEL, MouseWheel)
  50. {
  51. EVENT_PARAM(P_WHEEL, Wheel); // int
  52. EVENT_PARAM(P_BUTTONS, Buttons); // int
  53. EVENT_PARAM(P_QUALIFIERS, Qualifiers); // int
  54. }
  55. //! Key pressed
  56. DEFINE_EVENT(EVENT_KEYDOWN, KeyDown)
  57. {
  58. EVENT_PARAM(P_KEY, Key); // int
  59. EVENT_PARAM(P_BUTTONS, Buttons); // int
  60. EVENT_PARAM(P_QUALIFIERS, Qualifiers); // int
  61. }
  62. //! Key released
  63. DEFINE_EVENT(EVENT_KEYUP, KeyUp)
  64. {
  65. EVENT_PARAM(P_KEY, Key); // int
  66. EVENT_PARAM(P_BUTTONS, Buttons); // int
  67. EVENT_PARAM(P_QUALIFIERS, Qualifiers); // int
  68. }
  69. //! Character typed on the keyboard
  70. DEFINE_EVENT(EVENT_CHAR, Char)
  71. {
  72. EVENT_PARAM(P_CHAR, Char); // int
  73. EVENT_PARAM(P_BUTTONS, Buttons); // int
  74. EVENT_PARAM(P_QUALIFIERS, Qualifiers); // int
  75. }
  76. static const int MOUSEB_LEFT = 1;
  77. static const int MOUSEB_RIGHT = 2;
  78. static const int MOUSEB_MIDDLE = 4;
  79. static const int QUAL_SHIFT = 1;
  80. static const int QUAL_CTRL = 2;
  81. static const int KEY_BACK = 0x08;
  82. static const int KEY_TAB = 0x09;
  83. static const int KEY_CLEAR = 0x0c;
  84. static const int KEY_RETURN = 0x0d;
  85. static const int KEY_SHIFT = 0x10;
  86. static const int KEY_CTRL = 0x11;
  87. static const int KEY_MENU = 0x12;
  88. static const int KEY_PAUSE = 0x13;
  89. static const int KEY_CAPITAL = 0x14;
  90. static const int KEY_ESC = 0x1b;
  91. static const int KEY_CONVERT = 0x1c;
  92. static const int KEY_NONCONVERT = 0x1d;
  93. static const int KEY_ACCEPT = 0x1e;
  94. static const int KEY_MODECHANGE = 0x1f;
  95. static const int KEY_SPACE = 0x20;
  96. static const int KEY_PAGEUP = 0x21;
  97. static const int KEY_PAGEDOWN = 0x22;
  98. static const int KEY_END = 0x23;
  99. static const int KEY_HOME = 0x24;
  100. static const int KEY_LEFT = 0x25;
  101. static const int KEY_UP = 0x26;
  102. static const int KEY_RIGHT = 0x27;
  103. static const int KEY_DOWN = 0x28;
  104. static const int KEY_SELECT = 0x29;
  105. static const int KEY_PRINT = 0x2a;
  106. static const int KEY_EXECUTE = 0x2b;
  107. static const int KEY_SNAPSHOT = 0x2c;
  108. static const int KEY_INSERT = 0x2d;
  109. static const int KEY_DELETE = 0x2e;
  110. static const int KEY_HELP = 0x2f;
  111. static const int KEY_LWIN = 0x5b;
  112. static const int KEY_RWIN = 0x5c;
  113. static const int KEY_APPS = 0x5d;
  114. static const int KEY_SLEEP = 0x5f;
  115. static const int KEY_NUMPAD0 = 0x60;
  116. static const int KEY_NUMPAD1 = 0x61;
  117. static const int KEY_NUMPAD2 = 0x62;
  118. static const int KEY_NUMPAD3 = 0x63;
  119. static const int KEY_NUMPAD4 = 0x64;
  120. static const int KEY_NUMPAD5 = 0x65;
  121. static const int KEY_NUMPAD6 = 0x66;
  122. static const int KEY_NUMPAD7 = 0x67;
  123. static const int KEY_NUMPAD8 = 0x68;
  124. static const int KEY_NUMPAD9 = 0x69;
  125. static const int KEY_MULTIPLY = 0x6a;
  126. static const int KEY_ADD = 0x6b;
  127. static const int KEY_SEPARATOR = 0x6c;
  128. static const int KEY_SUBTRACT = 0x6d;
  129. static const int KEY_DECIMAL = 0x6e;
  130. static const int KEY_DIVIDE = 0x6f;
  131. static const int KEY_F1 = 0x70;
  132. static const int KEY_F2 = 0x71;
  133. static const int KEY_F3 = 0x72;
  134. static const int KEY_F4 = 0x73;
  135. static const int KEY_F5 = 0x74;
  136. static const int KEY_F6 = 0x75;
  137. static const int KEY_F7 = 0x76;
  138. static const int KEY_F8 = 0x77;
  139. static const int KEY_F9 = 0x78;
  140. static const int KEY_F10 = 0x79;
  141. static const int KEY_F11 = 0x7a;
  142. static const int KEY_F12 = 0x7b;
  143. static const int KEY_F13 = 0x7c;
  144. static const int KEY_F14 = 0x7d;
  145. static const int KEY_F15 = 0x7e;
  146. static const int KEY_F16 = 0x7f;
  147. static const int KEY_F17 = 0x80;
  148. static const int KEY_F18 = 0x81;
  149. static const int KEY_F19 = 0x82;
  150. static const int KEY_F20 = 0x83;
  151. static const int KEY_F21 = 0x84;
  152. static const int KEY_F22 = 0x85;
  153. static const int KEY_F23 = 0x86;
  154. static const int KEY_F24 = 0x87;
  155. static const int KEY_NUMLOCK = 0x90;
  156. static const int KEY_SCROLL = 0x91;
  157. static const int KEY_LSHIFT = 0xa0;
  158. static const int KEY_RSHIFT = 0xa1;
  159. static const int KEY_LCTRL = 0xa2;
  160. static const int KEY_RCTRL = 0xa3;
  161. static const int KEY_LMENU = 0xa4;
  162. static const int KEY_RMENU = 0xa5;
  163. static const int KEY_BROWSER_BACK = 0xa6;
  164. static const int KEY_BROWSER_FORWARD = 0xa7;
  165. static const int KEY_BROWSER_REFRESH = 0xa8;
  166. static const int KEY_BROWSER_STOP = 0xa9;
  167. static const int KEY_BROWSER_SEARCH = 0xaa;
  168. static const int KEY_BROWSER_FAVORITES = 0xab;
  169. static const int KEY_BROWSER_HOME = 0xac;
  170. static const int KEY_VOLUME_MUTE = 0xad;
  171. static const int KEY_VOLUME_DOWN = 0xae;
  172. static const int KEY_VOLUME_UP = 0xaf;
  173. static const int KEY_MEDIA_NEXT_TRACK = 0xb0;
  174. static const int KEY_MEDIA_PREV_TRACK = 0xb1;
  175. static const int KEY_MEDIA_STOP = 0xb2;
  176. static const int KEY_MEDIA_PLAY_PAUSE = 0xb3;
  177. static const int KEY_LAUNCH_MAIL = 0xb4;
  178. static const int KEY_LAUNCH_MEDIA_SELECT = 0xb5;
  179. static const int KEY_LAUNCH_APP1 = 0xb6;
  180. static const int KEY_LAUNCH_APP2 = 0xb7;
  181. static const int KEY_OEM_1 = 0xba;
  182. static const int KEY_OEM_PLUS = 0xbb;
  183. static const int KEY_OEM_COMMA = 0xbc;
  184. static const int KEY_OEM_MINUS = 0xbd;
  185. static const int KEY_OEM_PERIOD = 0xbe;
  186. static const int KEY_OEM_2 = 0xbf;
  187. static const int KEY_OEM_3 = 0xc0;
  188. static const int KEY_OEM_4 = 0xdb;
  189. static const int KEY_OEM_5 = 0xdc;
  190. static const int KEY_OEM_6 = 0xdd;
  191. static const int KEY_OEM_7 = 0xde;
  192. static const int KEY_OEM_8 = 0xdf;
  193. #endif // INPUT_INPUTEVENTS_H