lua_Animation.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. // Autogenerated by gameplay-luagen
  2. #include "Base.h"
  3. #include "ScriptController.h"
  4. #include "lua_Animation.h"
  5. #include "Animation.h"
  6. #include "AnimationClip.h"
  7. #include "AnimationController.h"
  8. #include "AnimationTarget.h"
  9. #include "Base.h"
  10. #include "Game.h"
  11. #include "Properties.h"
  12. #include "Ref.h"
  13. #include "Transform.h"
  14. namespace gameplay
  15. {
  16. void luaRegister_Animation()
  17. {
  18. const luaL_Reg lua_members[] =
  19. {
  20. {"addRef", lua_Animation_addRef},
  21. {"createClip", lua_Animation_createClip},
  22. {"createClips", lua_Animation_createClips},
  23. {"getClip", lua_Animation_getClip},
  24. {"getClipCount", lua_Animation_getClipCount},
  25. {"getDuration", lua_Animation_getDuration},
  26. {"getId", lua_Animation_getId},
  27. {"getRefCount", lua_Animation_getRefCount},
  28. {"pause", lua_Animation_pause},
  29. {"play", lua_Animation_play},
  30. {"release", lua_Animation_release},
  31. {"stop", lua_Animation_stop},
  32. {"targets", lua_Animation_targets},
  33. {NULL, NULL}
  34. };
  35. const luaL_Reg* lua_statics = NULL;
  36. std::vector<std::string> scopePath;
  37. gameplay::ScriptUtil::registerClass("Animation", lua_members, NULL, lua_Animation__gc, lua_statics, scopePath);
  38. }
  39. static Animation* getInstance(lua_State* state)
  40. {
  41. void* userdata = luaL_checkudata(state, 1, "Animation");
  42. luaL_argcheck(state, userdata != NULL, 1, "'Animation' expected.");
  43. return (Animation*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  44. }
  45. int lua_Animation__gc(lua_State* state)
  46. {
  47. // Get the number of parameters.
  48. int paramCount = lua_gettop(state);
  49. // Attempt to match the parameters to a valid binding.
  50. switch (paramCount)
  51. {
  52. case 1:
  53. {
  54. if ((lua_type(state, 1) == LUA_TUSERDATA))
  55. {
  56. void* userdata = luaL_checkudata(state, 1, "Animation");
  57. luaL_argcheck(state, userdata != NULL, 1, "'Animation' expected.");
  58. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
  59. if (object->owns)
  60. {
  61. Animation* instance = (Animation*)object->instance;
  62. SAFE_RELEASE(instance);
  63. }
  64. return 0;
  65. }
  66. lua_pushstring(state, "lua_Animation__gc - Failed to match the given parameters to a valid function signature.");
  67. lua_error(state);
  68. break;
  69. }
  70. default:
  71. {
  72. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  73. lua_error(state);
  74. break;
  75. }
  76. }
  77. return 0;
  78. }
  79. int lua_Animation_addRef(lua_State* state)
  80. {
  81. // Get the number of parameters.
  82. int paramCount = lua_gettop(state);
  83. // Attempt to match the parameters to a valid binding.
  84. switch (paramCount)
  85. {
  86. case 1:
  87. {
  88. if ((lua_type(state, 1) == LUA_TUSERDATA))
  89. {
  90. Animation* instance = getInstance(state);
  91. instance->addRef();
  92. return 0;
  93. }
  94. lua_pushstring(state, "lua_Animation_addRef - Failed to match the given parameters to a valid function signature.");
  95. lua_error(state);
  96. break;
  97. }
  98. default:
  99. {
  100. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  101. lua_error(state);
  102. break;
  103. }
  104. }
  105. return 0;
  106. }
  107. int lua_Animation_createClip(lua_State* state)
  108. {
  109. // Get the number of parameters.
  110. int paramCount = lua_gettop(state);
  111. // Attempt to match the parameters to a valid binding.
  112. switch (paramCount)
  113. {
  114. case 4:
  115. {
  116. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  117. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  118. lua_type(state, 3) == LUA_TNUMBER &&
  119. lua_type(state, 4) == LUA_TNUMBER)
  120. {
  121. // Get parameter 1 off the stack.
  122. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  123. // Get parameter 2 off the stack.
  124. unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
  125. // Get parameter 3 off the stack.
  126. unsigned long param3 = (unsigned long)luaL_checkunsigned(state, 4);
  127. Animation* instance = getInstance(state);
  128. void* returnPtr = ((void*)instance->createClip(param1, param2, param3));
  129. if (returnPtr)
  130. {
  131. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  132. object->instance = returnPtr;
  133. object->owns = true;
  134. luaL_getmetatable(state, "AnimationClip");
  135. lua_setmetatable(state, -2);
  136. }
  137. else
  138. {
  139. lua_pushnil(state);
  140. }
  141. return 1;
  142. }
  143. lua_pushstring(state, "lua_Animation_createClip - Failed to match the given parameters to a valid function signature.");
  144. lua_error(state);
  145. break;
  146. }
  147. default:
  148. {
  149. lua_pushstring(state, "Invalid number of parameters (expected 4).");
  150. lua_error(state);
  151. break;
  152. }
  153. }
  154. return 0;
  155. }
  156. int lua_Animation_createClips(lua_State* state)
  157. {
  158. // Get the number of parameters.
  159. int paramCount = lua_gettop(state);
  160. // Attempt to match the parameters to a valid binding.
  161. switch (paramCount)
  162. {
  163. case 2:
  164. {
  165. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  166. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  167. {
  168. // Get parameter 1 off the stack.
  169. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  170. Animation* instance = getInstance(state);
  171. instance->createClips(param1);
  172. return 0;
  173. }
  174. lua_pushstring(state, "lua_Animation_createClips - Failed to match the given parameters to a valid function signature.");
  175. lua_error(state);
  176. break;
  177. }
  178. default:
  179. {
  180. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  181. lua_error(state);
  182. break;
  183. }
  184. }
  185. return 0;
  186. }
  187. int lua_Animation_getClip(lua_State* state)
  188. {
  189. // Get the number of parameters.
  190. int paramCount = lua_gettop(state);
  191. // Attempt to match the parameters to a valid binding.
  192. switch (paramCount)
  193. {
  194. case 1:
  195. {
  196. do
  197. {
  198. if ((lua_type(state, 1) == LUA_TUSERDATA))
  199. {
  200. Animation* instance = getInstance(state);
  201. void* returnPtr = ((void*)instance->getClip());
  202. if (returnPtr)
  203. {
  204. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  205. object->instance = returnPtr;
  206. object->owns = false;
  207. luaL_getmetatable(state, "AnimationClip");
  208. lua_setmetatable(state, -2);
  209. }
  210. else
  211. {
  212. lua_pushnil(state);
  213. }
  214. return 1;
  215. }
  216. } while (0);
  217. lua_pushstring(state, "lua_Animation_getClip - Failed to match the given parameters to a valid function signature.");
  218. lua_error(state);
  219. break;
  220. }
  221. case 2:
  222. {
  223. do
  224. {
  225. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  226. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  227. {
  228. // Get parameter 1 off the stack.
  229. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  230. Animation* instance = getInstance(state);
  231. void* returnPtr = ((void*)instance->getClip(param1));
  232. if (returnPtr)
  233. {
  234. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  235. object->instance = returnPtr;
  236. object->owns = false;
  237. luaL_getmetatable(state, "AnimationClip");
  238. lua_setmetatable(state, -2);
  239. }
  240. else
  241. {
  242. lua_pushnil(state);
  243. }
  244. return 1;
  245. }
  246. } while (0);
  247. do
  248. {
  249. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  250. lua_type(state, 2) == LUA_TNUMBER)
  251. {
  252. // Get parameter 1 off the stack.
  253. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  254. Animation* instance = getInstance(state);
  255. void* returnPtr = ((void*)instance->getClip(param1));
  256. if (returnPtr)
  257. {
  258. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  259. object->instance = returnPtr;
  260. object->owns = false;
  261. luaL_getmetatable(state, "AnimationClip");
  262. lua_setmetatable(state, -2);
  263. }
  264. else
  265. {
  266. lua_pushnil(state);
  267. }
  268. return 1;
  269. }
  270. } while (0);
  271. lua_pushstring(state, "lua_Animation_getClip - Failed to match the given parameters to a valid function signature.");
  272. lua_error(state);
  273. break;
  274. }
  275. default:
  276. {
  277. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  278. lua_error(state);
  279. break;
  280. }
  281. }
  282. return 0;
  283. }
  284. int lua_Animation_getClipCount(lua_State* state)
  285. {
  286. // Get the number of parameters.
  287. int paramCount = lua_gettop(state);
  288. // Attempt to match the parameters to a valid binding.
  289. switch (paramCount)
  290. {
  291. case 1:
  292. {
  293. if ((lua_type(state, 1) == LUA_TUSERDATA))
  294. {
  295. Animation* instance = getInstance(state);
  296. unsigned int result = instance->getClipCount();
  297. // Push the return value onto the stack.
  298. lua_pushunsigned(state, result);
  299. return 1;
  300. }
  301. lua_pushstring(state, "lua_Animation_getClipCount - Failed to match the given parameters to a valid function signature.");
  302. lua_error(state);
  303. break;
  304. }
  305. default:
  306. {
  307. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  308. lua_error(state);
  309. break;
  310. }
  311. }
  312. return 0;
  313. }
  314. int lua_Animation_getDuration(lua_State* state)
  315. {
  316. // Get the number of parameters.
  317. int paramCount = lua_gettop(state);
  318. // Attempt to match the parameters to a valid binding.
  319. switch (paramCount)
  320. {
  321. case 1:
  322. {
  323. if ((lua_type(state, 1) == LUA_TUSERDATA))
  324. {
  325. Animation* instance = getInstance(state);
  326. unsigned long result = instance->getDuration();
  327. // Push the return value onto the stack.
  328. lua_pushunsigned(state, result);
  329. return 1;
  330. }
  331. lua_pushstring(state, "lua_Animation_getDuration - Failed to match the given parameters to a valid function signature.");
  332. lua_error(state);
  333. break;
  334. }
  335. default:
  336. {
  337. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  338. lua_error(state);
  339. break;
  340. }
  341. }
  342. return 0;
  343. }
  344. int lua_Animation_getId(lua_State* state)
  345. {
  346. // Get the number of parameters.
  347. int paramCount = lua_gettop(state);
  348. // Attempt to match the parameters to a valid binding.
  349. switch (paramCount)
  350. {
  351. case 1:
  352. {
  353. if ((lua_type(state, 1) == LUA_TUSERDATA))
  354. {
  355. Animation* instance = getInstance(state);
  356. const char* result = instance->getId();
  357. // Push the return value onto the stack.
  358. lua_pushstring(state, result);
  359. return 1;
  360. }
  361. lua_pushstring(state, "lua_Animation_getId - Failed to match the given parameters to a valid function signature.");
  362. lua_error(state);
  363. break;
  364. }
  365. default:
  366. {
  367. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  368. lua_error(state);
  369. break;
  370. }
  371. }
  372. return 0;
  373. }
  374. int lua_Animation_getRefCount(lua_State* state)
  375. {
  376. // Get the number of parameters.
  377. int paramCount = lua_gettop(state);
  378. // Attempt to match the parameters to a valid binding.
  379. switch (paramCount)
  380. {
  381. case 1:
  382. {
  383. if ((lua_type(state, 1) == LUA_TUSERDATA))
  384. {
  385. Animation* instance = getInstance(state);
  386. unsigned int result = instance->getRefCount();
  387. // Push the return value onto the stack.
  388. lua_pushunsigned(state, result);
  389. return 1;
  390. }
  391. lua_pushstring(state, "lua_Animation_getRefCount - Failed to match the given parameters to a valid function signature.");
  392. lua_error(state);
  393. break;
  394. }
  395. default:
  396. {
  397. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  398. lua_error(state);
  399. break;
  400. }
  401. }
  402. return 0;
  403. }
  404. int lua_Animation_pause(lua_State* state)
  405. {
  406. // Get the number of parameters.
  407. int paramCount = lua_gettop(state);
  408. // Attempt to match the parameters to a valid binding.
  409. switch (paramCount)
  410. {
  411. case 1:
  412. {
  413. if ((lua_type(state, 1) == LUA_TUSERDATA))
  414. {
  415. Animation* instance = getInstance(state);
  416. instance->pause();
  417. return 0;
  418. }
  419. lua_pushstring(state, "lua_Animation_pause - Failed to match the given parameters to a valid function signature.");
  420. lua_error(state);
  421. break;
  422. }
  423. case 2:
  424. {
  425. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  426. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  427. {
  428. // Get parameter 1 off the stack.
  429. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  430. Animation* instance = getInstance(state);
  431. instance->pause(param1);
  432. return 0;
  433. }
  434. lua_pushstring(state, "lua_Animation_pause - Failed to match the given parameters to a valid function signature.");
  435. lua_error(state);
  436. break;
  437. }
  438. default:
  439. {
  440. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  441. lua_error(state);
  442. break;
  443. }
  444. }
  445. return 0;
  446. }
  447. int lua_Animation_play(lua_State* state)
  448. {
  449. // Get the number of parameters.
  450. int paramCount = lua_gettop(state);
  451. // Attempt to match the parameters to a valid binding.
  452. switch (paramCount)
  453. {
  454. case 1:
  455. {
  456. if ((lua_type(state, 1) == LUA_TUSERDATA))
  457. {
  458. Animation* instance = getInstance(state);
  459. instance->play();
  460. return 0;
  461. }
  462. lua_pushstring(state, "lua_Animation_play - Failed to match the given parameters to a valid function signature.");
  463. lua_error(state);
  464. break;
  465. }
  466. case 2:
  467. {
  468. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  469. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  470. {
  471. // Get parameter 1 off the stack.
  472. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  473. Animation* instance = getInstance(state);
  474. instance->play(param1);
  475. return 0;
  476. }
  477. lua_pushstring(state, "lua_Animation_play - Failed to match the given parameters to a valid function signature.");
  478. lua_error(state);
  479. break;
  480. }
  481. default:
  482. {
  483. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  484. lua_error(state);
  485. break;
  486. }
  487. }
  488. return 0;
  489. }
  490. int lua_Animation_release(lua_State* state)
  491. {
  492. // Get the number of parameters.
  493. int paramCount = lua_gettop(state);
  494. // Attempt to match the parameters to a valid binding.
  495. switch (paramCount)
  496. {
  497. case 1:
  498. {
  499. if ((lua_type(state, 1) == LUA_TUSERDATA))
  500. {
  501. Animation* instance = getInstance(state);
  502. instance->release();
  503. return 0;
  504. }
  505. lua_pushstring(state, "lua_Animation_release - Failed to match the given parameters to a valid function signature.");
  506. lua_error(state);
  507. break;
  508. }
  509. default:
  510. {
  511. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  512. lua_error(state);
  513. break;
  514. }
  515. }
  516. return 0;
  517. }
  518. int lua_Animation_stop(lua_State* state)
  519. {
  520. // Get the number of parameters.
  521. int paramCount = lua_gettop(state);
  522. // Attempt to match the parameters to a valid binding.
  523. switch (paramCount)
  524. {
  525. case 1:
  526. {
  527. if ((lua_type(state, 1) == LUA_TUSERDATA))
  528. {
  529. Animation* instance = getInstance(state);
  530. instance->stop();
  531. return 0;
  532. }
  533. lua_pushstring(state, "lua_Animation_stop - Failed to match the given parameters to a valid function signature.");
  534. lua_error(state);
  535. break;
  536. }
  537. case 2:
  538. {
  539. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  540. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  541. {
  542. // Get parameter 1 off the stack.
  543. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  544. Animation* instance = getInstance(state);
  545. instance->stop(param1);
  546. return 0;
  547. }
  548. lua_pushstring(state, "lua_Animation_stop - Failed to match the given parameters to a valid function signature.");
  549. lua_error(state);
  550. break;
  551. }
  552. default:
  553. {
  554. lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
  555. lua_error(state);
  556. break;
  557. }
  558. }
  559. return 0;
  560. }
  561. int lua_Animation_targets(lua_State* state)
  562. {
  563. // Get the number of parameters.
  564. int paramCount = lua_gettop(state);
  565. // Attempt to match the parameters to a valid binding.
  566. switch (paramCount)
  567. {
  568. case 2:
  569. {
  570. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  571. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  572. {
  573. // Get parameter 1 off the stack.
  574. bool param1Valid;
  575. gameplay::ScriptUtil::LuaArray<AnimationTarget> param1 = gameplay::ScriptUtil::getObjectPointer<AnimationTarget>(2, "AnimationTarget", false, &param1Valid);
  576. if (!param1Valid)
  577. {
  578. lua_pushstring(state, "Failed to convert parameter 1 to type 'AnimationTarget'.");
  579. lua_error(state);
  580. }
  581. Animation* instance = getInstance(state);
  582. bool result = instance->targets(param1);
  583. // Push the return value onto the stack.
  584. lua_pushboolean(state, result);
  585. return 1;
  586. }
  587. lua_pushstring(state, "lua_Animation_targets - Failed to match the given parameters to a valid function signature.");
  588. lua_error(state);
  589. break;
  590. }
  591. default:
  592. {
  593. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  594. lua_error(state);
  595. break;
  596. }
  597. }
  598. return 0;
  599. }
  600. }