lua_Font.cpp 95 KB

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