InputAPI.cpp 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. //
  2. // Copyright (c) 2008-2015 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #include "../Script/APITemplates.h"
  23. #include "../Input/Controls.h"
  24. #include "../Input/Input.h"
  25. namespace Urho3D
  26. {
  27. void FakeAddRef(void* ptr);
  28. void FakeReleaseRef(void* ptr);
  29. static void ConstructControls(Controls* ptr)
  30. {
  31. new(ptr)Controls();
  32. }
  33. static void ConstructControlsCopy(const Controls& controls, Controls* ptr)
  34. {
  35. new(ptr)Controls(controls);
  36. }
  37. static void DestructControls(Controls* ptr)
  38. {
  39. ptr->~Controls();
  40. }
  41. static void RegisterControls(asIScriptEngine* engine)
  42. {
  43. engine->RegisterObjectType("Controls", sizeof(Controls), asOBJ_VALUE | asOBJ_APP_CLASS_CDK);
  44. engine->RegisterObjectBehaviour("Controls", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructControls), asCALL_CDECL_OBJLAST);
  45. engine->RegisterObjectBehaviour("Controls", asBEHAVE_CONSTRUCT, "void f(const Controls&in)", asFUNCTION(ConstructControlsCopy), asCALL_CDECL_OBJLAST);
  46. engine->RegisterObjectBehaviour("Controls", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructControls), asCALL_CDECL_OBJLAST);
  47. engine->RegisterObjectMethod("Controls", "Controls& opAssign(const Controls&in)", asMETHOD(Controls, operator =), asCALL_THISCALL);
  48. engine->RegisterObjectMethod("Controls", "void Reset()", asMETHOD(Controls, Reset), asCALL_THISCALL);
  49. engine->RegisterObjectMethod("Controls", "void Set(uint, bool)", asMETHOD(Controls, Set), asCALL_THISCALL);
  50. engine->RegisterObjectMethod("Controls", "bool IsDown(uint) const", asMETHOD(Controls, IsDown), asCALL_THISCALL);
  51. engine->RegisterObjectMethod("Controls", "bool IsPressed(uint, const Controls&in) const", asMETHOD(Controls, IsPressed), asCALL_THISCALL);
  52. engine->RegisterObjectProperty("Controls", "uint buttons", offsetof(Controls, buttons_));
  53. engine->RegisterObjectProperty("Controls", "float yaw", offsetof(Controls, yaw_));
  54. engine->RegisterObjectProperty("Controls", "float pitch", offsetof(Controls, pitch_));
  55. engine->RegisterObjectProperty("Controls", "VariantMap extraData", offsetof(Controls, extraData_));
  56. }
  57. static void RegisterInputConstants(asIScriptEngine* engine)
  58. {
  59. engine->RegisterGlobalProperty("const int MOUSEB_LEFT", (void*)&MOUSEB_LEFT);
  60. engine->RegisterGlobalProperty("const int MOUSEB_MIDDLE", (void*)&MOUSEB_MIDDLE);
  61. engine->RegisterGlobalProperty("const int MOUSEB_RIGHT", (void*)&MOUSEB_RIGHT);
  62. engine->RegisterGlobalProperty("const int QUAL_SHIFT", (void*)&QUAL_SHIFT);
  63. engine->RegisterGlobalProperty("const int QUAL_CTRL", (void*)&QUAL_CTRL);
  64. engine->RegisterGlobalProperty("const int QUAL_ALT", (void*)&QUAL_ALT);
  65. engine->RegisterGlobalProperty("const int QUAL_ANY", (void*)&QUAL_ANY);
  66. engine->RegisterGlobalProperty("const int KEY_A", (void*)&KEY_A);
  67. engine->RegisterGlobalProperty("const int KEY_B", (void*)&KEY_B);
  68. engine->RegisterGlobalProperty("const int KEY_C", (void*)&KEY_C);
  69. engine->RegisterGlobalProperty("const int KEY_D", (void*)&KEY_D);
  70. engine->RegisterGlobalProperty("const int KEY_E", (void*)&KEY_E);
  71. engine->RegisterGlobalProperty("const int KEY_F", (void*)&KEY_F);
  72. engine->RegisterGlobalProperty("const int KEY_G", (void*)&KEY_G);
  73. engine->RegisterGlobalProperty("const int KEY_H", (void*)&KEY_H);
  74. engine->RegisterGlobalProperty("const int KEY_I", (void*)&KEY_I);
  75. engine->RegisterGlobalProperty("const int KEY_J", (void*)&KEY_J);
  76. engine->RegisterGlobalProperty("const int KEY_K", (void*)&KEY_K);
  77. engine->RegisterGlobalProperty("const int KEY_L", (void*)&KEY_L);
  78. engine->RegisterGlobalProperty("const int KEY_M", (void*)&KEY_M);
  79. engine->RegisterGlobalProperty("const int KEY_N", (void*)&KEY_N);
  80. engine->RegisterGlobalProperty("const int KEY_O", (void*)&KEY_O);
  81. engine->RegisterGlobalProperty("const int KEY_P", (void*)&KEY_P);
  82. engine->RegisterGlobalProperty("const int KEY_Q", (void*)&KEY_Q);
  83. engine->RegisterGlobalProperty("const int KEY_R", (void*)&KEY_R);
  84. engine->RegisterGlobalProperty("const int KEY_S", (void*)&KEY_S);
  85. engine->RegisterGlobalProperty("const int KEY_T", (void*)&KEY_T);
  86. engine->RegisterGlobalProperty("const int KEY_U", (void*)&KEY_U);
  87. engine->RegisterGlobalProperty("const int KEY_V", (void*)&KEY_V);
  88. engine->RegisterGlobalProperty("const int KEY_W", (void*)&KEY_W);
  89. engine->RegisterGlobalProperty("const int KEY_X", (void*)&KEY_X);
  90. engine->RegisterGlobalProperty("const int KEY_Y", (void*)&KEY_Y);
  91. engine->RegisterGlobalProperty("const int KEY_Z", (void*)&KEY_Z);
  92. engine->RegisterGlobalProperty("const int KEY_0", (void*)&KEY_0);
  93. engine->RegisterGlobalProperty("const int KEY_1", (void*)&KEY_1);
  94. engine->RegisterGlobalProperty("const int KEY_2", (void*)&KEY_2);
  95. engine->RegisterGlobalProperty("const int KEY_3", (void*)&KEY_3);
  96. engine->RegisterGlobalProperty("const int KEY_4", (void*)&KEY_4);
  97. engine->RegisterGlobalProperty("const int KEY_5", (void*)&KEY_5);
  98. engine->RegisterGlobalProperty("const int KEY_6", (void*)&KEY_6);
  99. engine->RegisterGlobalProperty("const int KEY_7", (void*)&KEY_7);
  100. engine->RegisterGlobalProperty("const int KEY_8", (void*)&KEY_8);
  101. engine->RegisterGlobalProperty("const int KEY_9", (void*)&KEY_9);
  102. engine->RegisterGlobalProperty("const int KEY_BACKSPACE", (void*)&KEY_BACKSPACE);
  103. engine->RegisterGlobalProperty("const int KEY_TAB", (void*)&KEY_TAB);
  104. engine->RegisterGlobalProperty("const int KEY_RETURN", (void*)&KEY_RETURN);
  105. engine->RegisterGlobalProperty("const int KEY_RETURN2", (void*)&KEY_RETURN2);
  106. engine->RegisterGlobalProperty("const int KEY_KP_ENTER", (void*)&KEY_KP_ENTER);
  107. engine->RegisterGlobalProperty("const int KEY_SHIFT", (void*)&KEY_SHIFT);
  108. engine->RegisterGlobalProperty("const int KEY_CTRL", (void*)&KEY_CTRL);
  109. engine->RegisterGlobalProperty("const int KEY_ALT", (void*)&KEY_ALT);
  110. engine->RegisterGlobalProperty("const int KEY_GUI", (void*)&KEY_GUI);
  111. engine->RegisterGlobalProperty("const int KEY_PAUSE", (void*)&KEY_PAUSE);
  112. engine->RegisterGlobalProperty("const int KEY_CAPSLOCK", (void*)&KEY_CAPSLOCK);
  113. engine->RegisterGlobalProperty("const int KEY_ESC", (void*)&KEY_ESC);
  114. engine->RegisterGlobalProperty("const int KEY_SPACE", (void*)&KEY_SPACE);
  115. engine->RegisterGlobalProperty("const int KEY_PAGEUP", (void*)&KEY_PAGEUP);
  116. engine->RegisterGlobalProperty("const int KEY_PAGEDOWN", (void*)&KEY_PAGEDOWN);
  117. engine->RegisterGlobalProperty("const int KEY_END", (void*)&KEY_END);
  118. engine->RegisterGlobalProperty("const int KEY_HOME", (void*)&KEY_HOME);
  119. engine->RegisterGlobalProperty("const int KEY_LEFT", (void*)&KEY_LEFT);
  120. engine->RegisterGlobalProperty("const int KEY_UP", (void*)&KEY_UP);
  121. engine->RegisterGlobalProperty("const int KEY_RIGHT", (void*)&KEY_RIGHT);
  122. engine->RegisterGlobalProperty("const int KEY_DOWN", (void*)&KEY_DOWN);
  123. engine->RegisterGlobalProperty("const int KEY_SELECT", (void*)&KEY_SELECT);
  124. engine->RegisterGlobalProperty("const int KEY_PRINTSCREEN", (void*)&KEY_PRINTSCREEN);
  125. engine->RegisterGlobalProperty("const int KEY_INSERT", (void*)&KEY_INSERT);
  126. engine->RegisterGlobalProperty("const int KEY_DELETE", (void*)&KEY_DELETE);
  127. engine->RegisterGlobalProperty("const int KEY_LGUI", (void*)&KEY_LGUI);
  128. engine->RegisterGlobalProperty("const int KEY_RGUI", (void*)&KEY_RGUI);
  129. engine->RegisterGlobalProperty("const int KEY_APPLICATION", (void*)&KEY_APPLICATION);
  130. engine->RegisterGlobalProperty("const int KEY_KP_0", (void*)&KEY_KP_0);
  131. engine->RegisterGlobalProperty("const int KEY_KP_1", (void*)&KEY_KP_1);
  132. engine->RegisterGlobalProperty("const int KEY_KP_2", (void*)&KEY_KP_2);
  133. engine->RegisterGlobalProperty("const int KEY_KP_3", (void*)&KEY_KP_3);
  134. engine->RegisterGlobalProperty("const int KEY_KP_4", (void*)&KEY_KP_4);
  135. engine->RegisterGlobalProperty("const int KEY_KP_5", (void*)&KEY_KP_5);
  136. engine->RegisterGlobalProperty("const int KEY_KP_6", (void*)&KEY_KP_6);
  137. engine->RegisterGlobalProperty("const int KEY_KP_7", (void*)&KEY_KP_7);
  138. engine->RegisterGlobalProperty("const int KEY_KP_8", (void*)&KEY_KP_8);
  139. engine->RegisterGlobalProperty("const int KEY_KP_9", (void*)&KEY_KP_9);
  140. engine->RegisterGlobalProperty("const int KEY_KP_MULTIPLY", (void*)&KEY_KP_MULTIPLY);
  141. engine->RegisterGlobalProperty("const int KEY_KP_PLUS", (void*)&KEY_KP_PLUS);
  142. engine->RegisterGlobalProperty("const int KEY_KP_MINUS", (void*)&KEY_KP_MINUS);
  143. engine->RegisterGlobalProperty("const int KEY_KP_PERIOD", (void*)&KEY_KP_PERIOD);
  144. engine->RegisterGlobalProperty("const int KEY_KP_DIVIDE", (void*)&KEY_KP_DIVIDE);
  145. engine->RegisterGlobalProperty("const int KEY_F1", (void*)&KEY_F1);
  146. engine->RegisterGlobalProperty("const int KEY_F2", (void*)&KEY_F2);
  147. engine->RegisterGlobalProperty("const int KEY_F3", (void*)&KEY_F3);
  148. engine->RegisterGlobalProperty("const int KEY_F4", (void*)&KEY_F4);
  149. engine->RegisterGlobalProperty("const int KEY_F5", (void*)&KEY_F5);
  150. engine->RegisterGlobalProperty("const int KEY_F6", (void*)&KEY_F6);
  151. engine->RegisterGlobalProperty("const int KEY_F7", (void*)&KEY_F7);
  152. engine->RegisterGlobalProperty("const int KEY_F8", (void*)&KEY_F8);
  153. engine->RegisterGlobalProperty("const int KEY_F9", (void*)&KEY_F9);
  154. engine->RegisterGlobalProperty("const int KEY_F10", (void*)&KEY_F10);
  155. engine->RegisterGlobalProperty("const int KEY_F11", (void*)&KEY_F11);
  156. engine->RegisterGlobalProperty("const int KEY_F12", (void*)&KEY_F12);
  157. engine->RegisterGlobalProperty("const int KEY_F13", (void*)&KEY_F13);
  158. engine->RegisterGlobalProperty("const int KEY_F14", (void*)&KEY_F14);
  159. engine->RegisterGlobalProperty("const int KEY_F15", (void*)&KEY_F15);
  160. engine->RegisterGlobalProperty("const int KEY_F16", (void*)&KEY_F16);
  161. engine->RegisterGlobalProperty("const int KEY_F17", (void*)&KEY_F17);
  162. engine->RegisterGlobalProperty("const int KEY_F18", (void*)&KEY_F18);
  163. engine->RegisterGlobalProperty("const int KEY_F19", (void*)&KEY_F19);
  164. engine->RegisterGlobalProperty("const int KEY_F20", (void*)&KEY_F20);
  165. engine->RegisterGlobalProperty("const int KEY_F21", (void*)&KEY_F21);
  166. engine->RegisterGlobalProperty("const int KEY_F22", (void*)&KEY_F22);
  167. engine->RegisterGlobalProperty("const int KEY_F23", (void*)&KEY_F23);
  168. engine->RegisterGlobalProperty("const int KEY_F24", (void*)&KEY_F24);
  169. engine->RegisterGlobalProperty("const int KEY_NUMLOCKCLEAR", (void*)&KEY_NUMLOCKCLEAR);
  170. engine->RegisterGlobalProperty("const int KEY_SCROLLLOCK", (void*)&KEY_SCROLLLOCK);
  171. engine->RegisterGlobalProperty("const int KEY_LSHIFT", (void*)&KEY_LSHIFT);
  172. engine->RegisterGlobalProperty("const int KEY_RSHIFT", (void*)&KEY_RSHIFT);
  173. engine->RegisterGlobalProperty("const int KEY_LCTRL", (void*)&KEY_LCTRL);
  174. engine->RegisterGlobalProperty("const int KEY_RCTRL", (void*)&KEY_RCTRL);
  175. engine->RegisterGlobalProperty("const int KEY_LALT", (void*)&KEY_LALT);
  176. engine->RegisterGlobalProperty("const int KEY_RALT", (void*)&KEY_RALT);
  177. engine->RegisterGlobalProperty("const int SCANCODE_UNKNOWN", (void*)&SCANCODE_UNKNOWN);
  178. engine->RegisterGlobalProperty("const int SCANCODE_CTRL", (void*)&SCANCODE_CTRL);
  179. engine->RegisterGlobalProperty("const int SCANCODE_SHIFT", (void*)&SCANCODE_SHIFT);
  180. engine->RegisterGlobalProperty("const int SCANCODE_ALT", (void*)&SCANCODE_ALT);
  181. engine->RegisterGlobalProperty("const int SCANCODE_GUI", (void*)&SCANCODE_GUI);
  182. engine->RegisterGlobalProperty("const int SCANCODE_A", (void*)&SCANCODE_A);
  183. engine->RegisterGlobalProperty("const int SCANCODE_B", (void*)&SCANCODE_B);
  184. engine->RegisterGlobalProperty("const int SCANCODE_C", (void*)&SCANCODE_C);
  185. engine->RegisterGlobalProperty("const int SCANCODE_D", (void*)&SCANCODE_D);
  186. engine->RegisterGlobalProperty("const int SCANCODE_E", (void*)&SCANCODE_E);
  187. engine->RegisterGlobalProperty("const int SCANCODE_F", (void*)&SCANCODE_F);
  188. engine->RegisterGlobalProperty("const int SCANCODE_G", (void*)&SCANCODE_G);
  189. engine->RegisterGlobalProperty("const int SCANCODE_H", (void*)&SCANCODE_H);
  190. engine->RegisterGlobalProperty("const int SCANCODE_I", (void*)&SCANCODE_I);
  191. engine->RegisterGlobalProperty("const int SCANCODE_J", (void*)&SCANCODE_J);
  192. engine->RegisterGlobalProperty("const int SCANCODE_K", (void*)&SCANCODE_K);
  193. engine->RegisterGlobalProperty("const int SCANCODE_L", (void*)&SCANCODE_L);
  194. engine->RegisterGlobalProperty("const int SCANCODE_M", (void*)&SCANCODE_M);
  195. engine->RegisterGlobalProperty("const int SCANCODE_N", (void*)&SCANCODE_N);
  196. engine->RegisterGlobalProperty("const int SCANCODE_O", (void*)&SCANCODE_O);
  197. engine->RegisterGlobalProperty("const int SCANCODE_P", (void*)&SCANCODE_P);
  198. engine->RegisterGlobalProperty("const int SCANCODE_Q", (void*)&SCANCODE_Q);
  199. engine->RegisterGlobalProperty("const int SCANCODE_R", (void*)&SCANCODE_R);
  200. engine->RegisterGlobalProperty("const int SCANCODE_S", (void*)&SCANCODE_S);
  201. engine->RegisterGlobalProperty("const int SCANCODE_T", (void*)&SCANCODE_T);
  202. engine->RegisterGlobalProperty("const int SCANCODE_U", (void*)&SCANCODE_U);
  203. engine->RegisterGlobalProperty("const int SCANCODE_V", (void*)&SCANCODE_V);
  204. engine->RegisterGlobalProperty("const int SCANCODE_W", (void*)&SCANCODE_W);
  205. engine->RegisterGlobalProperty("const int SCANCODE_X", (void*)&SCANCODE_X);
  206. engine->RegisterGlobalProperty("const int SCANCODE_Y", (void*)&SCANCODE_Y);
  207. engine->RegisterGlobalProperty("const int SCANCODE_Z", (void*)&SCANCODE_Z);
  208. engine->RegisterGlobalProperty("const int SCANCODE_1", (void*)&SCANCODE_1);
  209. engine->RegisterGlobalProperty("const int SCANCODE_2", (void*)&SCANCODE_2);
  210. engine->RegisterGlobalProperty("const int SCANCODE_3", (void*)&SCANCODE_3);
  211. engine->RegisterGlobalProperty("const int SCANCODE_4", (void*)&SCANCODE_4);
  212. engine->RegisterGlobalProperty("const int SCANCODE_5", (void*)&SCANCODE_5);
  213. engine->RegisterGlobalProperty("const int SCANCODE_6", (void*)&SCANCODE_6);
  214. engine->RegisterGlobalProperty("const int SCANCODE_7", (void*)&SCANCODE_7);
  215. engine->RegisterGlobalProperty("const int SCANCODE_8", (void*)&SCANCODE_8);
  216. engine->RegisterGlobalProperty("const int SCANCODE_9", (void*)&SCANCODE_9);
  217. engine->RegisterGlobalProperty("const int SCANCODE_0", (void*)&SCANCODE_0);
  218. engine->RegisterGlobalProperty("const int SCANCODE_RETURN", (void*)&SCANCODE_RETURN);
  219. engine->RegisterGlobalProperty("const int SCANCODE_ESCAPE", (void*)&SCANCODE_ESCAPE);
  220. engine->RegisterGlobalProperty("const int SCANCODE_BACKSPACE", (void*)&SCANCODE_BACKSPACE);
  221. engine->RegisterGlobalProperty("const int SCANCODE_TAB", (void*)&SCANCODE_TAB);
  222. engine->RegisterGlobalProperty("const int SCANCODE_SPACE", (void*)&SCANCODE_SPACE);
  223. engine->RegisterGlobalProperty("const int SCANCODE_MINUS", (void*)&SCANCODE_MINUS);
  224. engine->RegisterGlobalProperty("const int SCANCODE_EQUALS", (void*)&SCANCODE_EQUALS);
  225. engine->RegisterGlobalProperty("const int SCANCODE_LEFTBRACKET", (void*)&SCANCODE_LEFTBRACKET);
  226. engine->RegisterGlobalProperty("const int SCANCODE_RIGHTBRACKET", (void*)&SCANCODE_RIGHTBRACKET);
  227. engine->RegisterGlobalProperty("const int SCANCODE_BACKSLASH", (void*)&SCANCODE_BACKSLASH);
  228. engine->RegisterGlobalProperty("const int SCANCODE_NONUSHASH", (void*)&SCANCODE_NONUSHASH);
  229. engine->RegisterGlobalProperty("const int SCANCODE_SEMICOLON", (void*)&SCANCODE_SEMICOLON);
  230. engine->RegisterGlobalProperty("const int SCANCODE_APOSTROPHE", (void*)&SCANCODE_APOSTROPHE);
  231. engine->RegisterGlobalProperty("const int SCANCODE_GRAVE", (void*)&SCANCODE_GRAVE);
  232. engine->RegisterGlobalProperty("const int SCANCODE_COMMA", (void*)&SCANCODE_COMMA);
  233. engine->RegisterGlobalProperty("const int SCANCODE_PERIOD", (void*)&SCANCODE_PERIOD);
  234. engine->RegisterGlobalProperty("const int SCANCODE_SLASH", (void*)&SCANCODE_SLASH);
  235. engine->RegisterGlobalProperty("const int SCANCODE_CAPSLOCK", (void*)&SCANCODE_CAPSLOCK);
  236. engine->RegisterGlobalProperty("const int SCANCODE_F1", (void*)&SCANCODE_F1);
  237. engine->RegisterGlobalProperty("const int SCANCODE_F2", (void*)&SCANCODE_F2);
  238. engine->RegisterGlobalProperty("const int SCANCODE_F3", (void*)&SCANCODE_F3);
  239. engine->RegisterGlobalProperty("const int SCANCODE_F4", (void*)&SCANCODE_F4);
  240. engine->RegisterGlobalProperty("const int SCANCODE_F5", (void*)&SCANCODE_F5);
  241. engine->RegisterGlobalProperty("const int SCANCODE_F6", (void*)&SCANCODE_F6);
  242. engine->RegisterGlobalProperty("const int SCANCODE_F7", (void*)&SCANCODE_F7);
  243. engine->RegisterGlobalProperty("const int SCANCODE_F8", (void*)&SCANCODE_F8);
  244. engine->RegisterGlobalProperty("const int SCANCODE_F9", (void*)&SCANCODE_F9);
  245. engine->RegisterGlobalProperty("const int SCANCODE_F10", (void*)&SCANCODE_F10);
  246. engine->RegisterGlobalProperty("const int SCANCODE_F11", (void*)&SCANCODE_F11);
  247. engine->RegisterGlobalProperty("const int SCANCODE_F12", (void*)&SCANCODE_F12);
  248. engine->RegisterGlobalProperty("const int SCANCODE_PRINTSCREEN", (void*)&SCANCODE_PRINTSCREEN);
  249. engine->RegisterGlobalProperty("const int SCANCODE_SCROLLLOCK", (void*)&SCANCODE_SCROLLLOCK);
  250. engine->RegisterGlobalProperty("const int SCANCODE_PAUSE", (void*)&SCANCODE_PAUSE);
  251. engine->RegisterGlobalProperty("const int SCANCODE_INSERT", (void*)&SCANCODE_INSERT);
  252. engine->RegisterGlobalProperty("const int SCANCODE_HOME", (void*)&SCANCODE_HOME);
  253. engine->RegisterGlobalProperty("const int SCANCODE_PAGEUP", (void*)&SCANCODE_PAGEUP);
  254. engine->RegisterGlobalProperty("const int SCANCODE_DELETE", (void*)&SCANCODE_DELETE);
  255. engine->RegisterGlobalProperty("const int SCANCODE_END", (void*)&SCANCODE_END);
  256. engine->RegisterGlobalProperty("const int SCANCODE_PAGEDOWN", (void*)&SCANCODE_PAGEDOWN);
  257. engine->RegisterGlobalProperty("const int SCANCODE_RIGHT", (void*)&SCANCODE_RIGHT);
  258. engine->RegisterGlobalProperty("const int SCANCODE_LEFT", (void*)&SCANCODE_LEFT);
  259. engine->RegisterGlobalProperty("const int SCANCODE_DOWN", (void*)&SCANCODE_DOWN);
  260. engine->RegisterGlobalProperty("const int SCANCODE_UP", (void*)&SCANCODE_UP);
  261. engine->RegisterGlobalProperty("const int SCANCODE_NUMLOCKCLEAR", (void*)&SCANCODE_NUMLOCKCLEAR);
  262. engine->RegisterGlobalProperty("const int SCANCODE_KP_DIVIDE", (void*)&SCANCODE_KP_DIVIDE);
  263. engine->RegisterGlobalProperty("const int SCANCODE_KP_MULTIPLY", (void*)&SCANCODE_KP_MULTIPLY);
  264. engine->RegisterGlobalProperty("const int SCANCODE_KP_MINUS", (void*)&SCANCODE_KP_MINUS);
  265. engine->RegisterGlobalProperty("const int SCANCODE_KP_PLUS", (void*)&SCANCODE_KP_PLUS);
  266. engine->RegisterGlobalProperty("const int SCANCODE_KP_ENTER", (void*)&SCANCODE_KP_ENTER);
  267. engine->RegisterGlobalProperty("const int SCANCODE_KP_1", (void*)&SCANCODE_KP_1);
  268. engine->RegisterGlobalProperty("const int SCANCODE_KP_2", (void*)&SCANCODE_KP_2);
  269. engine->RegisterGlobalProperty("const int SCANCODE_KP_3", (void*)&SCANCODE_KP_3);
  270. engine->RegisterGlobalProperty("const int SCANCODE_KP_4", (void*)&SCANCODE_KP_4);
  271. engine->RegisterGlobalProperty("const int SCANCODE_KP_5", (void*)&SCANCODE_KP_5);
  272. engine->RegisterGlobalProperty("const int SCANCODE_KP_6", (void*)&SCANCODE_KP_6);
  273. engine->RegisterGlobalProperty("const int SCANCODE_KP_7", (void*)&SCANCODE_KP_7);
  274. engine->RegisterGlobalProperty("const int SCANCODE_KP_8", (void*)&SCANCODE_KP_8);
  275. engine->RegisterGlobalProperty("const int SCANCODE_KP_9", (void*)&SCANCODE_KP_9);
  276. engine->RegisterGlobalProperty("const int SCANCODE_KP_0", (void*)&SCANCODE_KP_0);
  277. engine->RegisterGlobalProperty("const int SCANCODE_KP_PERIOD", (void*)&SCANCODE_KP_PERIOD);
  278. engine->RegisterGlobalProperty("const int SCANCODE_NONUSBACKSLASH", (void*)&SCANCODE_NONUSBACKSLASH);
  279. engine->RegisterGlobalProperty("const int SCANCODE_APPLICATION", (void*)&SCANCODE_APPLICATION);
  280. engine->RegisterGlobalProperty("const int SCANCODE_POWER", (void*)&SCANCODE_POWER);
  281. engine->RegisterGlobalProperty("const int SCANCODE_KP_EQUALS", (void*)&SCANCODE_KP_EQUALS);
  282. engine->RegisterGlobalProperty("const int SCANCODE_F13", (void*)&SCANCODE_F13);
  283. engine->RegisterGlobalProperty("const int SCANCODE_F14", (void*)&SCANCODE_F14);
  284. engine->RegisterGlobalProperty("const int SCANCODE_F15", (void*)&SCANCODE_F15);
  285. engine->RegisterGlobalProperty("const int SCANCODE_F16", (void*)&SCANCODE_F16);
  286. engine->RegisterGlobalProperty("const int SCANCODE_F17", (void*)&SCANCODE_F17);
  287. engine->RegisterGlobalProperty("const int SCANCODE_F18", (void*)&SCANCODE_F18);
  288. engine->RegisterGlobalProperty("const int SCANCODE_F19", (void*)&SCANCODE_F19);
  289. engine->RegisterGlobalProperty("const int SCANCODE_F20", (void*)&SCANCODE_F20);
  290. engine->RegisterGlobalProperty("const int SCANCODE_F21", (void*)&SCANCODE_F21);
  291. engine->RegisterGlobalProperty("const int SCANCODE_F22", (void*)&SCANCODE_F22);
  292. engine->RegisterGlobalProperty("const int SCANCODE_F23", (void*)&SCANCODE_F23);
  293. engine->RegisterGlobalProperty("const int SCANCODE_F24", (void*)&SCANCODE_F24);
  294. engine->RegisterGlobalProperty("const int SCANCODE_EXECUTE", (void*)&SCANCODE_EXECUTE);
  295. engine->RegisterGlobalProperty("const int SCANCODE_HELP", (void*)&SCANCODE_HELP);
  296. engine->RegisterGlobalProperty("const int SCANCODE_MENU", (void*)&SCANCODE_MENU);
  297. engine->RegisterGlobalProperty("const int SCANCODE_SELECT", (void*)&SCANCODE_SELECT);
  298. engine->RegisterGlobalProperty("const int SCANCODE_STOP", (void*)&SCANCODE_STOP);
  299. engine->RegisterGlobalProperty("const int SCANCODE_AGAIN", (void*)&SCANCODE_AGAIN);
  300. engine->RegisterGlobalProperty("const int SCANCODE_UNDO", (void*)&SCANCODE_UNDO);
  301. engine->RegisterGlobalProperty("const int SCANCODE_CUT", (void*)&SCANCODE_CUT);
  302. engine->RegisterGlobalProperty("const int SCANCODE_COPY", (void*)&SCANCODE_COPY);
  303. engine->RegisterGlobalProperty("const int SCANCODE_PASTE", (void*)&SCANCODE_PASTE);
  304. engine->RegisterGlobalProperty("const int SCANCODE_FIND", (void*)&SCANCODE_FIND);
  305. engine->RegisterGlobalProperty("const int SCANCODE_MUTE", (void*)&SCANCODE_MUTE);
  306. engine->RegisterGlobalProperty("const int SCANCODE_VOLUMEUP", (void*)&SCANCODE_VOLUMEUP);
  307. engine->RegisterGlobalProperty("const int SCANCODE_VOLUMEDOWN", (void*)&SCANCODE_VOLUMEDOWN);
  308. engine->RegisterGlobalProperty("const int SCANCODE_KP_COMMA", (void*)&SCANCODE_KP_COMMA);
  309. engine->RegisterGlobalProperty("const int SCANCODE_KP_EQUALSAS400", (void*)&SCANCODE_KP_EQUALSAS400);
  310. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL1", (void*)&SCANCODE_INTERNATIONAL1);
  311. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL2", (void*)&SCANCODE_INTERNATIONAL2);
  312. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL3", (void*)&SCANCODE_INTERNATIONAL3);
  313. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL4", (void*)&SCANCODE_INTERNATIONAL4);
  314. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL5", (void*)&SCANCODE_INTERNATIONAL5);
  315. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL6", (void*)&SCANCODE_INTERNATIONAL6);
  316. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL7", (void*)&SCANCODE_INTERNATIONAL7);
  317. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL8", (void*)&SCANCODE_INTERNATIONAL8);
  318. engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL9", (void*)&SCANCODE_INTERNATIONAL9);
  319. engine->RegisterGlobalProperty("const int SCANCODE_LANG1", (void*)&SCANCODE_LANG1);
  320. engine->RegisterGlobalProperty("const int SCANCODE_LANG2", (void*)&SCANCODE_LANG2);
  321. engine->RegisterGlobalProperty("const int SCANCODE_LANG3", (void*)&SCANCODE_LANG3);
  322. engine->RegisterGlobalProperty("const int SCANCODE_LANG4", (void*)&SCANCODE_LANG4);
  323. engine->RegisterGlobalProperty("const int SCANCODE_LANG5", (void*)&SCANCODE_LANG5);
  324. engine->RegisterGlobalProperty("const int SCANCODE_LANG6", (void*)&SCANCODE_LANG6);
  325. engine->RegisterGlobalProperty("const int SCANCODE_LANG7", (void*)&SCANCODE_LANG7);
  326. engine->RegisterGlobalProperty("const int SCANCODE_LANG8", (void*)&SCANCODE_LANG8);
  327. engine->RegisterGlobalProperty("const int SCANCODE_LANG9", (void*)&SCANCODE_LANG9);
  328. engine->RegisterGlobalProperty("const int SCANCODE_ALTERASE", (void*)&SCANCODE_ALTERASE);
  329. engine->RegisterGlobalProperty("const int SCANCODE_SYSREQ", (void*)&SCANCODE_SYSREQ);
  330. engine->RegisterGlobalProperty("const int SCANCODE_CANCEL", (void*)&SCANCODE_CANCEL);
  331. engine->RegisterGlobalProperty("const int SCANCODE_CLEAR", (void*)&SCANCODE_CLEAR);
  332. engine->RegisterGlobalProperty("const int SCANCODE_PRIOR", (void*)&SCANCODE_PRIOR);
  333. engine->RegisterGlobalProperty("const int SCANCODE_RETURN2", (void*)&SCANCODE_RETURN2);
  334. engine->RegisterGlobalProperty("const int SCANCODE_SEPARATOR", (void*)&SCANCODE_SEPARATOR);
  335. engine->RegisterGlobalProperty("const int SCANCODE_OUT", (void*)&SCANCODE_OUT);
  336. engine->RegisterGlobalProperty("const int SCANCODE_OPER", (void*)&SCANCODE_OPER);
  337. engine->RegisterGlobalProperty("const int SCANCODE_CLEARAGAIN", (void*)&SCANCODE_CLEARAGAIN);
  338. engine->RegisterGlobalProperty("const int SCANCODE_CRSEL", (void*)&SCANCODE_CRSEL);
  339. engine->RegisterGlobalProperty("const int SCANCODE_EXSEL", (void*)&SCANCODE_EXSEL);
  340. engine->RegisterGlobalProperty("const int SCANCODE_KP_00", (void*)&SCANCODE_KP_00);
  341. engine->RegisterGlobalProperty("const int SCANCODE_KP_000", (void*)&SCANCODE_KP_000);
  342. engine->RegisterGlobalProperty("const int SCANCODE_THOUSANDSSEPARATOR", (void*)&SCANCODE_THOUSANDSSEPARATOR);
  343. engine->RegisterGlobalProperty("const int SCANCODE_DECIMALSEPARATOR", (void*)&SCANCODE_DECIMALSEPARATOR);
  344. engine->RegisterGlobalProperty("const int SCANCODE_CURRENCYUNIT", (void*)&SCANCODE_CURRENCYUNIT);
  345. engine->RegisterGlobalProperty("const int SCANCODE_CURRENCYSUBUNIT", (void*)&SCANCODE_CURRENCYSUBUNIT);
  346. engine->RegisterGlobalProperty("const int SCANCODE_KP_LEFTPAREN", (void*)&SCANCODE_KP_LEFTPAREN);
  347. engine->RegisterGlobalProperty("const int SCANCODE_KP_RIGHTPAREN", (void*)&SCANCODE_KP_RIGHTPAREN);
  348. engine->RegisterGlobalProperty("const int SCANCODE_KP_LEFTBRACE", (void*)&SCANCODE_KP_LEFTBRACE);
  349. engine->RegisterGlobalProperty("const int SCANCODE_KP_RIGHTBRACE", (void*)&SCANCODE_KP_RIGHTBRACE);
  350. engine->RegisterGlobalProperty("const int SCANCODE_KP_TAB", (void*)&SCANCODE_KP_TAB);
  351. engine->RegisterGlobalProperty("const int SCANCODE_KP_BACKSPACE", (void*)&SCANCODE_KP_BACKSPACE);
  352. engine->RegisterGlobalProperty("const int SCANCODE_KP_A", (void*)&SCANCODE_KP_A);
  353. engine->RegisterGlobalProperty("const int SCANCODE_KP_B", (void*)&SCANCODE_KP_B);
  354. engine->RegisterGlobalProperty("const int SCANCODE_KP_C", (void*)&SCANCODE_KP_C);
  355. engine->RegisterGlobalProperty("const int SCANCODE_KP_D", (void*)&SCANCODE_KP_D);
  356. engine->RegisterGlobalProperty("const int SCANCODE_KP_E", (void*)&SCANCODE_KP_E);
  357. engine->RegisterGlobalProperty("const int SCANCODE_KP_F", (void*)&SCANCODE_KP_F);
  358. engine->RegisterGlobalProperty("const int SCANCODE_KP_XOR", (void*)&SCANCODE_KP_XOR);
  359. engine->RegisterGlobalProperty("const int SCANCODE_KP_POWER", (void*)&SCANCODE_KP_POWER);
  360. engine->RegisterGlobalProperty("const int SCANCODE_KP_PERCENT", (void*)&SCANCODE_KP_PERCENT);
  361. engine->RegisterGlobalProperty("const int SCANCODE_KP_LESS", (void*)&SCANCODE_KP_LESS);
  362. engine->RegisterGlobalProperty("const int SCANCODE_KP_GREATER", (void*)&SCANCODE_KP_GREATER);
  363. engine->RegisterGlobalProperty("const int SCANCODE_KP_AMPERSAND", (void*)&SCANCODE_KP_AMPERSAND);
  364. engine->RegisterGlobalProperty("const int SCANCODE_KP_DBLAMPERSAND", (void*)&SCANCODE_KP_DBLAMPERSAND);
  365. engine->RegisterGlobalProperty("const int SCANCODE_KP_VERTICALBAR", (void*)&SCANCODE_KP_VERTICALBAR);
  366. engine->RegisterGlobalProperty("const int SCANCODE_KP_DBLVERTICALBAR", (void*)&SCANCODE_KP_DBLVERTICALBAR);
  367. engine->RegisterGlobalProperty("const int SCANCODE_KP_COLON", (void*)&SCANCODE_KP_COLON);
  368. engine->RegisterGlobalProperty("const int SCANCODE_KP_HASH", (void*)&SCANCODE_KP_HASH);
  369. engine->RegisterGlobalProperty("const int SCANCODE_KP_SPACE", (void*)&SCANCODE_KP_SPACE);
  370. engine->RegisterGlobalProperty("const int SCANCODE_KP_AT", (void*)&SCANCODE_KP_AT);
  371. engine->RegisterGlobalProperty("const int SCANCODE_KP_EXCLAM", (void*)&SCANCODE_KP_EXCLAM);
  372. engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMSTORE", (void*)&SCANCODE_KP_MEMSTORE);
  373. engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMRECALL", (void*)&SCANCODE_KP_MEMRECALL);
  374. engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMCLEAR", (void*)&SCANCODE_KP_MEMCLEAR);
  375. engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMADD", (void*)&SCANCODE_KP_MEMADD);
  376. engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMSUBTRACT", (void*)&SCANCODE_KP_MEMSUBTRACT);
  377. engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMMULTIPLY", (void*)&SCANCODE_KP_MEMMULTIPLY);
  378. engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMDIVIDE", (void*)&SCANCODE_KP_MEMDIVIDE);
  379. engine->RegisterGlobalProperty("const int SCANCODE_KP_PLUSMINUS", (void*)&SCANCODE_KP_PLUSMINUS);
  380. engine->RegisterGlobalProperty("const int SCANCODE_KP_CLEAR", (void*)&SCANCODE_KP_CLEAR);
  381. engine->RegisterGlobalProperty("const int SCANCODE_KP_CLEARENTRY", (void*)&SCANCODE_KP_CLEARENTRY);
  382. engine->RegisterGlobalProperty("const int SCANCODE_KP_BINARY", (void*)&SCANCODE_KP_BINARY);
  383. engine->RegisterGlobalProperty("const int SCANCODE_KP_OCTAL", (void*)&SCANCODE_KP_OCTAL);
  384. engine->RegisterGlobalProperty("const int SCANCODE_KP_DECIMAL", (void*)&SCANCODE_KP_DECIMAL);
  385. engine->RegisterGlobalProperty("const int SCANCODE_KP_HEXADECIMAL", (void*)&SCANCODE_KP_HEXADECIMAL);
  386. engine->RegisterGlobalProperty("const int SCANCODE_LCTRL", (void*)&SCANCODE_LCTRL);
  387. engine->RegisterGlobalProperty("const int SCANCODE_LSHIFT", (void*)&SCANCODE_LSHIFT);
  388. engine->RegisterGlobalProperty("const int SCANCODE_LALT", (void*)&SCANCODE_LALT);
  389. engine->RegisterGlobalProperty("const int SCANCODE_LGUI", (void*)&SCANCODE_LGUI);
  390. engine->RegisterGlobalProperty("const int SCANCODE_RCTRL", (void*)&SCANCODE_RCTRL);
  391. engine->RegisterGlobalProperty("const int SCANCODE_RSHIFT", (void*)&SCANCODE_RSHIFT);
  392. engine->RegisterGlobalProperty("const int SCANCODE_RALT", (void*)&SCANCODE_RALT);
  393. engine->RegisterGlobalProperty("const int SCANCODE_RGUI", (void*)&SCANCODE_RGUI);
  394. engine->RegisterGlobalProperty("const int SCANCODE_MODE", (void*)&SCANCODE_MODE);
  395. engine->RegisterGlobalProperty("const int SCANCODE_AUDIONEXT", (void*)&SCANCODE_AUDIONEXT);
  396. engine->RegisterGlobalProperty("const int SCANCODE_AUDIOPREV", (void*)&SCANCODE_AUDIOPREV);
  397. engine->RegisterGlobalProperty("const int SCANCODE_AUDIOSTOP", (void*)&SCANCODE_AUDIOSTOP);
  398. engine->RegisterGlobalProperty("const int SCANCODE_AUDIOPLAY", (void*)&SCANCODE_AUDIOPLAY);
  399. engine->RegisterGlobalProperty("const int SCANCODE_AUDIOMUTE", (void*)&SCANCODE_AUDIOMUTE);
  400. engine->RegisterGlobalProperty("const int SCANCODE_MEDIASELECT", (void*)&SCANCODE_MEDIASELECT);
  401. engine->RegisterGlobalProperty("const int SCANCODE_WWW", (void*)&SCANCODE_WWW);
  402. engine->RegisterGlobalProperty("const int SCANCODE_MAIL", (void*)&SCANCODE_MAIL);
  403. engine->RegisterGlobalProperty("const int SCANCODE_CALCULATOR", (void*)&SCANCODE_CALCULATOR);
  404. engine->RegisterGlobalProperty("const int SCANCODE_COMPUTER", (void*)&SCANCODE_COMPUTER);
  405. engine->RegisterGlobalProperty("const int SCANCODE_AC_SEARCH", (void*)&SCANCODE_AC_SEARCH);
  406. engine->RegisterGlobalProperty("const int SCANCODE_AC_HOME", (void*)&SCANCODE_AC_HOME);
  407. engine->RegisterGlobalProperty("const int SCANCODE_AC_BACK", (void*)&SCANCODE_AC_BACK);
  408. engine->RegisterGlobalProperty("const int SCANCODE_AC_FORWARD", (void*)&SCANCODE_AC_FORWARD);
  409. engine->RegisterGlobalProperty("const int SCANCODE_AC_STOP", (void*)&SCANCODE_AC_STOP);
  410. engine->RegisterGlobalProperty("const int SCANCODE_AC_REFRESH", (void*)&SCANCODE_AC_REFRESH);
  411. engine->RegisterGlobalProperty("const int SCANCODE_AC_BOOKMARKS", (void*)&SCANCODE_AC_BOOKMARKS);
  412. engine->RegisterGlobalProperty("const int SCANCODE_BRIGHTNESSDOWN", (void*)&SCANCODE_BRIGHTNESSDOWN);
  413. engine->RegisterGlobalProperty("const int SCANCODE_BRIGHTNESSUP", (void*)&SCANCODE_BRIGHTNESSUP);
  414. engine->RegisterGlobalProperty("const int SCANCODE_DISPLAYSWITCH", (void*)&SCANCODE_DISPLAYSWITCH);
  415. engine->RegisterGlobalProperty("const int SCANCODE_KBDILLUMTOGGLE", (void*)&SCANCODE_KBDILLUMTOGGLE);
  416. engine->RegisterGlobalProperty("const int SCANCODE_KBDILLUMDOWN", (void*)&SCANCODE_KBDILLUMDOWN);
  417. engine->RegisterGlobalProperty("const int SCANCODE_KBDILLUMUP", (void*)&SCANCODE_KBDILLUMUP);
  418. engine->RegisterGlobalProperty("const int SCANCODE_EJECT", (void*)&SCANCODE_EJECT);
  419. engine->RegisterGlobalProperty("const int SCANCODE_SLEEP", (void*)&SCANCODE_SLEEP);
  420. engine->RegisterGlobalProperty("const int SCANCODE_APP1", (void*)&SCANCODE_APP1);
  421. engine->RegisterGlobalProperty("const int SCANCODE_APP2", (void*)&SCANCODE_APP2);
  422. engine->RegisterGlobalProperty("const int HAT_CENTER", (void*)&HAT_CENTER);
  423. engine->RegisterGlobalProperty("const int HAT_UP", (void*)&HAT_UP);
  424. engine->RegisterGlobalProperty("const int HAT_RIGHT", (void*)&HAT_RIGHT);
  425. engine->RegisterGlobalProperty("const int HAT_DOWN", (void*)&HAT_DOWN);
  426. engine->RegisterGlobalProperty("const int HAT_LEFT", (void*)&HAT_LEFT);
  427. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_A", (void*)&CONTROLLER_BUTTON_A);
  428. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_B", (void*)&CONTROLLER_BUTTON_B);
  429. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_X", (void*)&CONTROLLER_BUTTON_X);
  430. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_Y", (void*)&CONTROLLER_BUTTON_Y);
  431. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_BACK", (void*)&CONTROLLER_BUTTON_BACK);
  432. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_GUIDE", (void*)&CONTROLLER_BUTTON_GUIDE);
  433. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_START", (void*)&CONTROLLER_BUTTON_START);
  434. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_LEFTSTICK", (void*)&CONTROLLER_BUTTON_LEFTSTICK);
  435. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_RIGHTSTICK", (void*)&CONTROLLER_BUTTON_RIGHTSTICK);
  436. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_LEFTSHOULDER", (void*)&CONTROLLER_BUTTON_LEFTSHOULDER);
  437. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_RIGHTSHOULDER", (void*)&CONTROLLER_BUTTON_RIGHTSHOULDER);
  438. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_DPAD_UP", (void*)&CONTROLLER_BUTTON_DPAD_UP);
  439. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_DPAD_DOWN", (void*)&CONTROLLER_BUTTON_DPAD_DOWN);
  440. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_DPAD_LEFT", (void*)&CONTROLLER_BUTTON_DPAD_LEFT);
  441. engine->RegisterGlobalProperty("const int CONTROLLER_BUTTON_DPAD_RIGHT", (void*)&CONTROLLER_BUTTON_DPAD_RIGHT);
  442. engine->RegisterGlobalProperty("const int CONTROLLER_AXIS_LEFTX", (void*)&CONTROLLER_AXIS_LEFTX);
  443. engine->RegisterGlobalProperty("const int CONTROLLER_AXIS_LEFTY", (void*)&CONTROLLER_AXIS_LEFTY);
  444. engine->RegisterGlobalProperty("const int CONTROLLER_AXIS_RIGHTX", (void*)&CONTROLLER_AXIS_RIGHTX);
  445. engine->RegisterGlobalProperty("const int CONTROLLER_AXIS_RIGHTY", (void*)&CONTROLLER_AXIS_RIGHTY);
  446. engine->RegisterGlobalProperty("const int CONTROLLER_AXIS_TRIGGERLEFT", (void*)&CONTROLLER_AXIS_TRIGGERLEFT);
  447. engine->RegisterGlobalProperty("const int CONTROLLER_AXIS_TRIGGERRIGHT", (void*)&CONTROLLER_AXIS_TRIGGERRIGHT);
  448. }
  449. static Input* GetInput()
  450. {
  451. return GetScriptContext()->GetSubsystem<Input>();
  452. }
  453. static bool InputSaveGestures(File* file, Input* ptr)
  454. {
  455. return file && ptr->SaveGestures(*file);
  456. }
  457. static bool InputSaveGesturesVectorBuffer(VectorBuffer& buffer, Input* ptr)
  458. {
  459. return ptr->SaveGestures(buffer);
  460. }
  461. static bool InputSaveGesture(File* file, unsigned gestureID, Input* ptr)
  462. {
  463. return file && ptr->SaveGesture(*file, gestureID);
  464. }
  465. static bool InputSaveGestureVectorBuffer(VectorBuffer& buffer, unsigned gestureID, Input* ptr)
  466. {
  467. return ptr->SaveGesture(buffer, gestureID);
  468. }
  469. static unsigned InputLoadGestures(File* file, Input* ptr)
  470. {
  471. return file ? ptr->LoadGestures(*file) : 0;
  472. }
  473. static unsigned InputLoadGesturesVectorBuffer(VectorBuffer& buffer, Input* ptr)
  474. {
  475. return ptr->LoadGestures(buffer);
  476. }
  477. static void InputSetMouseVisible(bool enable, Input* ptr)
  478. {
  479. ptr->SetMouseVisible(enable, false);
  480. }
  481. static void RegisterInput(asIScriptEngine* engine)
  482. {
  483. engine->RegisterEnum("MouseMode");
  484. engine->RegisterEnumValue("MouseMode", "MM_ABSOLUTE", MM_ABSOLUTE);
  485. engine->RegisterEnumValue("MouseMode", "MM_RELATIVE", MM_RELATIVE);
  486. engine->RegisterEnumValue("MouseMode", "MM_WRAP", MM_WRAP);
  487. engine->RegisterObjectType("TouchState", 0, asOBJ_REF);
  488. engine->RegisterObjectBehaviour("TouchState", asBEHAVE_ADDREF, "void f()", asFUNCTION(FakeAddRef), asCALL_CDECL_OBJLAST);
  489. engine->RegisterObjectBehaviour("TouchState", asBEHAVE_RELEASE, "void f()", asFUNCTION(FakeReleaseRef), asCALL_CDECL_OBJLAST);
  490. engine->RegisterObjectProperty("TouchState", "const int touchID", offsetof(TouchState, touchID_));
  491. engine->RegisterObjectProperty("TouchState", "const IntVector2 position", offsetof(TouchState, position_));
  492. engine->RegisterObjectProperty("TouchState", "const IntVector2 lastPosition", offsetof(TouchState, lastPosition_));
  493. engine->RegisterObjectProperty("TouchState", "const IntVector2 delta", offsetof(TouchState, delta_));
  494. engine->RegisterObjectProperty("TouchState", "const float pressure", offsetof(TouchState, pressure_));
  495. engine->RegisterObjectType("JoystickState", 0, asOBJ_REF);
  496. engine->RegisterObjectBehaviour("JoystickState", asBEHAVE_ADDREF, "void f()", asFUNCTION(FakeAddRef), asCALL_CDECL_OBJLAST);
  497. engine->RegisterObjectBehaviour("JoystickState", asBEHAVE_RELEASE, "void f()", asFUNCTION(FakeReleaseRef), asCALL_CDECL_OBJLAST);
  498. engine->RegisterObjectProperty("JoystickState", "const String name", offsetof(JoystickState, name_));
  499. engine->RegisterObjectProperty("JoystickState", "const int joystickID", offsetof(JoystickState, joystickID_));
  500. engine->RegisterObjectMethod("JoystickState", "bool get_controller() const", asMETHOD(JoystickState, IsController), asCALL_THISCALL);
  501. engine->RegisterObjectMethod("JoystickState", "uint get_numButtons() const", asMETHOD(JoystickState, GetNumButtons), asCALL_THISCALL);
  502. engine->RegisterObjectMethod("JoystickState", "uint get_numAxes() const", asMETHOD(JoystickState, GetNumAxes), asCALL_THISCALL);
  503. engine->RegisterObjectMethod("JoystickState", "uint get_numHats() const", asMETHOD(JoystickState, GetNumHats), asCALL_THISCALL);
  504. engine->RegisterObjectMethod("JoystickState", "bool get_buttonDown(uint) const", asMETHOD(JoystickState, GetButtonDown), asCALL_THISCALL);
  505. engine->RegisterObjectMethod("JoystickState", "bool get_buttonPress(uint) const", asMETHOD(JoystickState, GetButtonPress), asCALL_THISCALL);
  506. engine->RegisterObjectMethod("JoystickState", "float get_axisPosition(uint) const", asMETHOD(JoystickState, GetAxisPosition), asCALL_THISCALL);
  507. engine->RegisterObjectMethod("JoystickState", "int get_hatPosition(uint) const", asMETHOD(JoystickState, GetHatPosition), asCALL_THISCALL);
  508. RegisterObject<Input>(engine, "Input");
  509. engine->RegisterObjectMethod("Input", "int AddScreenJoystick(XMLFile@+ layoutFile = null, XMLFile@+ styleFile = null)", asMETHOD(Input, AddScreenJoystick), asCALL_THISCALL);
  510. engine->RegisterObjectMethod("Input", "bool RemoveScreenJoystick(int)", asMETHOD(Input, RemoveScreenJoystick), asCALL_THISCALL);
  511. engine->RegisterObjectMethod("Input", "bool RecordGesture()", asMETHOD(Input, RecordGesture), asCALL_THISCALL);
  512. engine->RegisterObjectMethod("Input", "bool SaveGestures(File@+)", asFUNCTION(InputSaveGestures), asCALL_CDECL_OBJLAST);
  513. engine->RegisterObjectMethod("Input", "bool SaveGestures(VectorBuffer&)", asFUNCTION(InputSaveGesturesVectorBuffer), asCALL_CDECL_OBJLAST);
  514. engine->RegisterObjectMethod("Input", "bool SaveGesture(File@+, uint)", asFUNCTION(InputSaveGesture), asCALL_CDECL_OBJLAST);
  515. engine->RegisterObjectMethod("Input", "bool SaveGesture(VectorBuffer&, uint)", asFUNCTION(InputSaveGestureVectorBuffer), asCALL_CDECL_OBJLAST);
  516. engine->RegisterObjectMethod("Input", "uint LoadGestures(File@+)", asFUNCTION(InputLoadGestures), asCALL_CDECL_OBJLAST);
  517. engine->RegisterObjectMethod("Input", "uint LoadGestures(VectorBuffer&)", asFUNCTION(InputLoadGesturesVectorBuffer), asCALL_CDECL_OBJLAST);
  518. engine->RegisterObjectMethod("Input", "bool RemoveGesture(uint)", asMETHOD(Input, RemoveGesture), asCALL_THISCALL);
  519. engine->RegisterObjectMethod("Input", "void RemoveAllGestures()", asMETHOD(Input, RemoveAllGestures), asCALL_THISCALL);
  520. engine->RegisterObjectMethod("Input", "int GetKeyFromName(const String&in) const", asMETHOD(Input, GetKeyFromName), asCALL_THISCALL);
  521. engine->RegisterObjectMethod("Input", "int GetKeyFromScancode(int) const", asMETHOD(Input, GetKeyFromScancode), asCALL_THISCALL);
  522. engine->RegisterObjectMethod("Input", "String GetKeyName(int) const", asMETHOD(Input, GetKeyName), asCALL_THISCALL);
  523. engine->RegisterObjectMethod("Input", "int GetScancodeFromKey(int) const", asMETHOD(Input, GetScancodeFromKey), asCALL_THISCALL);
  524. engine->RegisterObjectMethod("Input", "int GetScancodeFromName(const String&in) const", asMETHOD(Input, GetScancodeFromName), asCALL_THISCALL);
  525. engine->RegisterObjectMethod("Input", "String GetScancodeName(int) const", asMETHOD(Input, GetScancodeName), asCALL_THISCALL);
  526. engine->RegisterObjectMethod("Input", "void SetMouseVisible(bool enable, bool suppressEvent = false)", asMETHOD(Input, SetMouseVisible), asCALL_THISCALL);
  527. engine->RegisterObjectMethod("Input", "void set_mouseVisible(bool)", asFUNCTION(InputSetMouseVisible), asCALL_CDECL_OBJLAST);
  528. engine->RegisterObjectMethod("Input", "void ResetMouseVisible()", asMETHOD(Input, ResetMouseVisible), asCALL_THISCALL);
  529. engine->RegisterObjectMethod("Input", "bool get_mouseVisible() const", asMETHOD(Input, IsMouseVisible), asCALL_THISCALL);
  530. engine->RegisterObjectMethod("Input", "void set_mouseGrabbed(bool)", asMETHOD(Input, SetMouseGrabbed), asCALL_THISCALL);
  531. engine->RegisterObjectMethod("Input", "bool get_mouseGrabbed() const", asMETHOD(Input, IsMouseGrabbed), asCALL_THISCALL);
  532. engine->RegisterObjectMethod("Input", "void set_mouseMode(MouseMode) const", asMETHOD(Input, SetMouseMode), asCALL_THISCALL);
  533. engine->RegisterObjectMethod("Input", "MouseMode get_mouseMode() const", asMETHOD(Input, GetMouseMode), asCALL_THISCALL);
  534. engine->RegisterObjectMethod("Input", "void set_screenJoystickVisible(int, bool)", asMETHOD(Input, SetScreenJoystickVisible), asCALL_THISCALL);
  535. engine->RegisterObjectMethod("Input", "bool get_screenJoystickVisible(int)", asMETHOD(Input, IsScreenJoystickVisible), asCALL_THISCALL);
  536. engine->RegisterObjectMethod("Input", "void set_screenKeyboardVisible(bool)", asMETHOD(Input, SetScreenKeyboardVisible), asCALL_THISCALL);
  537. engine->RegisterObjectMethod("Input", "bool get_screenKeyboardVisible() const", asMETHOD(Input, IsScreenKeyboardVisible), asCALL_THISCALL);
  538. engine->RegisterObjectMethod("Input", "bool get_screenKeyboardSupport() const", asMETHOD(Input, GetScreenKeyboardSupport), asCALL_THISCALL);
  539. engine->RegisterObjectMethod("Input", "void set_touchEmulation(bool)", asMETHOD(Input, SetTouchEmulation), asCALL_THISCALL);
  540. engine->RegisterObjectMethod("Input", "bool get_touchEmulation() const", asMETHOD(Input, GetTouchEmulation), asCALL_THISCALL);
  541. engine->RegisterObjectMethod("Input", "void set_toggleFullscreen(bool)", asMETHOD(Input, SetToggleFullscreen), asCALL_THISCALL);
  542. engine->RegisterObjectMethod("Input", "bool get_toggleFullscreen() const", asMETHOD(Input, GetToggleFullscreen), asCALL_THISCALL);
  543. engine->RegisterObjectMethod("Input", "bool get_keyDown(int) const", asMETHOD(Input, GetKeyDown), asCALL_THISCALL);
  544. engine->RegisterObjectMethod("Input", "bool get_keyPress(int) const", asMETHOD(Input, GetKeyPress), asCALL_THISCALL);
  545. engine->RegisterObjectMethod("Input", "bool get_scancodeDown(int) const", asMETHOD(Input, GetScancodeDown), asCALL_THISCALL);
  546. engine->RegisterObjectMethod("Input", "bool get_scancodePress(int) const", asMETHOD(Input, GetScancodePress), asCALL_THISCALL);
  547. engine->RegisterObjectMethod("Input", "bool get_mouseButtonDown(int) const", asMETHOD(Input, GetMouseButtonDown), asCALL_THISCALL);
  548. engine->RegisterObjectMethod("Input", "bool get_mouseButtonPress(int) const", asMETHOD(Input, GetMouseButtonPress), asCALL_THISCALL);
  549. engine->RegisterObjectMethod("Input", "bool get_qualifierDown(int) const", asMETHOD(Input, GetQualifierDown), asCALL_THISCALL);
  550. engine->RegisterObjectMethod("Input", "bool get_qualifierPress(int) const", asMETHOD(Input, GetQualifierPress), asCALL_THISCALL);
  551. engine->RegisterObjectMethod("Input", "int get_qualifiers() const", asMETHOD(Input, GetQualifiers), asCALL_THISCALL);
  552. engine->RegisterObjectMethod("Input", "IntVector2 get_mousePosition() const", asMETHOD(Input, GetMousePosition), asCALL_THISCALL);
  553. engine->RegisterObjectMethod("Input", "const IntVector2& get_mouseMove() const", asMETHOD(Input, GetMouseMove), asCALL_THISCALL);
  554. engine->RegisterObjectMethod("Input", "int get_mouseMoveX() const", asMETHOD(Input, GetMouseMoveX), asCALL_THISCALL);
  555. engine->RegisterObjectMethod("Input", "int get_mouseMoveY() const", asMETHOD(Input, GetMouseMoveY), asCALL_THISCALL);
  556. engine->RegisterObjectMethod("Input", "int get_mouseMoveWheel() const", asMETHOD(Input, GetMouseMoveWheel), asCALL_THISCALL);
  557. engine->RegisterObjectMethod("Input", "uint get_numTouches() const", asMETHOD(Input, GetNumTouches), asCALL_THISCALL);
  558. engine->RegisterObjectMethod("Input", "TouchState@+ get_touches(uint) const", asMETHOD(Input, GetTouch), asCALL_THISCALL);
  559. engine->RegisterObjectMethod("Input", "uint get_numJoysticks() const", asMETHOD(Input, GetNumJoysticks), asCALL_THISCALL);
  560. engine->RegisterObjectMethod("Input", "JoystickState@+ get_joysticks(int)", asMETHOD(Input, GetJoystick), asCALL_THISCALL);
  561. engine->RegisterObjectMethod("Input", "JoystickState@+ get_joysticksByIndex(uint)", asMETHOD(Input, GetJoystickByIndex), asCALL_THISCALL);
  562. engine->RegisterObjectMethod("Input", "bool get_focus() const", asMETHOD(Input, HasFocus), asCALL_THISCALL);
  563. engine->RegisterObjectMethod("Input", "bool get_minimized() const", asMETHOD(Input, IsMinimized), asCALL_THISCALL);
  564. engine->RegisterGlobalFunction("Input@+ get_input()", asFUNCTION(GetInput), asCALL_CDECL);
  565. }
  566. void RegisterInputAPI(asIScriptEngine* engine)
  567. {
  568. RegisterControls(engine);
  569. RegisterInputConstants(engine);
  570. RegisterInput(engine);
  571. }
  572. }