lua_Game.cpp 73 KB

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