lua_Game.cpp 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_Game.h"
  4. #include "Base.h"
  5. #include "FileSystem.h"
  6. #include "FrameBuffer.h"
  7. #include "Game.h"
  8. #include "Platform.h"
  9. #include "RenderState.h"
  10. #include "SceneLoader.h"
  11. #include "lua_GameClearFlags.h"
  12. #include "lua_GameState.h"
  13. #include "lua_GamepadGamepadEvent.h"
  14. #include "lua_GestureGestureEvent.h"
  15. #include "lua_KeyboardKeyEvent.h"
  16. #include "lua_MouseMouseEvent.h"
  17. #include "lua_TouchTouchEvent.h"
  18. namespace gameplay
  19. {
  20. void luaRegister_Game()
  21. {
  22. const luaL_Reg lua_members[] =
  23. {
  24. {"canExit", lua_Game_canExit},
  25. {"clear", lua_Game_clear},
  26. {"displayKeyboard", lua_Game_displayKeyboard},
  27. {"exit", lua_Game_exit},
  28. {"frame", lua_Game_frame},
  29. {"gamepadEvent", lua_Game_gamepadEvent},
  30. {"gesturePinchEvent", lua_Game_gesturePinchEvent},
  31. {"gestureSwipeEvent", lua_Game_gestureSwipeEvent},
  32. {"gestureTapEvent", lua_Game_gestureTapEvent},
  33. {"getAIController", lua_Game_getAIController},
  34. {"getAccelerometerValues", lua_Game_getAccelerometerValues},
  35. {"getAnimationController", lua_Game_getAnimationController},
  36. {"getAspectRatio", lua_Game_getAspectRatio},
  37. {"getAudioController", lua_Game_getAudioController},
  38. {"getAudioListener", lua_Game_getAudioListener},
  39. {"getConfig", lua_Game_getConfig},
  40. {"getFrameRate", lua_Game_getFrameRate},
  41. {"getGamepad", lua_Game_getGamepad},
  42. {"getGamepadCount", lua_Game_getGamepadCount},
  43. {"getGamepadsConnected", lua_Game_getGamepadsConnected},
  44. {"getHeight", lua_Game_getHeight},
  45. {"getPhysicsController", lua_Game_getPhysicsController},
  46. {"getScriptController", lua_Game_getScriptController},
  47. {"getState", lua_Game_getState},
  48. {"getViewport", lua_Game_getViewport},
  49. {"getWidth", lua_Game_getWidth},
  50. {"hasMouse", lua_Game_hasMouse},
  51. {"isCursorVisible", lua_Game_isCursorVisible},
  52. {"isGestureRegistered", lua_Game_isGestureRegistered},
  53. {"isGestureSupported", lua_Game_isGestureSupported},
  54. {"isInitialized", lua_Game_isInitialized},
  55. {"isMouseCaptured", lua_Game_isMouseCaptured},
  56. {"isMultiTouch", lua_Game_isMultiTouch},
  57. {"keyEvent", lua_Game_keyEvent},
  58. {"launchURL", lua_Game_launchURL},
  59. {"menuEvent", lua_Game_menuEvent},
  60. {"mouseEvent", lua_Game_mouseEvent},
  61. {"pause", lua_Game_pause},
  62. {"registerGesture", lua_Game_registerGesture},
  63. {"resume", lua_Game_resume},
  64. {"run", lua_Game_run},
  65. {"schedule", lua_Game_schedule},
  66. {"setCursorVisible", lua_Game_setCursorVisible},
  67. {"setMouseCaptured", lua_Game_setMouseCaptured},
  68. {"setMultiTouch", lua_Game_setMultiTouch},
  69. {"setViewport", lua_Game_setViewport},
  70. {"touchEvent", lua_Game_touchEvent},
  71. {"unregisterGesture", lua_Game_unregisterGesture},
  72. {NULL, NULL}
  73. };
  74. const luaL_Reg lua_statics[] =
  75. {
  76. {"getAbsoluteTime", lua_Game_static_getAbsoluteTime},
  77. {"getGameTime", lua_Game_static_getGameTime},
  78. {"getInstance", lua_Game_static_getInstance},
  79. {"isVsync", lua_Game_static_isVsync},
  80. {"setVsync", lua_Game_static_setVsync},
  81. {NULL, NULL}
  82. };
  83. std::vector<std::string> scopePath;
  84. ScriptUtil::registerClass("Game", lua_members, NULL, lua_Game__gc, lua_statics, scopePath);
  85. }
  86. static Game* getInstance(lua_State* state)
  87. {
  88. void* userdata = luaL_checkudata(state, 1, "Game");
  89. luaL_argcheck(state, userdata != NULL, 1, "'Game' expected.");
  90. return (Game*)((ScriptUtil::LuaObject*)userdata)->instance;
  91. }
  92. int lua_Game__gc(lua_State* state)
  93. {
  94. // Get the number of parameters.
  95. int paramCount = lua_gettop(state);
  96. // Attempt to match the parameters to a valid binding.
  97. switch (paramCount)
  98. {
  99. case 1:
  100. {
  101. if ((lua_type(state, 1) == LUA_TUSERDATA))
  102. {
  103. void* userdata = luaL_checkudata(state, 1, "Game");
  104. luaL_argcheck(state, userdata != NULL, 1, "'Game' expected.");
  105. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
  106. if (object->owns)
  107. {
  108. Game* instance = (Game*)object->instance;
  109. SAFE_DELETE(instance);
  110. }
  111. return 0;
  112. }
  113. lua_pushstring(state, "lua_Game__gc - Failed to match the given parameters to a valid function signature.");
  114. lua_error(state);
  115. break;
  116. }
  117. default:
  118. {
  119. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  120. lua_error(state);
  121. break;
  122. }
  123. }
  124. return 0;
  125. }
  126. int lua_Game_canExit(lua_State* state)
  127. {
  128. // Get the number of parameters.
  129. int paramCount = lua_gettop(state);
  130. // Attempt to match the parameters to a valid binding.
  131. switch (paramCount)
  132. {
  133. case 1:
  134. {
  135. if ((lua_type(state, 1) == LUA_TUSERDATA))
  136. {
  137. Game* instance = getInstance(state);
  138. bool result = instance->canExit();
  139. // Push the return value onto the stack.
  140. lua_pushboolean(state, result);
  141. return 1;
  142. }
  143. lua_pushstring(state, "lua_Game_canExit - Failed to match the given parameters to a valid function signature.");
  144. lua_error(state);
  145. break;
  146. }
  147. default:
  148. {
  149. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  150. lua_error(state);
  151. break;
  152. }
  153. }
  154. return 0;
  155. }
  156. int lua_Game_clear(lua_State* state)
  157. {
  158. // Get the number of parameters.
  159. int paramCount = lua_gettop(state);
  160. // Attempt to match the parameters to a valid binding.
  161. switch (paramCount)
  162. {
  163. case 5:
  164. {
  165. do
  166. {
  167. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  168. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  169. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  170. lua_type(state, 4) == LUA_TNUMBER &&
  171. lua_type(state, 5) == LUA_TNUMBER)
  172. {
  173. // Get parameter 1 off the stack.
  174. Game::ClearFlags param1 = (Game::ClearFlags)lua_enumFromString_GameClearFlags(luaL_checkstring(state, 2));
  175. // Get parameter 2 off the stack.
  176. bool param2Valid;
  177. ScriptUtil::LuaArray<Vector4> param2 = ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", true, &param2Valid);
  178. if (!param2Valid)
  179. break;
  180. // Get parameter 3 off the stack.
  181. float param3 = (float)luaL_checknumber(state, 4);
  182. // Get parameter 4 off the stack.
  183. int param4 = (int)luaL_checkint(state, 5);
  184. Game* instance = getInstance(state);
  185. instance->clear(param1, *param2, param3, param4);
  186. return 0;
  187. }
  188. } while (0);
  189. lua_pushstring(state, "lua_Game_clear - Failed to match the given parameters to a valid function signature.");
  190. lua_error(state);
  191. break;
  192. }
  193. case 8:
  194. {
  195. do
  196. {
  197. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  198. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  199. lua_type(state, 3) == LUA_TNUMBER &&
  200. lua_type(state, 4) == LUA_TNUMBER &&
  201. lua_type(state, 5) == LUA_TNUMBER &&
  202. lua_type(state, 6) == LUA_TNUMBER &&
  203. lua_type(state, 7) == LUA_TNUMBER &&
  204. lua_type(state, 8) == LUA_TNUMBER)
  205. {
  206. // Get parameter 1 off the stack.
  207. Game::ClearFlags param1 = (Game::ClearFlags)lua_enumFromString_GameClearFlags(luaL_checkstring(state, 2));
  208. // Get parameter 2 off the stack.
  209. float param2 = (float)luaL_checknumber(state, 3);
  210. // Get parameter 3 off the stack.
  211. float param3 = (float)luaL_checknumber(state, 4);
  212. // Get parameter 4 off the stack.
  213. float param4 = (float)luaL_checknumber(state, 5);
  214. // Get parameter 5 off the stack.
  215. float param5 = (float)luaL_checknumber(state, 6);
  216. // Get parameter 6 off the stack.
  217. float param6 = (float)luaL_checknumber(state, 7);
  218. // Get parameter 7 off the stack.
  219. int param7 = (int)luaL_checkint(state, 8);
  220. Game* instance = getInstance(state);
  221. instance->clear(param1, param2, param3, param4, param5, param6, param7);
  222. return 0;
  223. }
  224. } while (0);
  225. lua_pushstring(state, "lua_Game_clear - Failed to match the given parameters to a valid function signature.");
  226. lua_error(state);
  227. break;
  228. }
  229. default:
  230. {
  231. lua_pushstring(state, "Invalid number of parameters (expected 5 or 8).");
  232. lua_error(state);
  233. break;
  234. }
  235. }
  236. return 0;
  237. }
  238. int lua_Game_displayKeyboard(lua_State* state)
  239. {
  240. // Get the number of parameters.
  241. int paramCount = lua_gettop(state);
  242. // Attempt to match the parameters to a valid binding.
  243. switch (paramCount)
  244. {
  245. case 2:
  246. {
  247. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  248. lua_type(state, 2) == LUA_TBOOLEAN)
  249. {
  250. // Get parameter 1 off the stack.
  251. bool param1 = ScriptUtil::luaCheckBool(state, 2);
  252. Game* instance = getInstance(state);
  253. instance->displayKeyboard(param1);
  254. return 0;
  255. }
  256. lua_pushstring(state, "lua_Game_displayKeyboard - Failed to match the given parameters to a valid function signature.");
  257. lua_error(state);
  258. break;
  259. }
  260. default:
  261. {
  262. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  263. lua_error(state);
  264. break;
  265. }
  266. }
  267. return 0;
  268. }
  269. int lua_Game_exit(lua_State* state)
  270. {
  271. // Get the number of parameters.
  272. int paramCount = lua_gettop(state);
  273. // Attempt to match the parameters to a valid binding.
  274. switch (paramCount)
  275. {
  276. case 1:
  277. {
  278. if ((lua_type(state, 1) == LUA_TUSERDATA))
  279. {
  280. Game* instance = getInstance(state);
  281. instance->exit();
  282. return 0;
  283. }
  284. lua_pushstring(state, "lua_Game_exit - Failed to match the given parameters to a valid function signature.");
  285. lua_error(state);
  286. break;
  287. }
  288. default:
  289. {
  290. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  291. lua_error(state);
  292. break;
  293. }
  294. }
  295. return 0;
  296. }
  297. int lua_Game_frame(lua_State* state)
  298. {
  299. // Get the number of parameters.
  300. int paramCount = lua_gettop(state);
  301. // Attempt to match the parameters to a valid binding.
  302. switch (paramCount)
  303. {
  304. case 1:
  305. {
  306. if ((lua_type(state, 1) == LUA_TUSERDATA))
  307. {
  308. Game* instance = getInstance(state);
  309. instance->frame();
  310. return 0;
  311. }
  312. lua_pushstring(state, "lua_Game_frame - Failed to match the given parameters to a valid function signature.");
  313. lua_error(state);
  314. break;
  315. }
  316. default:
  317. {
  318. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  319. lua_error(state);
  320. break;
  321. }
  322. }
  323. return 0;
  324. }
  325. int lua_Game_gamepadEvent(lua_State* state)
  326. {
  327. // Get the number of parameters.
  328. int paramCount = lua_gettop(state);
  329. // Attempt to match the parameters to a valid binding.
  330. switch (paramCount)
  331. {
  332. case 3:
  333. {
  334. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  335. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  336. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  337. {
  338. // Get parameter 1 off the stack.
  339. Gamepad::GamepadEvent param1 = (Gamepad::GamepadEvent)lua_enumFromString_GamepadGamepadEvent(luaL_checkstring(state, 2));
  340. // Get parameter 2 off the stack.
  341. bool param2Valid;
  342. ScriptUtil::LuaArray<Gamepad> param2 = ScriptUtil::getObjectPointer<Gamepad>(3, "Gamepad", false, &param2Valid);
  343. if (!param2Valid)
  344. {
  345. lua_pushstring(state, "Failed to convert parameter 2 to type 'Gamepad'.");
  346. lua_error(state);
  347. }
  348. Game* instance = getInstance(state);
  349. instance->gamepadEvent(param1, param2);
  350. return 0;
  351. }
  352. lua_pushstring(state, "lua_Game_gamepadEvent - Failed to match the given parameters to a valid function signature.");
  353. lua_error(state);
  354. break;
  355. }
  356. default:
  357. {
  358. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  359. lua_error(state);
  360. break;
  361. }
  362. }
  363. return 0;
  364. }
  365. int lua_Game_gesturePinchEvent(lua_State* state)
  366. {
  367. // Get the number of parameters.
  368. int paramCount = lua_gettop(state);
  369. // Attempt to match the parameters to a valid binding.
  370. switch (paramCount)
  371. {
  372. case 4:
  373. {
  374. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  375. lua_type(state, 2) == LUA_TNUMBER &&
  376. lua_type(state, 3) == LUA_TNUMBER &&
  377. lua_type(state, 4) == LUA_TNUMBER)
  378. {
  379. // Get parameter 1 off the stack.
  380. int param1 = (int)luaL_checkint(state, 2);
  381. // Get parameter 2 off the stack.
  382. int param2 = (int)luaL_checkint(state, 3);
  383. // Get parameter 3 off the stack.
  384. float param3 = (float)luaL_checknumber(state, 4);
  385. Game* instance = getInstance(state);
  386. instance->gesturePinchEvent(param1, param2, param3);
  387. return 0;
  388. }
  389. lua_pushstring(state, "lua_Game_gesturePinchEvent - Failed to match the given parameters to a valid function signature.");
  390. lua_error(state);
  391. break;
  392. }
  393. default:
  394. {
  395. lua_pushstring(state, "Invalid number of parameters (expected 4).");
  396. lua_error(state);
  397. break;
  398. }
  399. }
  400. return 0;
  401. }
  402. int lua_Game_gestureSwipeEvent(lua_State* state)
  403. {
  404. // Get the number of parameters.
  405. int paramCount = lua_gettop(state);
  406. // Attempt to match the parameters to a valid binding.
  407. switch (paramCount)
  408. {
  409. case 4:
  410. {
  411. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  412. lua_type(state, 2) == LUA_TNUMBER &&
  413. lua_type(state, 3) == LUA_TNUMBER &&
  414. lua_type(state, 4) == LUA_TNUMBER)
  415. {
  416. // Get parameter 1 off the stack.
  417. int param1 = (int)luaL_checkint(state, 2);
  418. // Get parameter 2 off the stack.
  419. int param2 = (int)luaL_checkint(state, 3);
  420. // Get parameter 3 off the stack.
  421. int param3 = (int)luaL_checkint(state, 4);
  422. Game* instance = getInstance(state);
  423. instance->gestureSwipeEvent(param1, param2, param3);
  424. return 0;
  425. }
  426. lua_pushstring(state, "lua_Game_gestureSwipeEvent - Failed to match the given parameters to a valid function signature.");
  427. lua_error(state);
  428. break;
  429. }
  430. default:
  431. {
  432. lua_pushstring(state, "Invalid number of parameters (expected 4).");
  433. lua_error(state);
  434. break;
  435. }
  436. }
  437. return 0;
  438. }
  439. int lua_Game_gestureTapEvent(lua_State* state)
  440. {
  441. // Get the number of parameters.
  442. int paramCount = lua_gettop(state);
  443. // Attempt to match the parameters to a valid binding.
  444. switch (paramCount)
  445. {
  446. case 3:
  447. {
  448. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  449. lua_type(state, 2) == LUA_TNUMBER &&
  450. lua_type(state, 3) == LUA_TNUMBER)
  451. {
  452. // Get parameter 1 off the stack.
  453. int param1 = (int)luaL_checkint(state, 2);
  454. // Get parameter 2 off the stack.
  455. int param2 = (int)luaL_checkint(state, 3);
  456. Game* instance = getInstance(state);
  457. instance->gestureTapEvent(param1, param2);
  458. return 0;
  459. }
  460. lua_pushstring(state, "lua_Game_gestureTapEvent - Failed to match the given parameters to a valid function signature.");
  461. lua_error(state);
  462. break;
  463. }
  464. default:
  465. {
  466. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  467. lua_error(state);
  468. break;
  469. }
  470. }
  471. return 0;
  472. }
  473. int lua_Game_getAIController(lua_State* state)
  474. {
  475. // Get the number of parameters.
  476. int paramCount = lua_gettop(state);
  477. // Attempt to match the parameters to a valid binding.
  478. switch (paramCount)
  479. {
  480. case 1:
  481. {
  482. if ((lua_type(state, 1) == LUA_TUSERDATA))
  483. {
  484. Game* instance = getInstance(state);
  485. void* returnPtr = (void*)instance->getAIController();
  486. if (returnPtr)
  487. {
  488. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  489. object->instance = returnPtr;
  490. object->owns = false;
  491. luaL_getmetatable(state, "AIController");
  492. lua_setmetatable(state, -2);
  493. }
  494. else
  495. {
  496. lua_pushnil(state);
  497. }
  498. return 1;
  499. }
  500. lua_pushstring(state, "lua_Game_getAIController - Failed to match the given parameters to a valid function signature.");
  501. lua_error(state);
  502. break;
  503. }
  504. default:
  505. {
  506. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  507. lua_error(state);
  508. break;
  509. }
  510. }
  511. return 0;
  512. }
  513. int lua_Game_getAccelerometerValues(lua_State* state)
  514. {
  515. // Get the number of parameters.
  516. int paramCount = lua_gettop(state);
  517. // Attempt to match the parameters to a valid binding.
  518. switch (paramCount)
  519. {
  520. case 3:
  521. {
  522. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  523. (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
  524. (lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TLIGHTUSERDATA))
  525. {
  526. // Get parameter 1 off the stack.
  527. ScriptUtil::LuaArray<float> param1 = ScriptUtil::getFloatPointer(2);
  528. // Get parameter 2 off the stack.
  529. ScriptUtil::LuaArray<float> param2 = ScriptUtil::getFloatPointer(3);
  530. Game* instance = getInstance(state);
  531. instance->getAccelerometerValues(param1, param2);
  532. return 0;
  533. }
  534. lua_pushstring(state, "lua_Game_getAccelerometerValues - Failed to match the given parameters to a valid function signature.");
  535. lua_error(state);
  536. break;
  537. }
  538. default:
  539. {
  540. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  541. lua_error(state);
  542. break;
  543. }
  544. }
  545. return 0;
  546. }
  547. int lua_Game_getAnimationController(lua_State* state)
  548. {
  549. // Get the number of parameters.
  550. int paramCount = lua_gettop(state);
  551. // Attempt to match the parameters to a valid binding.
  552. switch (paramCount)
  553. {
  554. case 1:
  555. {
  556. if ((lua_type(state, 1) == LUA_TUSERDATA))
  557. {
  558. Game* instance = getInstance(state);
  559. void* returnPtr = (void*)instance->getAnimationController();
  560. if (returnPtr)
  561. {
  562. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  563. object->instance = returnPtr;
  564. object->owns = false;
  565. luaL_getmetatable(state, "AnimationController");
  566. lua_setmetatable(state, -2);
  567. }
  568. else
  569. {
  570. lua_pushnil(state);
  571. }
  572. return 1;
  573. }
  574. lua_pushstring(state, "lua_Game_getAnimationController - Failed to match the given parameters to a valid function signature.");
  575. lua_error(state);
  576. break;
  577. }
  578. default:
  579. {
  580. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  581. lua_error(state);
  582. break;
  583. }
  584. }
  585. return 0;
  586. }
  587. int lua_Game_getAspectRatio(lua_State* state)
  588. {
  589. // Get the number of parameters.
  590. int paramCount = lua_gettop(state);
  591. // Attempt to match the parameters to a valid binding.
  592. switch (paramCount)
  593. {
  594. case 1:
  595. {
  596. if ((lua_type(state, 1) == LUA_TUSERDATA))
  597. {
  598. Game* instance = getInstance(state);
  599. float result = instance->getAspectRatio();
  600. // Push the return value onto the stack.
  601. lua_pushnumber(state, result);
  602. return 1;
  603. }
  604. lua_pushstring(state, "lua_Game_getAspectRatio - Failed to match the given parameters to a valid function signature.");
  605. lua_error(state);
  606. break;
  607. }
  608. default:
  609. {
  610. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  611. lua_error(state);
  612. break;
  613. }
  614. }
  615. return 0;
  616. }
  617. int lua_Game_getAudioController(lua_State* state)
  618. {
  619. // Get the number of parameters.
  620. int paramCount = lua_gettop(state);
  621. // Attempt to match the parameters to a valid binding.
  622. switch (paramCount)
  623. {
  624. case 1:
  625. {
  626. if ((lua_type(state, 1) == LUA_TUSERDATA))
  627. {
  628. Game* instance = getInstance(state);
  629. void* returnPtr = (void*)instance->getAudioController();
  630. if (returnPtr)
  631. {
  632. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  633. object->instance = returnPtr;
  634. object->owns = false;
  635. luaL_getmetatable(state, "AudioController");
  636. lua_setmetatable(state, -2);
  637. }
  638. else
  639. {
  640. lua_pushnil(state);
  641. }
  642. return 1;
  643. }
  644. lua_pushstring(state, "lua_Game_getAudioController - Failed to match the given parameters to a valid function signature.");
  645. lua_error(state);
  646. break;
  647. }
  648. default:
  649. {
  650. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  651. lua_error(state);
  652. break;
  653. }
  654. }
  655. return 0;
  656. }
  657. int lua_Game_getAudioListener(lua_State* state)
  658. {
  659. // Get the number of parameters.
  660. int paramCount = lua_gettop(state);
  661. // Attempt to match the parameters to a valid binding.
  662. switch (paramCount)
  663. {
  664. case 1:
  665. {
  666. if ((lua_type(state, 1) == LUA_TUSERDATA))
  667. {
  668. Game* instance = getInstance(state);
  669. void* returnPtr = (void*)instance->getAudioListener();
  670. if (returnPtr)
  671. {
  672. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  673. object->instance = returnPtr;
  674. object->owns = false;
  675. luaL_getmetatable(state, "AudioListener");
  676. lua_setmetatable(state, -2);
  677. }
  678. else
  679. {
  680. lua_pushnil(state);
  681. }
  682. return 1;
  683. }
  684. lua_pushstring(state, "lua_Game_getAudioListener - Failed to match the given parameters to a valid function signature.");
  685. lua_error(state);
  686. break;
  687. }
  688. default:
  689. {
  690. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  691. lua_error(state);
  692. break;
  693. }
  694. }
  695. return 0;
  696. }
  697. int lua_Game_getConfig(lua_State* state)
  698. {
  699. // Get the number of parameters.
  700. int paramCount = lua_gettop(state);
  701. // Attempt to match the parameters to a valid binding.
  702. switch (paramCount)
  703. {
  704. case 1:
  705. {
  706. if ((lua_type(state, 1) == LUA_TUSERDATA))
  707. {
  708. Game* instance = getInstance(state);
  709. void* returnPtr = (void*)instance->getConfig();
  710. if (returnPtr)
  711. {
  712. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  713. object->instance = returnPtr;
  714. object->owns = false;
  715. luaL_getmetatable(state, "Properties");
  716. lua_setmetatable(state, -2);
  717. }
  718. else
  719. {
  720. lua_pushnil(state);
  721. }
  722. return 1;
  723. }
  724. lua_pushstring(state, "lua_Game_getConfig - Failed to match the given parameters to a valid function signature.");
  725. lua_error(state);
  726. break;
  727. }
  728. default:
  729. {
  730. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  731. lua_error(state);
  732. break;
  733. }
  734. }
  735. return 0;
  736. }
  737. int lua_Game_getFrameRate(lua_State* state)
  738. {
  739. // Get the number of parameters.
  740. int paramCount = lua_gettop(state);
  741. // Attempt to match the parameters to a valid binding.
  742. switch (paramCount)
  743. {
  744. case 1:
  745. {
  746. if ((lua_type(state, 1) == LUA_TUSERDATA))
  747. {
  748. Game* instance = getInstance(state);
  749. unsigned int result = instance->getFrameRate();
  750. // Push the return value onto the stack.
  751. lua_pushunsigned(state, result);
  752. return 1;
  753. }
  754. lua_pushstring(state, "lua_Game_getFrameRate - Failed to match the given parameters to a valid function signature.");
  755. lua_error(state);
  756. break;
  757. }
  758. default:
  759. {
  760. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  761. lua_error(state);
  762. break;
  763. }
  764. }
  765. return 0;
  766. }
  767. int lua_Game_getGamepad(lua_State* state)
  768. {
  769. // Get the number of parameters.
  770. int paramCount = lua_gettop(state);
  771. // Attempt to match the parameters to a valid binding.
  772. switch (paramCount)
  773. {
  774. case 2:
  775. {
  776. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  777. lua_type(state, 2) == LUA_TNUMBER)
  778. {
  779. // Get parameter 1 off the stack.
  780. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  781. Game* instance = getInstance(state);
  782. void* returnPtr = (void*)instance->getGamepad(param1);
  783. if (returnPtr)
  784. {
  785. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  786. object->instance = returnPtr;
  787. object->owns = false;
  788. luaL_getmetatable(state, "Gamepad");
  789. lua_setmetatable(state, -2);
  790. }
  791. else
  792. {
  793. lua_pushnil(state);
  794. }
  795. return 1;
  796. }
  797. lua_pushstring(state, "lua_Game_getGamepad - Failed to match the given parameters to a valid function signature.");
  798. lua_error(state);
  799. break;
  800. }
  801. default:
  802. {
  803. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  804. lua_error(state);
  805. break;
  806. }
  807. }
  808. return 0;
  809. }
  810. int lua_Game_getGamepadCount(lua_State* state)
  811. {
  812. // Get the number of parameters.
  813. int paramCount = lua_gettop(state);
  814. // Attempt to match the parameters to a valid binding.
  815. switch (paramCount)
  816. {
  817. case 1:
  818. {
  819. if ((lua_type(state, 1) == LUA_TUSERDATA))
  820. {
  821. Game* instance = getInstance(state);
  822. unsigned int result = instance->getGamepadCount();
  823. // Push the return value onto the stack.
  824. lua_pushunsigned(state, result);
  825. return 1;
  826. }
  827. lua_pushstring(state, "lua_Game_getGamepadCount - Failed to match the given parameters to a valid function signature.");
  828. lua_error(state);
  829. break;
  830. }
  831. default:
  832. {
  833. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  834. lua_error(state);
  835. break;
  836. }
  837. }
  838. return 0;
  839. }
  840. int lua_Game_getGamepadsConnected(lua_State* state)
  841. {
  842. // Get the number of parameters.
  843. int paramCount = lua_gettop(state);
  844. // Attempt to match the parameters to a valid binding.
  845. switch (paramCount)
  846. {
  847. case 1:
  848. {
  849. if ((lua_type(state, 1) == LUA_TUSERDATA))
  850. {
  851. Game* instance = getInstance(state);
  852. unsigned int result = instance->getGamepadsConnected();
  853. // Push the return value onto the stack.
  854. lua_pushunsigned(state, result);
  855. return 1;
  856. }
  857. lua_pushstring(state, "lua_Game_getGamepadsConnected - Failed to match the given parameters to a valid function signature.");
  858. lua_error(state);
  859. break;
  860. }
  861. default:
  862. {
  863. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  864. lua_error(state);
  865. break;
  866. }
  867. }
  868. return 0;
  869. }
  870. int lua_Game_getHeight(lua_State* state)
  871. {
  872. // Get the number of parameters.
  873. int paramCount = lua_gettop(state);
  874. // Attempt to match the parameters to a valid binding.
  875. switch (paramCount)
  876. {
  877. case 1:
  878. {
  879. if ((lua_type(state, 1) == LUA_TUSERDATA))
  880. {
  881. Game* instance = getInstance(state);
  882. unsigned int result = instance->getHeight();
  883. // Push the return value onto the stack.
  884. lua_pushunsigned(state, result);
  885. return 1;
  886. }
  887. lua_pushstring(state, "lua_Game_getHeight - Failed to match the given parameters to a valid function signature.");
  888. lua_error(state);
  889. break;
  890. }
  891. default:
  892. {
  893. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  894. lua_error(state);
  895. break;
  896. }
  897. }
  898. return 0;
  899. }
  900. int lua_Game_getPhysicsController(lua_State* state)
  901. {
  902. // Get the number of parameters.
  903. int paramCount = lua_gettop(state);
  904. // Attempt to match the parameters to a valid binding.
  905. switch (paramCount)
  906. {
  907. case 1:
  908. {
  909. if ((lua_type(state, 1) == LUA_TUSERDATA))
  910. {
  911. Game* instance = getInstance(state);
  912. void* returnPtr = (void*)instance->getPhysicsController();
  913. if (returnPtr)
  914. {
  915. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  916. object->instance = returnPtr;
  917. object->owns = false;
  918. luaL_getmetatable(state, "PhysicsController");
  919. lua_setmetatable(state, -2);
  920. }
  921. else
  922. {
  923. lua_pushnil(state);
  924. }
  925. return 1;
  926. }
  927. lua_pushstring(state, "lua_Game_getPhysicsController - Failed to match the given parameters to a valid function signature.");
  928. lua_error(state);
  929. break;
  930. }
  931. default:
  932. {
  933. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  934. lua_error(state);
  935. break;
  936. }
  937. }
  938. return 0;
  939. }
  940. int lua_Game_getScriptController(lua_State* state)
  941. {
  942. // Get the number of parameters.
  943. int paramCount = lua_gettop(state);
  944. // Attempt to match the parameters to a valid binding.
  945. switch (paramCount)
  946. {
  947. case 1:
  948. {
  949. if ((lua_type(state, 1) == LUA_TUSERDATA))
  950. {
  951. Game* instance = getInstance(state);
  952. void* returnPtr = (void*)instance->getScriptController();
  953. if (returnPtr)
  954. {
  955. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  956. object->instance = returnPtr;
  957. object->owns = false;
  958. luaL_getmetatable(state, "ScriptController");
  959. lua_setmetatable(state, -2);
  960. }
  961. else
  962. {
  963. lua_pushnil(state);
  964. }
  965. return 1;
  966. }
  967. lua_pushstring(state, "lua_Game_getScriptController - Failed to match the given parameters to a valid function signature.");
  968. lua_error(state);
  969. break;
  970. }
  971. default:
  972. {
  973. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  974. lua_error(state);
  975. break;
  976. }
  977. }
  978. return 0;
  979. }
  980. int lua_Game_getState(lua_State* state)
  981. {
  982. // Get the number of parameters.
  983. int paramCount = lua_gettop(state);
  984. // Attempt to match the parameters to a valid binding.
  985. switch (paramCount)
  986. {
  987. case 1:
  988. {
  989. if ((lua_type(state, 1) == LUA_TUSERDATA))
  990. {
  991. Game* instance = getInstance(state);
  992. Game::State result = instance->getState();
  993. // Push the return value onto the stack.
  994. lua_pushstring(state, lua_stringFromEnum_GameState(result));
  995. return 1;
  996. }
  997. lua_pushstring(state, "lua_Game_getState - Failed to match the given parameters to a valid function signature.");
  998. lua_error(state);
  999. break;
  1000. }
  1001. default:
  1002. {
  1003. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1004. lua_error(state);
  1005. break;
  1006. }
  1007. }
  1008. return 0;
  1009. }
  1010. int lua_Game_getViewport(lua_State* state)
  1011. {
  1012. // Get the number of parameters.
  1013. int paramCount = lua_gettop(state);
  1014. // Attempt to match the parameters to a valid binding.
  1015. switch (paramCount)
  1016. {
  1017. case 1:
  1018. {
  1019. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1020. {
  1021. Game* instance = getInstance(state);
  1022. void* returnPtr = (void*)&(instance->getViewport());
  1023. if (returnPtr)
  1024. {
  1025. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  1026. object->instance = returnPtr;
  1027. object->owns = false;
  1028. luaL_getmetatable(state, "Rectangle");
  1029. lua_setmetatable(state, -2);
  1030. }
  1031. else
  1032. {
  1033. lua_pushnil(state);
  1034. }
  1035. return 1;
  1036. }
  1037. lua_pushstring(state, "lua_Game_getViewport - Failed to match the given parameters to a valid function signature.");
  1038. lua_error(state);
  1039. break;
  1040. }
  1041. default:
  1042. {
  1043. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1044. lua_error(state);
  1045. break;
  1046. }
  1047. }
  1048. return 0;
  1049. }
  1050. int lua_Game_getWidth(lua_State* state)
  1051. {
  1052. // Get the number of parameters.
  1053. int paramCount = lua_gettop(state);
  1054. // Attempt to match the parameters to a valid binding.
  1055. switch (paramCount)
  1056. {
  1057. case 1:
  1058. {
  1059. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1060. {
  1061. Game* instance = getInstance(state);
  1062. unsigned int result = instance->getWidth();
  1063. // Push the return value onto the stack.
  1064. lua_pushunsigned(state, result);
  1065. return 1;
  1066. }
  1067. lua_pushstring(state, "lua_Game_getWidth - Failed to match the given parameters to a valid function signature.");
  1068. lua_error(state);
  1069. break;
  1070. }
  1071. default:
  1072. {
  1073. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1074. lua_error(state);
  1075. break;
  1076. }
  1077. }
  1078. return 0;
  1079. }
  1080. int lua_Game_hasMouse(lua_State* state)
  1081. {
  1082. // Get the number of parameters.
  1083. int paramCount = lua_gettop(state);
  1084. // Attempt to match the parameters to a valid binding.
  1085. switch (paramCount)
  1086. {
  1087. case 1:
  1088. {
  1089. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1090. {
  1091. Game* instance = getInstance(state);
  1092. bool result = instance->hasMouse();
  1093. // Push the return value onto the stack.
  1094. lua_pushboolean(state, result);
  1095. return 1;
  1096. }
  1097. lua_pushstring(state, "lua_Game_hasMouse - Failed to match the given parameters to a valid function signature.");
  1098. lua_error(state);
  1099. break;
  1100. }
  1101. default:
  1102. {
  1103. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1104. lua_error(state);
  1105. break;
  1106. }
  1107. }
  1108. return 0;
  1109. }
  1110. int lua_Game_isCursorVisible(lua_State* state)
  1111. {
  1112. // Get the number of parameters.
  1113. int paramCount = lua_gettop(state);
  1114. // Attempt to match the parameters to a valid binding.
  1115. switch (paramCount)
  1116. {
  1117. case 1:
  1118. {
  1119. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1120. {
  1121. Game* instance = getInstance(state);
  1122. bool result = instance->isCursorVisible();
  1123. // Push the return value onto the stack.
  1124. lua_pushboolean(state, result);
  1125. return 1;
  1126. }
  1127. lua_pushstring(state, "lua_Game_isCursorVisible - Failed to match the given parameters to a valid function signature.");
  1128. lua_error(state);
  1129. break;
  1130. }
  1131. default:
  1132. {
  1133. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1134. lua_error(state);
  1135. break;
  1136. }
  1137. }
  1138. return 0;
  1139. }
  1140. int lua_Game_isGestureRegistered(lua_State* state)
  1141. {
  1142. // Get the number of parameters.
  1143. int paramCount = lua_gettop(state);
  1144. // Attempt to match the parameters to a valid binding.
  1145. switch (paramCount)
  1146. {
  1147. case 2:
  1148. {
  1149. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1150. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  1151. {
  1152. // Get parameter 1 off the stack.
  1153. Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 2));
  1154. Game* instance = getInstance(state);
  1155. bool result = instance->isGestureRegistered(param1);
  1156. // Push the return value onto the stack.
  1157. lua_pushboolean(state, result);
  1158. return 1;
  1159. }
  1160. lua_pushstring(state, "lua_Game_isGestureRegistered - Failed to match the given parameters to a valid function signature.");
  1161. lua_error(state);
  1162. break;
  1163. }
  1164. default:
  1165. {
  1166. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1167. lua_error(state);
  1168. break;
  1169. }
  1170. }
  1171. return 0;
  1172. }
  1173. int lua_Game_isGestureSupported(lua_State* state)
  1174. {
  1175. // Get the number of parameters.
  1176. int paramCount = lua_gettop(state);
  1177. // Attempt to match the parameters to a valid binding.
  1178. switch (paramCount)
  1179. {
  1180. case 2:
  1181. {
  1182. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1183. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  1184. {
  1185. // Get parameter 1 off the stack.
  1186. Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 2));
  1187. Game* instance = getInstance(state);
  1188. bool result = instance->isGestureSupported(param1);
  1189. // Push the return value onto the stack.
  1190. lua_pushboolean(state, result);
  1191. return 1;
  1192. }
  1193. lua_pushstring(state, "lua_Game_isGestureSupported - Failed to match the given parameters to a valid function signature.");
  1194. lua_error(state);
  1195. break;
  1196. }
  1197. default:
  1198. {
  1199. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1200. lua_error(state);
  1201. break;
  1202. }
  1203. }
  1204. return 0;
  1205. }
  1206. int lua_Game_isInitialized(lua_State* state)
  1207. {
  1208. // Get the number of parameters.
  1209. int paramCount = lua_gettop(state);
  1210. // Attempt to match the parameters to a valid binding.
  1211. switch (paramCount)
  1212. {
  1213. case 1:
  1214. {
  1215. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1216. {
  1217. Game* instance = getInstance(state);
  1218. bool result = instance->isInitialized();
  1219. // Push the return value onto the stack.
  1220. lua_pushboolean(state, result);
  1221. return 1;
  1222. }
  1223. lua_pushstring(state, "lua_Game_isInitialized - Failed to match the given parameters to a valid function signature.");
  1224. lua_error(state);
  1225. break;
  1226. }
  1227. default:
  1228. {
  1229. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1230. lua_error(state);
  1231. break;
  1232. }
  1233. }
  1234. return 0;
  1235. }
  1236. int lua_Game_isMouseCaptured(lua_State* state)
  1237. {
  1238. // Get the number of parameters.
  1239. int paramCount = lua_gettop(state);
  1240. // Attempt to match the parameters to a valid binding.
  1241. switch (paramCount)
  1242. {
  1243. case 1:
  1244. {
  1245. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1246. {
  1247. Game* instance = getInstance(state);
  1248. bool result = instance->isMouseCaptured();
  1249. // Push the return value onto the stack.
  1250. lua_pushboolean(state, result);
  1251. return 1;
  1252. }
  1253. lua_pushstring(state, "lua_Game_isMouseCaptured - Failed to match the given parameters to a valid function signature.");
  1254. lua_error(state);
  1255. break;
  1256. }
  1257. default:
  1258. {
  1259. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1260. lua_error(state);
  1261. break;
  1262. }
  1263. }
  1264. return 0;
  1265. }
  1266. int lua_Game_isMultiTouch(lua_State* state)
  1267. {
  1268. // Get the number of parameters.
  1269. int paramCount = lua_gettop(state);
  1270. // Attempt to match the parameters to a valid binding.
  1271. switch (paramCount)
  1272. {
  1273. case 1:
  1274. {
  1275. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1276. {
  1277. Game* instance = getInstance(state);
  1278. bool result = instance->isMultiTouch();
  1279. // Push the return value onto the stack.
  1280. lua_pushboolean(state, result);
  1281. return 1;
  1282. }
  1283. lua_pushstring(state, "lua_Game_isMultiTouch - Failed to match the given parameters to a valid function signature.");
  1284. lua_error(state);
  1285. break;
  1286. }
  1287. default:
  1288. {
  1289. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1290. lua_error(state);
  1291. break;
  1292. }
  1293. }
  1294. return 0;
  1295. }
  1296. int lua_Game_keyEvent(lua_State* state)
  1297. {
  1298. // Get the number of parameters.
  1299. int paramCount = lua_gettop(state);
  1300. // Attempt to match the parameters to a valid binding.
  1301. switch (paramCount)
  1302. {
  1303. case 3:
  1304. {
  1305. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1306. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  1307. lua_type(state, 3) == LUA_TNUMBER)
  1308. {
  1309. // Get parameter 1 off the stack.
  1310. Keyboard::KeyEvent param1 = (Keyboard::KeyEvent)lua_enumFromString_KeyboardKeyEvent(luaL_checkstring(state, 2));
  1311. // Get parameter 2 off the stack.
  1312. int param2 = (int)luaL_checkint(state, 3);
  1313. Game* instance = getInstance(state);
  1314. instance->keyEvent(param1, param2);
  1315. return 0;
  1316. }
  1317. lua_pushstring(state, "lua_Game_keyEvent - Failed to match the given parameters to a valid function signature.");
  1318. lua_error(state);
  1319. break;
  1320. }
  1321. default:
  1322. {
  1323. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1324. lua_error(state);
  1325. break;
  1326. }
  1327. }
  1328. return 0;
  1329. }
  1330. int lua_Game_launchURL(lua_State* state)
  1331. {
  1332. // Get the number of parameters.
  1333. int paramCount = lua_gettop(state);
  1334. // Attempt to match the parameters to a valid binding.
  1335. switch (paramCount)
  1336. {
  1337. case 2:
  1338. {
  1339. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1340. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  1341. {
  1342. // Get parameter 1 off the stack.
  1343. ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
  1344. Game* instance = getInstance(state);
  1345. bool result = instance->launchURL(param1);
  1346. // Push the return value onto the stack.
  1347. lua_pushboolean(state, result);
  1348. return 1;
  1349. }
  1350. lua_pushstring(state, "lua_Game_launchURL - Failed to match the given parameters to a valid function signature.");
  1351. lua_error(state);
  1352. break;
  1353. }
  1354. default:
  1355. {
  1356. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1357. lua_error(state);
  1358. break;
  1359. }
  1360. }
  1361. return 0;
  1362. }
  1363. int lua_Game_menuEvent(lua_State* state)
  1364. {
  1365. // Get the number of parameters.
  1366. int paramCount = lua_gettop(state);
  1367. // Attempt to match the parameters to a valid binding.
  1368. switch (paramCount)
  1369. {
  1370. case 1:
  1371. {
  1372. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1373. {
  1374. Game* instance = getInstance(state);
  1375. instance->menuEvent();
  1376. return 0;
  1377. }
  1378. lua_pushstring(state, "lua_Game_menuEvent - Failed to match the given parameters to a valid function signature.");
  1379. lua_error(state);
  1380. break;
  1381. }
  1382. default:
  1383. {
  1384. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1385. lua_error(state);
  1386. break;
  1387. }
  1388. }
  1389. return 0;
  1390. }
  1391. int lua_Game_mouseEvent(lua_State* state)
  1392. {
  1393. // Get the number of parameters.
  1394. int paramCount = lua_gettop(state);
  1395. // Attempt to match the parameters to a valid binding.
  1396. switch (paramCount)
  1397. {
  1398. case 5:
  1399. {
  1400. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1401. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  1402. lua_type(state, 3) == LUA_TNUMBER &&
  1403. lua_type(state, 4) == LUA_TNUMBER &&
  1404. lua_type(state, 5) == LUA_TNUMBER)
  1405. {
  1406. // Get parameter 1 off the stack.
  1407. Mouse::MouseEvent param1 = (Mouse::MouseEvent)lua_enumFromString_MouseMouseEvent(luaL_checkstring(state, 2));
  1408. // Get parameter 2 off the stack.
  1409. int param2 = (int)luaL_checkint(state, 3);
  1410. // Get parameter 3 off the stack.
  1411. int param3 = (int)luaL_checkint(state, 4);
  1412. // Get parameter 4 off the stack.
  1413. int param4 = (int)luaL_checkint(state, 5);
  1414. Game* instance = getInstance(state);
  1415. bool result = instance->mouseEvent(param1, param2, param3, param4);
  1416. // Push the return value onto the stack.
  1417. lua_pushboolean(state, result);
  1418. return 1;
  1419. }
  1420. lua_pushstring(state, "lua_Game_mouseEvent - Failed to match the given parameters to a valid function signature.");
  1421. lua_error(state);
  1422. break;
  1423. }
  1424. default:
  1425. {
  1426. lua_pushstring(state, "Invalid number of parameters (expected 5).");
  1427. lua_error(state);
  1428. break;
  1429. }
  1430. }
  1431. return 0;
  1432. }
  1433. int lua_Game_pause(lua_State* state)
  1434. {
  1435. // Get the number of parameters.
  1436. int paramCount = lua_gettop(state);
  1437. // Attempt to match the parameters to a valid binding.
  1438. switch (paramCount)
  1439. {
  1440. case 1:
  1441. {
  1442. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1443. {
  1444. Game* instance = getInstance(state);
  1445. instance->pause();
  1446. return 0;
  1447. }
  1448. lua_pushstring(state, "lua_Game_pause - Failed to match the given parameters to a valid function signature.");
  1449. lua_error(state);
  1450. break;
  1451. }
  1452. default:
  1453. {
  1454. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1455. lua_error(state);
  1456. break;
  1457. }
  1458. }
  1459. return 0;
  1460. }
  1461. int lua_Game_registerGesture(lua_State* state)
  1462. {
  1463. // Get the number of parameters.
  1464. int paramCount = lua_gettop(state);
  1465. // Attempt to match the parameters to a valid binding.
  1466. switch (paramCount)
  1467. {
  1468. case 2:
  1469. {
  1470. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1471. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  1472. {
  1473. // Get parameter 1 off the stack.
  1474. Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 2));
  1475. Game* instance = getInstance(state);
  1476. instance->registerGesture(param1);
  1477. return 0;
  1478. }
  1479. lua_pushstring(state, "lua_Game_registerGesture - Failed to match the given parameters to a valid function signature.");
  1480. lua_error(state);
  1481. break;
  1482. }
  1483. default:
  1484. {
  1485. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1486. lua_error(state);
  1487. break;
  1488. }
  1489. }
  1490. return 0;
  1491. }
  1492. int lua_Game_resume(lua_State* state)
  1493. {
  1494. // Get the number of parameters.
  1495. int paramCount = lua_gettop(state);
  1496. // Attempt to match the parameters to a valid binding.
  1497. switch (paramCount)
  1498. {
  1499. case 1:
  1500. {
  1501. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1502. {
  1503. Game* instance = getInstance(state);
  1504. instance->resume();
  1505. return 0;
  1506. }
  1507. lua_pushstring(state, "lua_Game_resume - Failed to match the given parameters to a valid function signature.");
  1508. lua_error(state);
  1509. break;
  1510. }
  1511. default:
  1512. {
  1513. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1514. lua_error(state);
  1515. break;
  1516. }
  1517. }
  1518. return 0;
  1519. }
  1520. int lua_Game_run(lua_State* state)
  1521. {
  1522. // Get the number of parameters.
  1523. int paramCount = lua_gettop(state);
  1524. // Attempt to match the parameters to a valid binding.
  1525. switch (paramCount)
  1526. {
  1527. case 1:
  1528. {
  1529. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1530. {
  1531. Game* instance = getInstance(state);
  1532. int result = instance->run();
  1533. // Push the return value onto the stack.
  1534. lua_pushinteger(state, result);
  1535. return 1;
  1536. }
  1537. lua_pushstring(state, "lua_Game_run - Failed to match the given parameters to a valid function signature.");
  1538. lua_error(state);
  1539. break;
  1540. }
  1541. default:
  1542. {
  1543. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1544. lua_error(state);
  1545. break;
  1546. }
  1547. }
  1548. return 0;
  1549. }
  1550. int lua_Game_schedule(lua_State* state)
  1551. {
  1552. // Get the number of parameters.
  1553. int paramCount = lua_gettop(state);
  1554. // Attempt to match the parameters to a valid binding.
  1555. switch (paramCount)
  1556. {
  1557. case 3:
  1558. {
  1559. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1560. lua_type(state, 2) == LUA_TNUMBER &&
  1561. (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
  1562. {
  1563. // Get parameter 1 off the stack.
  1564. float param1 = (float)luaL_checknumber(state, 2);
  1565. // Get parameter 2 off the stack.
  1566. ScriptUtil::LuaArray<const char> param2 = ScriptUtil::getString(3, false);
  1567. Game* instance = getInstance(state);
  1568. instance->schedule(param1, param2);
  1569. return 0;
  1570. }
  1571. lua_pushstring(state, "lua_Game_schedule - Failed to match the given parameters to a valid function signature.");
  1572. lua_error(state);
  1573. break;
  1574. }
  1575. default:
  1576. {
  1577. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1578. lua_error(state);
  1579. break;
  1580. }
  1581. }
  1582. return 0;
  1583. }
  1584. int lua_Game_setCursorVisible(lua_State* state)
  1585. {
  1586. // Get the number of parameters.
  1587. int paramCount = lua_gettop(state);
  1588. // Attempt to match the parameters to a valid binding.
  1589. switch (paramCount)
  1590. {
  1591. case 2:
  1592. {
  1593. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1594. lua_type(state, 2) == LUA_TBOOLEAN)
  1595. {
  1596. // Get parameter 1 off the stack.
  1597. bool param1 = ScriptUtil::luaCheckBool(state, 2);
  1598. Game* instance = getInstance(state);
  1599. instance->setCursorVisible(param1);
  1600. return 0;
  1601. }
  1602. lua_pushstring(state, "lua_Game_setCursorVisible - Failed to match the given parameters to a valid function signature.");
  1603. lua_error(state);
  1604. break;
  1605. }
  1606. default:
  1607. {
  1608. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1609. lua_error(state);
  1610. break;
  1611. }
  1612. }
  1613. return 0;
  1614. }
  1615. int lua_Game_setMouseCaptured(lua_State* state)
  1616. {
  1617. // Get the number of parameters.
  1618. int paramCount = lua_gettop(state);
  1619. // Attempt to match the parameters to a valid binding.
  1620. switch (paramCount)
  1621. {
  1622. case 2:
  1623. {
  1624. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1625. lua_type(state, 2) == LUA_TBOOLEAN)
  1626. {
  1627. // Get parameter 1 off the stack.
  1628. bool param1 = ScriptUtil::luaCheckBool(state, 2);
  1629. Game* instance = getInstance(state);
  1630. instance->setMouseCaptured(param1);
  1631. return 0;
  1632. }
  1633. lua_pushstring(state, "lua_Game_setMouseCaptured - Failed to match the given parameters to a valid function signature.");
  1634. lua_error(state);
  1635. break;
  1636. }
  1637. default:
  1638. {
  1639. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1640. lua_error(state);
  1641. break;
  1642. }
  1643. }
  1644. return 0;
  1645. }
  1646. int lua_Game_setMultiTouch(lua_State* state)
  1647. {
  1648. // Get the number of parameters.
  1649. int paramCount = lua_gettop(state);
  1650. // Attempt to match the parameters to a valid binding.
  1651. switch (paramCount)
  1652. {
  1653. case 2:
  1654. {
  1655. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1656. lua_type(state, 2) == LUA_TBOOLEAN)
  1657. {
  1658. // Get parameter 1 off the stack.
  1659. bool param1 = ScriptUtil::luaCheckBool(state, 2);
  1660. Game* instance = getInstance(state);
  1661. instance->setMultiTouch(param1);
  1662. return 0;
  1663. }
  1664. lua_pushstring(state, "lua_Game_setMultiTouch - Failed to match the given parameters to a valid function signature.");
  1665. lua_error(state);
  1666. break;
  1667. }
  1668. default:
  1669. {
  1670. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1671. lua_error(state);
  1672. break;
  1673. }
  1674. }
  1675. return 0;
  1676. }
  1677. int lua_Game_setViewport(lua_State* state)
  1678. {
  1679. // Get the number of parameters.
  1680. int paramCount = lua_gettop(state);
  1681. // Attempt to match the parameters to a valid binding.
  1682. switch (paramCount)
  1683. {
  1684. case 2:
  1685. {
  1686. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1687. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  1688. {
  1689. // Get parameter 1 off the stack.
  1690. bool param1Valid;
  1691. ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
  1692. if (!param1Valid)
  1693. {
  1694. lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
  1695. lua_error(state);
  1696. }
  1697. Game* instance = getInstance(state);
  1698. instance->setViewport(*param1);
  1699. return 0;
  1700. }
  1701. lua_pushstring(state, "lua_Game_setViewport - Failed to match the given parameters to a valid function signature.");
  1702. lua_error(state);
  1703. break;
  1704. }
  1705. default:
  1706. {
  1707. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1708. lua_error(state);
  1709. break;
  1710. }
  1711. }
  1712. return 0;
  1713. }
  1714. int lua_Game_static_getAbsoluteTime(lua_State* state)
  1715. {
  1716. // Get the number of parameters.
  1717. int paramCount = lua_gettop(state);
  1718. // Attempt to match the parameters to a valid binding.
  1719. switch (paramCount)
  1720. {
  1721. case 0:
  1722. {
  1723. double result = Game::getAbsoluteTime();
  1724. // Push the return value onto the stack.
  1725. lua_pushnumber(state, result);
  1726. return 1;
  1727. break;
  1728. }
  1729. default:
  1730. {
  1731. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  1732. lua_error(state);
  1733. break;
  1734. }
  1735. }
  1736. return 0;
  1737. }
  1738. int lua_Game_static_getGameTime(lua_State* state)
  1739. {
  1740. // Get the number of parameters.
  1741. int paramCount = lua_gettop(state);
  1742. // Attempt to match the parameters to a valid binding.
  1743. switch (paramCount)
  1744. {
  1745. case 0:
  1746. {
  1747. double result = Game::getGameTime();
  1748. // Push the return value onto the stack.
  1749. lua_pushnumber(state, result);
  1750. return 1;
  1751. break;
  1752. }
  1753. default:
  1754. {
  1755. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  1756. lua_error(state);
  1757. break;
  1758. }
  1759. }
  1760. return 0;
  1761. }
  1762. int lua_Game_static_getInstance(lua_State* state)
  1763. {
  1764. // Get the number of parameters.
  1765. int paramCount = lua_gettop(state);
  1766. // Attempt to match the parameters to a valid binding.
  1767. switch (paramCount)
  1768. {
  1769. case 0:
  1770. {
  1771. void* returnPtr = (void*)Game::getInstance();
  1772. if (returnPtr)
  1773. {
  1774. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  1775. object->instance = returnPtr;
  1776. object->owns = false;
  1777. luaL_getmetatable(state, "Game");
  1778. lua_setmetatable(state, -2);
  1779. }
  1780. else
  1781. {
  1782. lua_pushnil(state);
  1783. }
  1784. return 1;
  1785. break;
  1786. }
  1787. default:
  1788. {
  1789. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  1790. lua_error(state);
  1791. break;
  1792. }
  1793. }
  1794. return 0;
  1795. }
  1796. int lua_Game_static_isVsync(lua_State* state)
  1797. {
  1798. // Get the number of parameters.
  1799. int paramCount = lua_gettop(state);
  1800. // Attempt to match the parameters to a valid binding.
  1801. switch (paramCount)
  1802. {
  1803. case 0:
  1804. {
  1805. bool result = Game::isVsync();
  1806. // Push the return value onto the stack.
  1807. lua_pushboolean(state, result);
  1808. return 1;
  1809. break;
  1810. }
  1811. default:
  1812. {
  1813. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  1814. lua_error(state);
  1815. break;
  1816. }
  1817. }
  1818. return 0;
  1819. }
  1820. int lua_Game_static_setVsync(lua_State* state)
  1821. {
  1822. // Get the number of parameters.
  1823. int paramCount = lua_gettop(state);
  1824. // Attempt to match the parameters to a valid binding.
  1825. switch (paramCount)
  1826. {
  1827. case 1:
  1828. {
  1829. if (lua_type(state, 1) == LUA_TBOOLEAN)
  1830. {
  1831. // Get parameter 1 off the stack.
  1832. bool param1 = ScriptUtil::luaCheckBool(state, 1);
  1833. Game::setVsync(param1);
  1834. return 0;
  1835. }
  1836. lua_pushstring(state, "lua_Game_static_setVsync - Failed to match the given parameters to a valid function signature.");
  1837. lua_error(state);
  1838. break;
  1839. }
  1840. default:
  1841. {
  1842. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1843. lua_error(state);
  1844. break;
  1845. }
  1846. }
  1847. return 0;
  1848. }
  1849. int lua_Game_touchEvent(lua_State* state)
  1850. {
  1851. // Get the number of parameters.
  1852. int paramCount = lua_gettop(state);
  1853. // Attempt to match the parameters to a valid binding.
  1854. switch (paramCount)
  1855. {
  1856. case 5:
  1857. {
  1858. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1859. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  1860. lua_type(state, 3) == LUA_TNUMBER &&
  1861. lua_type(state, 4) == LUA_TNUMBER &&
  1862. lua_type(state, 5) == LUA_TNUMBER)
  1863. {
  1864. // Get parameter 1 off the stack.
  1865. Touch::TouchEvent param1 = (Touch::TouchEvent)lua_enumFromString_TouchTouchEvent(luaL_checkstring(state, 2));
  1866. // Get parameter 2 off the stack.
  1867. int param2 = (int)luaL_checkint(state, 3);
  1868. // Get parameter 3 off the stack.
  1869. int param3 = (int)luaL_checkint(state, 4);
  1870. // Get parameter 4 off the stack.
  1871. unsigned int param4 = (unsigned int)luaL_checkunsigned(state, 5);
  1872. Game* instance = getInstance(state);
  1873. instance->touchEvent(param1, param2, param3, param4);
  1874. return 0;
  1875. }
  1876. lua_pushstring(state, "lua_Game_touchEvent - Failed to match the given parameters to a valid function signature.");
  1877. lua_error(state);
  1878. break;
  1879. }
  1880. default:
  1881. {
  1882. lua_pushstring(state, "Invalid number of parameters (expected 5).");
  1883. lua_error(state);
  1884. break;
  1885. }
  1886. }
  1887. return 0;
  1888. }
  1889. int lua_Game_unregisterGesture(lua_State* state)
  1890. {
  1891. // Get the number of parameters.
  1892. int paramCount = lua_gettop(state);
  1893. // Attempt to match the parameters to a valid binding.
  1894. switch (paramCount)
  1895. {
  1896. case 2:
  1897. {
  1898. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1899. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  1900. {
  1901. // Get parameter 1 off the stack.
  1902. Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 2));
  1903. Game* instance = getInstance(state);
  1904. instance->unregisterGesture(param1);
  1905. return 0;
  1906. }
  1907. lua_pushstring(state, "lua_Game_unregisterGesture - Failed to match the given parameters to a valid function signature.");
  1908. lua_error(state);
  1909. break;
  1910. }
  1911. default:
  1912. {
  1913. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1914. lua_error(state);
  1915. break;
  1916. }
  1917. }
  1918. return 0;
  1919. }
  1920. }