lua_SpriteBatch.cpp 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_SpriteBatch.h"
  4. #include "Base.h"
  5. #include "Game.h"
  6. #include "SpriteBatch.h"
  7. namespace gameplay
  8. {
  9. void luaRegister_SpriteBatch()
  10. {
  11. const luaL_Reg lua_members[] =
  12. {
  13. {"draw", lua_SpriteBatch_draw},
  14. {"finish", lua_SpriteBatch_finish},
  15. {"getMaterial", lua_SpriteBatch_getMaterial},
  16. {"getProjectionMatrix", lua_SpriteBatch_getProjectionMatrix},
  17. {"getStateBlock", lua_SpriteBatch_getStateBlock},
  18. {"setProjectionMatrix", lua_SpriteBatch_setProjectionMatrix},
  19. {"start", lua_SpriteBatch_start},
  20. {NULL, NULL}
  21. };
  22. const luaL_Reg lua_statics[] =
  23. {
  24. {"create", lua_SpriteBatch_static_create},
  25. {NULL, NULL}
  26. };
  27. std::vector<std::string> scopePath;
  28. ScriptUtil::registerClass("SpriteBatch", lua_members, NULL, lua_SpriteBatch__gc, lua_statics, scopePath);
  29. }
  30. static SpriteBatch* getInstance(lua_State* state)
  31. {
  32. void* userdata = luaL_checkudata(state, 1, "SpriteBatch");
  33. luaL_argcheck(state, userdata != NULL, 1, "'SpriteBatch' expected.");
  34. return (SpriteBatch*)((ScriptUtil::LuaObject*)userdata)->instance;
  35. }
  36. int lua_SpriteBatch__gc(lua_State* state)
  37. {
  38. // Get the number of parameters.
  39. int paramCount = lua_gettop(state);
  40. // Attempt to match the parameters to a valid binding.
  41. switch (paramCount)
  42. {
  43. case 1:
  44. {
  45. if ((lua_type(state, 1) == LUA_TUSERDATA))
  46. {
  47. void* userdata = luaL_checkudata(state, 1, "SpriteBatch");
  48. luaL_argcheck(state, userdata != NULL, 1, "'SpriteBatch' expected.");
  49. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
  50. if (object->owns)
  51. {
  52. SpriteBatch* instance = (SpriteBatch*)object->instance;
  53. SAFE_DELETE(instance);
  54. }
  55. return 0;
  56. }
  57. else
  58. {
  59. lua_pushstring(state, "lua_SpriteBatch__gc - Failed to match the given parameters to a valid function signature.");
  60. lua_error(state);
  61. }
  62. break;
  63. }
  64. default:
  65. {
  66. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  67. lua_error(state);
  68. break;
  69. }
  70. }
  71. return 0;
  72. }
  73. int lua_SpriteBatch_draw(lua_State* state)
  74. {
  75. // Get the number of parameters.
  76. int paramCount = lua_gettop(state);
  77. // Attempt to match the parameters to a valid binding.
  78. switch (paramCount)
  79. {
  80. case 3:
  81. {
  82. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  83. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  84. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
  85. {
  86. // Get parameter 1 off the stack.
  87. Rectangle* param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true);
  88. // Get parameter 2 off the stack.
  89. Rectangle* param2 = ScriptUtil::getObjectPointer<Rectangle>(3, "Rectangle", true);
  90. SpriteBatch* instance = getInstance(state);
  91. instance->draw(*param1, *param2);
  92. return 0;
  93. }
  94. else
  95. {
  96. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  97. lua_error(state);
  98. }
  99. break;
  100. }
  101. case 4:
  102. {
  103. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  104. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  105. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  106. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL))
  107. {
  108. // Get parameter 1 off the stack.
  109. Rectangle* param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true);
  110. // Get parameter 2 off the stack.
  111. Rectangle* param2 = ScriptUtil::getObjectPointer<Rectangle>(3, "Rectangle", true);
  112. // Get parameter 3 off the stack.
  113. Vector4* param3 = ScriptUtil::getObjectPointer<Vector4>(4, "Vector4", true);
  114. SpriteBatch* instance = getInstance(state);
  115. instance->draw(*param1, *param2, *param3);
  116. return 0;
  117. }
  118. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  119. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  120. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  121. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL))
  122. {
  123. // Get parameter 1 off the stack.
  124. Vector3* param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  125. // Get parameter 2 off the stack.
  126. Rectangle* param2 = ScriptUtil::getObjectPointer<Rectangle>(3, "Rectangle", true);
  127. // Get parameter 3 off the stack.
  128. Vector2* param3 = ScriptUtil::getObjectPointer<Vector2>(4, "Vector2", true);
  129. SpriteBatch* instance = getInstance(state);
  130. instance->draw(*param1, *param2, *param3);
  131. return 0;
  132. }
  133. else
  134. {
  135. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  136. lua_error(state);
  137. }
  138. break;
  139. }
  140. case 5:
  141. {
  142. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  143. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  144. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  145. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL) &&
  146. (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TNIL))
  147. {
  148. // Get parameter 1 off the stack.
  149. Vector3* param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  150. // Get parameter 2 off the stack.
  151. Rectangle* param2 = ScriptUtil::getObjectPointer<Rectangle>(3, "Rectangle", true);
  152. // Get parameter 3 off the stack.
  153. Vector2* param3 = ScriptUtil::getObjectPointer<Vector2>(4, "Vector2", true);
  154. // Get parameter 4 off the stack.
  155. Vector4* param4 = ScriptUtil::getObjectPointer<Vector4>(5, "Vector4", true);
  156. SpriteBatch* instance = getInstance(state);
  157. instance->draw(*param1, *param2, *param3, *param4);
  158. return 0;
  159. }
  160. else
  161. {
  162. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  163. lua_error(state);
  164. }
  165. break;
  166. }
  167. case 7:
  168. {
  169. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  170. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  171. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  172. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL) &&
  173. (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TNIL) &&
  174. (lua_type(state, 6) == LUA_TUSERDATA || lua_type(state, 6) == LUA_TNIL) &&
  175. lua_type(state, 7) == LUA_TNUMBER)
  176. {
  177. // Get parameter 1 off the stack.
  178. Vector3* param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  179. // Get parameter 2 off the stack.
  180. Rectangle* param2 = ScriptUtil::getObjectPointer<Rectangle>(3, "Rectangle", true);
  181. // Get parameter 3 off the stack.
  182. Vector2* param3 = ScriptUtil::getObjectPointer<Vector2>(4, "Vector2", true);
  183. // Get parameter 4 off the stack.
  184. Vector4* param4 = ScriptUtil::getObjectPointer<Vector4>(5, "Vector4", true);
  185. // Get parameter 5 off the stack.
  186. Vector2* param5 = ScriptUtil::getObjectPointer<Vector2>(6, "Vector2", true);
  187. // Get parameter 6 off the stack.
  188. float param6 = (float)luaL_checknumber(state, 7);
  189. SpriteBatch* instance = getInstance(state);
  190. instance->draw(*param1, *param2, *param3, *param4, *param5, param6);
  191. return 0;
  192. }
  193. else
  194. {
  195. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  196. lua_error(state);
  197. }
  198. break;
  199. }
  200. case 10:
  201. {
  202. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  203. lua_type(state, 2) == LUA_TNUMBER &&
  204. lua_type(state, 3) == LUA_TNUMBER &&
  205. lua_type(state, 4) == LUA_TNUMBER &&
  206. lua_type(state, 5) == LUA_TNUMBER &&
  207. lua_type(state, 6) == LUA_TNUMBER &&
  208. lua_type(state, 7) == LUA_TNUMBER &&
  209. lua_type(state, 8) == LUA_TNUMBER &&
  210. lua_type(state, 9) == LUA_TNUMBER &&
  211. (lua_type(state, 10) == LUA_TUSERDATA || lua_type(state, 10) == LUA_TNIL))
  212. {
  213. // Get parameter 1 off the stack.
  214. float param1 = (float)luaL_checknumber(state, 2);
  215. // Get parameter 2 off the stack.
  216. float param2 = (float)luaL_checknumber(state, 3);
  217. // Get parameter 3 off the stack.
  218. float param3 = (float)luaL_checknumber(state, 4);
  219. // Get parameter 4 off the stack.
  220. float param4 = (float)luaL_checknumber(state, 5);
  221. // Get parameter 5 off the stack.
  222. float param5 = (float)luaL_checknumber(state, 6);
  223. // Get parameter 6 off the stack.
  224. float param6 = (float)luaL_checknumber(state, 7);
  225. // Get parameter 7 off the stack.
  226. float param7 = (float)luaL_checknumber(state, 8);
  227. // Get parameter 8 off the stack.
  228. float param8 = (float)luaL_checknumber(state, 9);
  229. // Get parameter 9 off the stack.
  230. Vector4* param9 = ScriptUtil::getObjectPointer<Vector4>(10, "Vector4", true);
  231. SpriteBatch* instance = getInstance(state);
  232. instance->draw(param1, param2, param3, param4, param5, param6, param7, param8, *param9);
  233. return 0;
  234. }
  235. else
  236. {
  237. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  238. lua_error(state);
  239. }
  240. break;
  241. }
  242. case 11:
  243. {
  244. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  245. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  246. lua_type(state, 3) == LUA_TNUMBER &&
  247. lua_type(state, 4) == LUA_TNUMBER &&
  248. lua_type(state, 5) == LUA_TNUMBER &&
  249. lua_type(state, 6) == LUA_TNUMBER &&
  250. lua_type(state, 7) == LUA_TNUMBER &&
  251. lua_type(state, 8) == LUA_TNUMBER &&
  252. (lua_type(state, 9) == LUA_TUSERDATA || lua_type(state, 9) == LUA_TNIL) &&
  253. (lua_type(state, 10) == LUA_TUSERDATA || lua_type(state, 10) == LUA_TNIL) &&
  254. lua_type(state, 11) == LUA_TNUMBER)
  255. {
  256. // Get parameter 1 off the stack.
  257. Vector3* param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  258. // Get parameter 2 off the stack.
  259. float param2 = (float)luaL_checknumber(state, 3);
  260. // Get parameter 3 off the stack.
  261. float param3 = (float)luaL_checknumber(state, 4);
  262. // Get parameter 4 off the stack.
  263. float param4 = (float)luaL_checknumber(state, 5);
  264. // Get parameter 5 off the stack.
  265. float param5 = (float)luaL_checknumber(state, 6);
  266. // Get parameter 6 off the stack.
  267. float param6 = (float)luaL_checknumber(state, 7);
  268. // Get parameter 7 off the stack.
  269. float param7 = (float)luaL_checknumber(state, 8);
  270. // Get parameter 8 off the stack.
  271. Vector4* param8 = ScriptUtil::getObjectPointer<Vector4>(9, "Vector4", true);
  272. // Get parameter 9 off the stack.
  273. Vector2* param9 = ScriptUtil::getObjectPointer<Vector2>(10, "Vector2", true);
  274. // Get parameter 10 off the stack.
  275. float param10 = (float)luaL_checknumber(state, 11);
  276. SpriteBatch* instance = getInstance(state);
  277. instance->draw(*param1, param2, param3, param4, param5, param6, param7, *param8, *param9, param10);
  278. return 0;
  279. }
  280. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  281. lua_type(state, 2) == LUA_TNUMBER &&
  282. lua_type(state, 3) == LUA_TNUMBER &&
  283. lua_type(state, 4) == LUA_TNUMBER &&
  284. lua_type(state, 5) == LUA_TNUMBER &&
  285. lua_type(state, 6) == LUA_TNUMBER &&
  286. lua_type(state, 7) == LUA_TNUMBER &&
  287. lua_type(state, 8) == LUA_TNUMBER &&
  288. lua_type(state, 9) == LUA_TNUMBER &&
  289. (lua_type(state, 10) == LUA_TUSERDATA || lua_type(state, 10) == LUA_TNIL) &&
  290. (lua_type(state, 11) == LUA_TUSERDATA || lua_type(state, 11) == LUA_TNIL))
  291. {
  292. // Get parameter 1 off the stack.
  293. float param1 = (float)luaL_checknumber(state, 2);
  294. // Get parameter 2 off the stack.
  295. float param2 = (float)luaL_checknumber(state, 3);
  296. // Get parameter 3 off the stack.
  297. float param3 = (float)luaL_checknumber(state, 4);
  298. // Get parameter 4 off the stack.
  299. float param4 = (float)luaL_checknumber(state, 5);
  300. // Get parameter 5 off the stack.
  301. float param5 = (float)luaL_checknumber(state, 6);
  302. // Get parameter 6 off the stack.
  303. float param6 = (float)luaL_checknumber(state, 7);
  304. // Get parameter 7 off the stack.
  305. float param7 = (float)luaL_checknumber(state, 8);
  306. // Get parameter 8 off the stack.
  307. float param8 = (float)luaL_checknumber(state, 9);
  308. // Get parameter 9 off the stack.
  309. Vector4* param9 = ScriptUtil::getObjectPointer<Vector4>(10, "Vector4", true);
  310. // Get parameter 10 off the stack.
  311. Rectangle* param10 = ScriptUtil::getObjectPointer<Rectangle>(11, "Rectangle", true);
  312. SpriteBatch* instance = getInstance(state);
  313. instance->draw(param1, param2, param3, param4, param5, param6, param7, param8, *param9, *param10);
  314. return 0;
  315. }
  316. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  317. lua_type(state, 2) == LUA_TNUMBER &&
  318. lua_type(state, 3) == LUA_TNUMBER &&
  319. lua_type(state, 4) == LUA_TNUMBER &&
  320. lua_type(state, 5) == LUA_TNUMBER &&
  321. lua_type(state, 6) == LUA_TNUMBER &&
  322. lua_type(state, 7) == LUA_TNUMBER &&
  323. lua_type(state, 8) == LUA_TNUMBER &&
  324. lua_type(state, 9) == LUA_TNUMBER &&
  325. lua_type(state, 10) == LUA_TNUMBER &&
  326. (lua_type(state, 11) == LUA_TUSERDATA || lua_type(state, 11) == LUA_TNIL))
  327. {
  328. // Get parameter 1 off the stack.
  329. float param1 = (float)luaL_checknumber(state, 2);
  330. // Get parameter 2 off the stack.
  331. float param2 = (float)luaL_checknumber(state, 3);
  332. // Get parameter 3 off the stack.
  333. float param3 = (float)luaL_checknumber(state, 4);
  334. // Get parameter 4 off the stack.
  335. float param4 = (float)luaL_checknumber(state, 5);
  336. // Get parameter 5 off the stack.
  337. float param5 = (float)luaL_checknumber(state, 6);
  338. // Get parameter 6 off the stack.
  339. float param6 = (float)luaL_checknumber(state, 7);
  340. // Get parameter 7 off the stack.
  341. float param7 = (float)luaL_checknumber(state, 8);
  342. // Get parameter 8 off the stack.
  343. float param8 = (float)luaL_checknumber(state, 9);
  344. // Get parameter 9 off the stack.
  345. float param9 = (float)luaL_checknumber(state, 10);
  346. // Get parameter 10 off the stack.
  347. Vector4* param10 = ScriptUtil::getObjectPointer<Vector4>(11, "Vector4", true);
  348. SpriteBatch* instance = getInstance(state);
  349. instance->draw(param1, param2, param3, param4, param5, param6, param7, param8, param9, *param10);
  350. return 0;
  351. }
  352. else
  353. {
  354. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  355. lua_error(state);
  356. }
  357. break;
  358. }
  359. case 12:
  360. {
  361. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  362. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  363. lua_type(state, 3) == LUA_TNUMBER &&
  364. lua_type(state, 4) == LUA_TNUMBER &&
  365. lua_type(state, 5) == LUA_TNUMBER &&
  366. lua_type(state, 6) == LUA_TNUMBER &&
  367. lua_type(state, 7) == LUA_TNUMBER &&
  368. lua_type(state, 8) == LUA_TNUMBER &&
  369. (lua_type(state, 9) == LUA_TUSERDATA || lua_type(state, 9) == LUA_TNIL) &&
  370. (lua_type(state, 10) == LUA_TUSERDATA || lua_type(state, 10) == LUA_TNIL) &&
  371. lua_type(state, 11) == LUA_TNUMBER &&
  372. lua_type(state, 12) == LUA_TBOOLEAN)
  373. {
  374. // Get parameter 1 off the stack.
  375. Vector3* param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  376. // Get parameter 2 off the stack.
  377. float param2 = (float)luaL_checknumber(state, 3);
  378. // Get parameter 3 off the stack.
  379. float param3 = (float)luaL_checknumber(state, 4);
  380. // Get parameter 4 off the stack.
  381. float param4 = (float)luaL_checknumber(state, 5);
  382. // Get parameter 5 off the stack.
  383. float param5 = (float)luaL_checknumber(state, 6);
  384. // Get parameter 6 off the stack.
  385. float param6 = (float)luaL_checknumber(state, 7);
  386. // Get parameter 7 off the stack.
  387. float param7 = (float)luaL_checknumber(state, 8);
  388. // Get parameter 8 off the stack.
  389. Vector4* param8 = ScriptUtil::getObjectPointer<Vector4>(9, "Vector4", true);
  390. // Get parameter 9 off the stack.
  391. Vector2* param9 = ScriptUtil::getObjectPointer<Vector2>(10, "Vector2", true);
  392. // Get parameter 10 off the stack.
  393. float param10 = (float)luaL_checknumber(state, 11);
  394. // Get parameter 11 off the stack.
  395. bool param11 = ScriptUtil::luaCheckBool(state, 12);
  396. SpriteBatch* instance = getInstance(state);
  397. instance->draw(*param1, param2, param3, param4, param5, param6, param7, *param8, *param9, param10, param11);
  398. return 0;
  399. }
  400. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  401. lua_type(state, 2) == LUA_TNUMBER &&
  402. lua_type(state, 3) == LUA_TNUMBER &&
  403. lua_type(state, 4) == LUA_TNUMBER &&
  404. lua_type(state, 5) == LUA_TNUMBER &&
  405. lua_type(state, 6) == LUA_TNUMBER &&
  406. lua_type(state, 7) == LUA_TNUMBER &&
  407. lua_type(state, 8) == LUA_TNUMBER &&
  408. lua_type(state, 9) == LUA_TNUMBER &&
  409. lua_type(state, 10) == LUA_TNUMBER &&
  410. (lua_type(state, 11) == LUA_TUSERDATA || lua_type(state, 11) == LUA_TNIL) &&
  411. lua_type(state, 12) == LUA_TBOOLEAN)
  412. {
  413. // Get parameter 1 off the stack.
  414. float param1 = (float)luaL_checknumber(state, 2);
  415. // Get parameter 2 off the stack.
  416. float param2 = (float)luaL_checknumber(state, 3);
  417. // Get parameter 3 off the stack.
  418. float param3 = (float)luaL_checknumber(state, 4);
  419. // Get parameter 4 off the stack.
  420. float param4 = (float)luaL_checknumber(state, 5);
  421. // Get parameter 5 off the stack.
  422. float param5 = (float)luaL_checknumber(state, 6);
  423. // Get parameter 6 off the stack.
  424. float param6 = (float)luaL_checknumber(state, 7);
  425. // Get parameter 7 off the stack.
  426. float param7 = (float)luaL_checknumber(state, 8);
  427. // Get parameter 8 off the stack.
  428. float param8 = (float)luaL_checknumber(state, 9);
  429. // Get parameter 9 off the stack.
  430. float param9 = (float)luaL_checknumber(state, 10);
  431. // Get parameter 10 off the stack.
  432. Vector4* param10 = ScriptUtil::getObjectPointer<Vector4>(11, "Vector4", true);
  433. // Get parameter 11 off the stack.
  434. bool param11 = ScriptUtil::luaCheckBool(state, 12);
  435. SpriteBatch* instance = getInstance(state);
  436. instance->draw(param1, param2, param3, param4, param5, param6, param7, param8, param9, *param10, param11);
  437. return 0;
  438. }
  439. else
  440. {
  441. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  442. lua_error(state);
  443. }
  444. break;
  445. }
  446. case 13:
  447. {
  448. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  449. lua_type(state, 2) == LUA_TNUMBER &&
  450. lua_type(state, 3) == LUA_TNUMBER &&
  451. lua_type(state, 4) == LUA_TNUMBER &&
  452. lua_type(state, 5) == LUA_TNUMBER &&
  453. lua_type(state, 6) == LUA_TNUMBER &&
  454. lua_type(state, 7) == LUA_TNUMBER &&
  455. lua_type(state, 8) == LUA_TNUMBER &&
  456. lua_type(state, 9) == LUA_TNUMBER &&
  457. lua_type(state, 10) == LUA_TNUMBER &&
  458. (lua_type(state, 11) == LUA_TUSERDATA || lua_type(state, 11) == LUA_TNIL) &&
  459. (lua_type(state, 12) == LUA_TUSERDATA || lua_type(state, 12) == LUA_TNIL) &&
  460. lua_type(state, 13) == LUA_TNUMBER)
  461. {
  462. // Get parameter 1 off the stack.
  463. float param1 = (float)luaL_checknumber(state, 2);
  464. // Get parameter 2 off the stack.
  465. float param2 = (float)luaL_checknumber(state, 3);
  466. // Get parameter 3 off the stack.
  467. float param3 = (float)luaL_checknumber(state, 4);
  468. // Get parameter 4 off the stack.
  469. float param4 = (float)luaL_checknumber(state, 5);
  470. // Get parameter 5 off the stack.
  471. float param5 = (float)luaL_checknumber(state, 6);
  472. // Get parameter 6 off the stack.
  473. float param6 = (float)luaL_checknumber(state, 7);
  474. // Get parameter 7 off the stack.
  475. float param7 = (float)luaL_checknumber(state, 8);
  476. // Get parameter 8 off the stack.
  477. float param8 = (float)luaL_checknumber(state, 9);
  478. // Get parameter 9 off the stack.
  479. float param9 = (float)luaL_checknumber(state, 10);
  480. // Get parameter 10 off the stack.
  481. Vector4* param10 = ScriptUtil::getObjectPointer<Vector4>(11, "Vector4", true);
  482. // Get parameter 11 off the stack.
  483. Vector2* param11 = ScriptUtil::getObjectPointer<Vector2>(12, "Vector2", true);
  484. // Get parameter 12 off the stack.
  485. float param12 = (float)luaL_checknumber(state, 13);
  486. SpriteBatch* instance = getInstance(state);
  487. instance->draw(param1, param2, param3, param4, param5, param6, param7, param8, param9, *param10, *param11, param12);
  488. return 0;
  489. }
  490. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  491. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
  492. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
  493. (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL) &&
  494. lua_type(state, 5) == LUA_TNUMBER &&
  495. lua_type(state, 6) == LUA_TNUMBER &&
  496. lua_type(state, 7) == LUA_TNUMBER &&
  497. lua_type(state, 8) == LUA_TNUMBER &&
  498. lua_type(state, 9) == LUA_TNUMBER &&
  499. lua_type(state, 10) == LUA_TNUMBER &&
  500. (lua_type(state, 11) == LUA_TUSERDATA || lua_type(state, 11) == LUA_TNIL) &&
  501. (lua_type(state, 12) == LUA_TUSERDATA || lua_type(state, 12) == LUA_TNIL) &&
  502. lua_type(state, 13) == LUA_TNUMBER)
  503. {
  504. // Get parameter 1 off the stack.
  505. Vector3* param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
  506. // Get parameter 2 off the stack.
  507. Vector3* param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true);
  508. // Get parameter 3 off the stack.
  509. Vector3* param3 = ScriptUtil::getObjectPointer<Vector3>(4, "Vector3", true);
  510. // Get parameter 4 off the stack.
  511. float param4 = (float)luaL_checknumber(state, 5);
  512. // Get parameter 5 off the stack.
  513. float param5 = (float)luaL_checknumber(state, 6);
  514. // Get parameter 6 off the stack.
  515. float param6 = (float)luaL_checknumber(state, 7);
  516. // Get parameter 7 off the stack.
  517. float param7 = (float)luaL_checknumber(state, 8);
  518. // Get parameter 8 off the stack.
  519. float param8 = (float)luaL_checknumber(state, 9);
  520. // Get parameter 9 off the stack.
  521. float param9 = (float)luaL_checknumber(state, 10);
  522. // Get parameter 10 off the stack.
  523. Vector4* param10 = ScriptUtil::getObjectPointer<Vector4>(11, "Vector4", true);
  524. // Get parameter 11 off the stack.
  525. Vector2* param11 = ScriptUtil::getObjectPointer<Vector2>(12, "Vector2", true);
  526. // Get parameter 12 off the stack.
  527. float param12 = (float)luaL_checknumber(state, 13);
  528. SpriteBatch* instance = getInstance(state);
  529. instance->draw(*param1, *param2, *param3, param4, param5, param6, param7, param8, param9, *param10, *param11, param12);
  530. return 0;
  531. }
  532. else
  533. {
  534. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  535. lua_error(state);
  536. }
  537. break;
  538. }
  539. case 14:
  540. {
  541. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  542. lua_type(state, 2) == LUA_TNUMBER &&
  543. lua_type(state, 3) == LUA_TNUMBER &&
  544. lua_type(state, 4) == LUA_TNUMBER &&
  545. lua_type(state, 5) == LUA_TNUMBER &&
  546. lua_type(state, 6) == LUA_TNUMBER &&
  547. lua_type(state, 7) == LUA_TNUMBER &&
  548. lua_type(state, 8) == LUA_TNUMBER &&
  549. lua_type(state, 9) == LUA_TNUMBER &&
  550. lua_type(state, 10) == LUA_TNUMBER &&
  551. (lua_type(state, 11) == LUA_TUSERDATA || lua_type(state, 11) == LUA_TNIL) &&
  552. (lua_type(state, 12) == LUA_TUSERDATA || lua_type(state, 12) == LUA_TNIL) &&
  553. lua_type(state, 13) == LUA_TNUMBER &&
  554. lua_type(state, 14) == LUA_TBOOLEAN)
  555. {
  556. // Get parameter 1 off the stack.
  557. float param1 = (float)luaL_checknumber(state, 2);
  558. // Get parameter 2 off the stack.
  559. float param2 = (float)luaL_checknumber(state, 3);
  560. // Get parameter 3 off the stack.
  561. float param3 = (float)luaL_checknumber(state, 4);
  562. // Get parameter 4 off the stack.
  563. float param4 = (float)luaL_checknumber(state, 5);
  564. // Get parameter 5 off the stack.
  565. float param5 = (float)luaL_checknumber(state, 6);
  566. // Get parameter 6 off the stack.
  567. float param6 = (float)luaL_checknumber(state, 7);
  568. // Get parameter 7 off the stack.
  569. float param7 = (float)luaL_checknumber(state, 8);
  570. // Get parameter 8 off the stack.
  571. float param8 = (float)luaL_checknumber(state, 9);
  572. // Get parameter 9 off the stack.
  573. float param9 = (float)luaL_checknumber(state, 10);
  574. // Get parameter 10 off the stack.
  575. Vector4* param10 = ScriptUtil::getObjectPointer<Vector4>(11, "Vector4", true);
  576. // Get parameter 11 off the stack.
  577. Vector2* param11 = ScriptUtil::getObjectPointer<Vector2>(12, "Vector2", true);
  578. // Get parameter 12 off the stack.
  579. float param12 = (float)luaL_checknumber(state, 13);
  580. // Get parameter 13 off the stack.
  581. bool param13 = ScriptUtil::luaCheckBool(state, 14);
  582. SpriteBatch* instance = getInstance(state);
  583. instance->draw(param1, param2, param3, param4, param5, param6, param7, param8, param9, *param10, *param11, param12, param13);
  584. return 0;
  585. }
  586. else
  587. {
  588. lua_pushstring(state, "lua_SpriteBatch_draw - Failed to match the given parameters to a valid function signature.");
  589. lua_error(state);
  590. }
  591. break;
  592. }
  593. default:
  594. {
  595. lua_pushstring(state, "Invalid number of parameters (expected 3, 4, 5, 7, 10, 11, 12, 13 or 14).");
  596. lua_error(state);
  597. break;
  598. }
  599. }
  600. return 0;
  601. }
  602. int lua_SpriteBatch_finish(lua_State* state)
  603. {
  604. // Get the number of parameters.
  605. int paramCount = lua_gettop(state);
  606. // Attempt to match the parameters to a valid binding.
  607. switch (paramCount)
  608. {
  609. case 1:
  610. {
  611. if ((lua_type(state, 1) == LUA_TUSERDATA))
  612. {
  613. SpriteBatch* instance = getInstance(state);
  614. instance->finish();
  615. return 0;
  616. }
  617. else
  618. {
  619. lua_pushstring(state, "lua_SpriteBatch_finish - Failed to match the given parameters to a valid function signature.");
  620. lua_error(state);
  621. }
  622. break;
  623. }
  624. default:
  625. {
  626. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  627. lua_error(state);
  628. break;
  629. }
  630. }
  631. return 0;
  632. }
  633. int lua_SpriteBatch_getMaterial(lua_State* state)
  634. {
  635. // Get the number of parameters.
  636. int paramCount = lua_gettop(state);
  637. // Attempt to match the parameters to a valid binding.
  638. switch (paramCount)
  639. {
  640. case 1:
  641. {
  642. if ((lua_type(state, 1) == LUA_TUSERDATA))
  643. {
  644. SpriteBatch* instance = getInstance(state);
  645. void* returnPtr = (void*)instance->getMaterial();
  646. if (returnPtr)
  647. {
  648. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  649. object->instance = returnPtr;
  650. object->owns = false;
  651. luaL_getmetatable(state, "Material");
  652. lua_setmetatable(state, -2);
  653. }
  654. else
  655. {
  656. lua_pushnil(state);
  657. }
  658. return 1;
  659. }
  660. else
  661. {
  662. lua_pushstring(state, "lua_SpriteBatch_getMaterial - Failed to match the given parameters to a valid function signature.");
  663. lua_error(state);
  664. }
  665. break;
  666. }
  667. default:
  668. {
  669. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  670. lua_error(state);
  671. break;
  672. }
  673. }
  674. return 0;
  675. }
  676. int lua_SpriteBatch_getProjectionMatrix(lua_State* state)
  677. {
  678. // Get the number of parameters.
  679. int paramCount = lua_gettop(state);
  680. // Attempt to match the parameters to a valid binding.
  681. switch (paramCount)
  682. {
  683. case 1:
  684. {
  685. if ((lua_type(state, 1) == LUA_TUSERDATA))
  686. {
  687. SpriteBatch* instance = getInstance(state);
  688. void* returnPtr = (void*)&(instance->getProjectionMatrix());
  689. if (returnPtr)
  690. {
  691. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  692. object->instance = returnPtr;
  693. object->owns = false;
  694. luaL_getmetatable(state, "Matrix");
  695. lua_setmetatable(state, -2);
  696. }
  697. else
  698. {
  699. lua_pushnil(state);
  700. }
  701. return 1;
  702. }
  703. else
  704. {
  705. lua_pushstring(state, "lua_SpriteBatch_getProjectionMatrix - Failed to match the given parameters to a valid function signature.");
  706. lua_error(state);
  707. }
  708. break;
  709. }
  710. default:
  711. {
  712. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  713. lua_error(state);
  714. break;
  715. }
  716. }
  717. return 0;
  718. }
  719. int lua_SpriteBatch_getStateBlock(lua_State* state)
  720. {
  721. // Get the number of parameters.
  722. int paramCount = lua_gettop(state);
  723. // Attempt to match the parameters to a valid binding.
  724. switch (paramCount)
  725. {
  726. case 1:
  727. {
  728. if ((lua_type(state, 1) == LUA_TUSERDATA))
  729. {
  730. SpriteBatch* instance = getInstance(state);
  731. void* returnPtr = (void*)instance->getStateBlock();
  732. if (returnPtr)
  733. {
  734. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  735. object->instance = returnPtr;
  736. object->owns = false;
  737. luaL_getmetatable(state, "RenderStateStateBlock");
  738. lua_setmetatable(state, -2);
  739. }
  740. else
  741. {
  742. lua_pushnil(state);
  743. }
  744. return 1;
  745. }
  746. else
  747. {
  748. lua_pushstring(state, "lua_SpriteBatch_getStateBlock - Failed to match the given parameters to a valid function signature.");
  749. lua_error(state);
  750. }
  751. break;
  752. }
  753. default:
  754. {
  755. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  756. lua_error(state);
  757. break;
  758. }
  759. }
  760. return 0;
  761. }
  762. int lua_SpriteBatch_setProjectionMatrix(lua_State* state)
  763. {
  764. // Get the number of parameters.
  765. int paramCount = lua_gettop(state);
  766. // Attempt to match the parameters to a valid binding.
  767. switch (paramCount)
  768. {
  769. case 2:
  770. {
  771. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  772. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
  773. {
  774. // Get parameter 1 off the stack.
  775. Matrix* param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
  776. SpriteBatch* instance = getInstance(state);
  777. instance->setProjectionMatrix(*param1);
  778. return 0;
  779. }
  780. else
  781. {
  782. lua_pushstring(state, "lua_SpriteBatch_setProjectionMatrix - Failed to match the given parameters to a valid function signature.");
  783. lua_error(state);
  784. }
  785. break;
  786. }
  787. default:
  788. {
  789. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  790. lua_error(state);
  791. break;
  792. }
  793. }
  794. return 0;
  795. }
  796. int lua_SpriteBatch_start(lua_State* state)
  797. {
  798. // Get the number of parameters.
  799. int paramCount = lua_gettop(state);
  800. // Attempt to match the parameters to a valid binding.
  801. switch (paramCount)
  802. {
  803. case 1:
  804. {
  805. if ((lua_type(state, 1) == LUA_TUSERDATA))
  806. {
  807. SpriteBatch* instance = getInstance(state);
  808. instance->start();
  809. return 0;
  810. }
  811. else
  812. {
  813. lua_pushstring(state, "lua_SpriteBatch_start - Failed to match the given parameters to a valid function signature.");
  814. lua_error(state);
  815. }
  816. break;
  817. }
  818. default:
  819. {
  820. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  821. lua_error(state);
  822. break;
  823. }
  824. }
  825. return 0;
  826. }
  827. int lua_SpriteBatch_static_create(lua_State* state)
  828. {
  829. // Get the number of parameters.
  830. int paramCount = lua_gettop(state);
  831. // Attempt to match the parameters to a valid binding.
  832. switch (paramCount)
  833. {
  834. case 1:
  835. {
  836. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  837. {
  838. // Get parameter 1 off the stack.
  839. const char* param1 = ScriptUtil::getString(1, false);
  840. void* returnPtr = (void*)SpriteBatch::create(param1);
  841. if (returnPtr)
  842. {
  843. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  844. object->instance = returnPtr;
  845. object->owns = true;
  846. luaL_getmetatable(state, "SpriteBatch");
  847. lua_setmetatable(state, -2);
  848. }
  849. else
  850. {
  851. lua_pushnil(state);
  852. }
  853. return 1;
  854. }
  855. else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
  856. {
  857. // Get parameter 1 off the stack.
  858. Texture* param1 = ScriptUtil::getObjectPointer<Texture>(1, "Texture", false);
  859. void* returnPtr = (void*)SpriteBatch::create(param1);
  860. if (returnPtr)
  861. {
  862. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  863. object->instance = returnPtr;
  864. object->owns = true;
  865. luaL_getmetatable(state, "SpriteBatch");
  866. lua_setmetatable(state, -2);
  867. }
  868. else
  869. {
  870. lua_pushnil(state);
  871. }
  872. return 1;
  873. }
  874. else
  875. {
  876. lua_pushstring(state, "lua_SpriteBatch_static_create - Failed to match the given parameters to a valid function signature.");
  877. lua_error(state);
  878. }
  879. break;
  880. }
  881. case 2:
  882. {
  883. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
  884. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  885. {
  886. // Get parameter 1 off the stack.
  887. const char* param1 = ScriptUtil::getString(1, false);
  888. // Get parameter 2 off the stack.
  889. Effect* param2 = ScriptUtil::getObjectPointer<Effect>(2, "Effect", false);
  890. void* returnPtr = (void*)SpriteBatch::create(param1, param2);
  891. if (returnPtr)
  892. {
  893. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  894. object->instance = returnPtr;
  895. object->owns = true;
  896. luaL_getmetatable(state, "SpriteBatch");
  897. lua_setmetatable(state, -2);
  898. }
  899. else
  900. {
  901. lua_pushnil(state);
  902. }
  903. return 1;
  904. }
  905. else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL) &&
  906. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  907. {
  908. // Get parameter 1 off the stack.
  909. Texture* param1 = ScriptUtil::getObjectPointer<Texture>(1, "Texture", false);
  910. // Get parameter 2 off the stack.
  911. Effect* param2 = ScriptUtil::getObjectPointer<Effect>(2, "Effect", false);
  912. void* returnPtr = (void*)SpriteBatch::create(param1, param2);
  913. if (returnPtr)
  914. {
  915. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  916. object->instance = returnPtr;
  917. object->owns = true;
  918. luaL_getmetatable(state, "SpriteBatch");
  919. lua_setmetatable(state, -2);
  920. }
  921. else
  922. {
  923. lua_pushnil(state);
  924. }
  925. return 1;
  926. }
  927. else
  928. {
  929. lua_pushstring(state, "lua_SpriteBatch_static_create - Failed to match the given parameters to a valid function signature.");
  930. lua_error(state);
  931. }
  932. break;
  933. }
  934. case 3:
  935. {
  936. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
  937. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  938. lua_type(state, 3) == LUA_TNUMBER)
  939. {
  940. // Get parameter 1 off the stack.
  941. const char* param1 = ScriptUtil::getString(1, false);
  942. // Get parameter 2 off the stack.
  943. Effect* param2 = ScriptUtil::getObjectPointer<Effect>(2, "Effect", false);
  944. // Get parameter 3 off the stack.
  945. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 3);
  946. void* returnPtr = (void*)SpriteBatch::create(param1, param2, param3);
  947. if (returnPtr)
  948. {
  949. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  950. object->instance = returnPtr;
  951. object->owns = true;
  952. luaL_getmetatable(state, "SpriteBatch");
  953. lua_setmetatable(state, -2);
  954. }
  955. else
  956. {
  957. lua_pushnil(state);
  958. }
  959. return 1;
  960. }
  961. else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL) &&
  962. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  963. lua_type(state, 3) == LUA_TNUMBER)
  964. {
  965. // Get parameter 1 off the stack.
  966. Texture* param1 = ScriptUtil::getObjectPointer<Texture>(1, "Texture", false);
  967. // Get parameter 2 off the stack.
  968. Effect* param2 = ScriptUtil::getObjectPointer<Effect>(2, "Effect", false);
  969. // Get parameter 3 off the stack.
  970. unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 3);
  971. void* returnPtr = (void*)SpriteBatch::create(param1, param2, param3);
  972. if (returnPtr)
  973. {
  974. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  975. object->instance = returnPtr;
  976. object->owns = true;
  977. luaL_getmetatable(state, "SpriteBatch");
  978. lua_setmetatable(state, -2);
  979. }
  980. else
  981. {
  982. lua_pushnil(state);
  983. }
  984. return 1;
  985. }
  986. else
  987. {
  988. lua_pushstring(state, "lua_SpriteBatch_static_create - Failed to match the given parameters to a valid function signature.");
  989. lua_error(state);
  990. }
  991. break;
  992. }
  993. default:
  994. {
  995. lua_pushstring(state, "Invalid number of parameters (expected 1, 2 or 3).");
  996. lua_error(state);
  997. break;
  998. }
  999. }
  1000. return 0;
  1001. }
  1002. }