Event.cpp 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. // Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. // WARNING: The file is auto generated.
  6. #include <anki/script/LuaBinder.h>
  7. #include <anki/script/ScriptManager.h>
  8. #include <anki/scene/SceneGraph.h>
  9. #include <anki/Event.h>
  10. namespace anki
  11. {
  12. //==============================================================================
  13. static EventManager* getEventManager(lua_State* l)
  14. {
  15. LuaBinder* binder = nullptr;
  16. lua_getallocf(l, reinterpret_cast<void**>(&binder));
  17. ScriptManager* scriptManager =
  18. reinterpret_cast<ScriptManager*>(binder->getParent());
  19. return &scriptManager->_getSceneGraph().getEventManager();
  20. }
  21. //==============================================================================
  22. // LightEvent =
  23. //==============================================================================
  24. //==============================================================================
  25. static const char* classnameLightEvent = "LightEvent";
  26. template<>
  27. I64 LuaBinder::getWrappedTypeSignature<LightEvent>()
  28. {
  29. return 840634010629725278;
  30. }
  31. template<>
  32. const char* LuaBinder::getWrappedTypeName<LightEvent>()
  33. {
  34. return classnameLightEvent;
  35. }
  36. //==============================================================================
  37. /// Pre-wrap method LightEvent::setIntensityMultiplier.
  38. static inline int pwrapLightEventsetIntensityMultiplier(lua_State* l)
  39. {
  40. UserData* ud;
  41. (void)ud;
  42. void* voidp;
  43. (void)voidp;
  44. PtrSize size;
  45. (void)size;
  46. LuaBinder::checkArgsCount(l, 2);
  47. // Get "this" as "self"
  48. if(LuaBinder::checkUserData(
  49. l, 1, classnameLightEvent, 840634010629725278, ud))
  50. {
  51. return -1;
  52. }
  53. LightEvent* self = ud->getData<LightEvent>();
  54. // Pop arguments
  55. if(LuaBinder::checkUserData(l, 2, "Vec4", 6804478823655046386, ud))
  56. {
  57. return -1;
  58. }
  59. Vec4* iarg0 = ud->getData<Vec4>();
  60. const Vec4& arg0(*iarg0);
  61. // Call the method
  62. self->setIntensityMultiplier(arg0);
  63. return 0;
  64. }
  65. //==============================================================================
  66. /// Wrap method LightEvent::setIntensityMultiplier.
  67. static int wrapLightEventsetIntensityMultiplier(lua_State* l)
  68. {
  69. int res = pwrapLightEventsetIntensityMultiplier(l);
  70. if(res >= 0)
  71. {
  72. return res;
  73. }
  74. lua_error(l);
  75. return 0;
  76. }
  77. //==============================================================================
  78. /// Pre-wrap method LightEvent::setFrequency.
  79. static inline int pwrapLightEventsetFrequency(lua_State* l)
  80. {
  81. UserData* ud;
  82. (void)ud;
  83. void* voidp;
  84. (void)voidp;
  85. PtrSize size;
  86. (void)size;
  87. LuaBinder::checkArgsCount(l, 3);
  88. // Get "this" as "self"
  89. if(LuaBinder::checkUserData(
  90. l, 1, classnameLightEvent, 840634010629725278, ud))
  91. {
  92. return -1;
  93. }
  94. LightEvent* self = ud->getData<LightEvent>();
  95. // Pop arguments
  96. F32 arg0;
  97. if(LuaBinder::checkNumber(l, 2, arg0))
  98. {
  99. return -1;
  100. }
  101. F32 arg1;
  102. if(LuaBinder::checkNumber(l, 3, arg1))
  103. {
  104. return -1;
  105. }
  106. // Call the method
  107. self->setFrequency(arg0, arg1);
  108. return 0;
  109. }
  110. //==============================================================================
  111. /// Wrap method LightEvent::setFrequency.
  112. static int wrapLightEventsetFrequency(lua_State* l)
  113. {
  114. int res = pwrapLightEventsetFrequency(l);
  115. if(res >= 0)
  116. {
  117. return res;
  118. }
  119. lua_error(l);
  120. return 0;
  121. }
  122. //==============================================================================
  123. /// Wrap class LightEvent.
  124. static inline void wrapLightEvent(lua_State* l)
  125. {
  126. LuaBinder::createClass(l, classnameLightEvent);
  127. LuaBinder::pushLuaCFuncMethod(
  128. l, "setIntensityMultiplier", wrapLightEventsetIntensityMultiplier);
  129. LuaBinder::pushLuaCFuncMethod(
  130. l, "setFrequency", wrapLightEventsetFrequency);
  131. lua_settop(l, 0);
  132. }
  133. //==============================================================================
  134. // EventManager =
  135. //==============================================================================
  136. //==============================================================================
  137. static const char* classnameEventManager = "EventManager";
  138. template<>
  139. I64 LuaBinder::getWrappedTypeSignature<EventManager>()
  140. {
  141. return -6959305329499243407;
  142. }
  143. template<>
  144. const char* LuaBinder::getWrappedTypeName<EventManager>()
  145. {
  146. return classnameEventManager;
  147. }
  148. //==============================================================================
  149. /// Pre-wrap method EventManager::newLightEvent.
  150. static inline int pwrapEventManagernewLightEvent(lua_State* l)
  151. {
  152. UserData* ud;
  153. (void)ud;
  154. void* voidp;
  155. (void)voidp;
  156. PtrSize size;
  157. (void)size;
  158. LuaBinder::checkArgsCount(l, 4);
  159. // Get "this" as "self"
  160. if(LuaBinder::checkUserData(
  161. l, 1, classnameEventManager, -6959305329499243407, ud))
  162. {
  163. return -1;
  164. }
  165. EventManager* self = ud->getData<EventManager>();
  166. // Pop arguments
  167. F32 arg0;
  168. if(LuaBinder::checkNumber(l, 2, arg0))
  169. {
  170. return -1;
  171. }
  172. F32 arg1;
  173. if(LuaBinder::checkNumber(l, 3, arg1))
  174. {
  175. return -1;
  176. }
  177. if(LuaBinder::checkUserData(l, 4, "SceneNode", -2220074417980276571, ud))
  178. {
  179. return -1;
  180. }
  181. SceneNode* iarg2 = ud->getData<SceneNode>();
  182. SceneNode* arg2(iarg2);
  183. // Call the method
  184. LightEvent* ret = self->newEvent<LightEvent>(arg0, arg1, arg2);
  185. // Push return value
  186. if(ANKI_UNLIKELY(ret == nullptr))
  187. {
  188. lua_pushstring(l, "Glue code returned nullptr");
  189. return -1;
  190. }
  191. voidp = lua_newuserdata(l, sizeof(UserData));
  192. ud = static_cast<UserData*>(voidp);
  193. luaL_setmetatable(l, "LightEvent");
  194. ud->initPointed(840634010629725278, const_cast<LightEvent*>(ret));
  195. return 1;
  196. }
  197. //==============================================================================
  198. /// Wrap method EventManager::newLightEvent.
  199. static int wrapEventManagernewLightEvent(lua_State* l)
  200. {
  201. int res = pwrapEventManagernewLightEvent(l);
  202. if(res >= 0)
  203. {
  204. return res;
  205. }
  206. lua_error(l);
  207. return 0;
  208. }
  209. //==============================================================================
  210. /// Wrap class EventManager.
  211. static inline void wrapEventManager(lua_State* l)
  212. {
  213. LuaBinder::createClass(l, classnameEventManager);
  214. LuaBinder::pushLuaCFuncMethod(
  215. l, "newLightEvent", wrapEventManagernewLightEvent);
  216. lua_settop(l, 0);
  217. }
  218. //==============================================================================
  219. /// Pre-wrap function getEventManager.
  220. static inline int pwrapgetEventManager(lua_State* l)
  221. {
  222. UserData* ud;
  223. (void)ud;
  224. void* voidp;
  225. (void)voidp;
  226. PtrSize size;
  227. (void)size;
  228. LuaBinder::checkArgsCount(l, 0);
  229. // Call the function
  230. EventManager* ret = getEventManager(l);
  231. // Push return value
  232. if(ANKI_UNLIKELY(ret == nullptr))
  233. {
  234. lua_pushstring(l, "Glue code returned nullptr");
  235. return -1;
  236. }
  237. voidp = lua_newuserdata(l, sizeof(UserData));
  238. ud = static_cast<UserData*>(voidp);
  239. luaL_setmetatable(l, "EventManager");
  240. ud->initPointed(-6959305329499243407, const_cast<EventManager*>(ret));
  241. return 1;
  242. }
  243. //==============================================================================
  244. /// Wrap function getEventManager.
  245. static int wrapgetEventManager(lua_State* l)
  246. {
  247. int res = pwrapgetEventManager(l);
  248. if(res >= 0)
  249. {
  250. return res;
  251. }
  252. lua_error(l);
  253. return 0;
  254. }
  255. //==============================================================================
  256. /// Wrap the module.
  257. void wrapModuleEvent(lua_State* l)
  258. {
  259. wrapLightEvent(l);
  260. wrapEventManager(l);
  261. LuaBinder::pushLuaCFunc(l, "getEventManager", wrapgetEventManager);
  262. }
  263. } // end namespace anki