lua_Font.cpp 68 KB

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