2
0

lua_Font.cpp 93 KB

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