lua_Game.cpp 76 KB

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