lua_Font.cpp 71 KB

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