lua_Font.cpp 92 KB

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