lua_Font.cpp 89 KB

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