lua_Game.cpp 74 KB

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