lua_Game.cpp 74 KB

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