lua_Global.cpp 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  1. #include "ScriptController.h"
  2. #include "lua_Global.h"
  3. namespace gameplay
  4. {
  5. void luaRegister_lua_Global()
  6. {
  7. ScriptUtil::registerFunction("__al_error_code", lua____al_error_code);
  8. ScriptUtil::registerFunction("__gl_error_code", lua____gl_error_code);
  9. ScriptUtil::registerFunction("printError", lua__printError);
  10. std::map<std::string, std::vector<std::string> > hierarchy;
  11. hierarchy["AnimationTarget"].push_back("Button");
  12. hierarchy["AnimationTarget"].push_back("CheckBox");
  13. hierarchy["AnimationTarget"].push_back("Container");
  14. hierarchy["AnimationTarget"].push_back("Control");
  15. hierarchy["AnimationTarget"].push_back("Form");
  16. hierarchy["AnimationTarget"].push_back("Joint");
  17. hierarchy["AnimationTarget"].push_back("Joystick");
  18. hierarchy["AnimationTarget"].push_back("Label");
  19. hierarchy["AnimationTarget"].push_back("MaterialParameter");
  20. hierarchy["AnimationTarget"].push_back("Node");
  21. hierarchy["AnimationTarget"].push_back("RadioButton");
  22. hierarchy["AnimationTarget"].push_back("Slider");
  23. hierarchy["AnimationTarget"].push_back("TextBox");
  24. hierarchy["AnimationTarget"].push_back("Transform");
  25. hierarchy["Button"].push_back("CheckBox");
  26. hierarchy["Button"].push_back("RadioButton");
  27. hierarchy["Container"].push_back("Form");
  28. hierarchy["Control"].push_back("Button");
  29. hierarchy["Control"].push_back("CheckBox");
  30. hierarchy["Control"].push_back("Container");
  31. hierarchy["Control"].push_back("Form");
  32. hierarchy["Control"].push_back("Joystick");
  33. hierarchy["Control"].push_back("Label");
  34. hierarchy["Control"].push_back("RadioButton");
  35. hierarchy["Control"].push_back("Slider");
  36. hierarchy["Control"].push_back("TextBox");
  37. hierarchy["Label"].push_back("Button");
  38. hierarchy["Label"].push_back("CheckBox");
  39. hierarchy["Label"].push_back("RadioButton");
  40. hierarchy["Label"].push_back("Slider");
  41. hierarchy["Label"].push_back("TextBox");
  42. hierarchy["Layout"].push_back("AbsoluteLayout");
  43. hierarchy["Layout"].push_back("FlowLayout");
  44. hierarchy["Layout"].push_back("VerticalLayout");
  45. hierarchy["Node"].push_back("Joint");
  46. hierarchy["PhysicsCollisionObject"].push_back("PhysicsCharacter");
  47. hierarchy["PhysicsCollisionObject"].push_back("PhysicsGhostObject");
  48. hierarchy["PhysicsCollisionObject"].push_back("PhysicsRigidBody");
  49. hierarchy["PhysicsConstraint"].push_back("PhysicsFixedConstraint");
  50. hierarchy["PhysicsConstraint"].push_back("PhysicsGenericConstraint");
  51. hierarchy["PhysicsConstraint"].push_back("PhysicsHingeConstraint");
  52. hierarchy["PhysicsConstraint"].push_back("PhysicsSocketConstraint");
  53. hierarchy["PhysicsConstraint"].push_back("PhysicsSpringConstraint");
  54. hierarchy["PhysicsGenericConstraint"].push_back("PhysicsFixedConstraint");
  55. hierarchy["PhysicsGenericConstraint"].push_back("PhysicsSpringConstraint");
  56. hierarchy["PhysicsGhostObject"].push_back("PhysicsCharacter");
  57. hierarchy["Ref"].push_back("AIAgent");
  58. hierarchy["Ref"].push_back("AIState");
  59. hierarchy["Ref"].push_back("AbsoluteLayout");
  60. hierarchy["Ref"].push_back("Animation");
  61. hierarchy["Ref"].push_back("AnimationClip");
  62. hierarchy["Ref"].push_back("AudioBuffer");
  63. hierarchy["Ref"].push_back("AudioSource");
  64. hierarchy["Ref"].push_back("Bundle");
  65. hierarchy["Ref"].push_back("Button");
  66. hierarchy["Ref"].push_back("Camera");
  67. hierarchy["Ref"].push_back("CheckBox");
  68. hierarchy["Ref"].push_back("Container");
  69. hierarchy["Ref"].push_back("Control");
  70. hierarchy["Ref"].push_back("Curve");
  71. hierarchy["Ref"].push_back("DepthStencilTarget");
  72. hierarchy["Ref"].push_back("Effect");
  73. hierarchy["Ref"].push_back("FlowLayout");
  74. hierarchy["Ref"].push_back("Font");
  75. hierarchy["Ref"].push_back("Form");
  76. hierarchy["Ref"].push_back("FrameBuffer");
  77. hierarchy["Ref"].push_back("Image");
  78. hierarchy["Ref"].push_back("Joint");
  79. hierarchy["Ref"].push_back("Joystick");
  80. hierarchy["Ref"].push_back("Label");
  81. hierarchy["Ref"].push_back("Layout");
  82. hierarchy["Ref"].push_back("Light");
  83. hierarchy["Ref"].push_back("Material");
  84. hierarchy["Ref"].push_back("MaterialParameter");
  85. hierarchy["Ref"].push_back("Mesh");
  86. hierarchy["Ref"].push_back("Model");
  87. hierarchy["Ref"].push_back("Node");
  88. hierarchy["Ref"].push_back("ParticleEmitter");
  89. hierarchy["Ref"].push_back("Pass");
  90. hierarchy["Ref"].push_back("PhysicsCollisionShape");
  91. hierarchy["Ref"].push_back("RadioButton");
  92. hierarchy["Ref"].push_back("RenderState");
  93. hierarchy["Ref"].push_back("RenderState::StateBlock");
  94. hierarchy["Ref"].push_back("RenderTarget");
  95. hierarchy["Ref"].push_back("Scene");
  96. hierarchy["Ref"].push_back("Slider");
  97. hierarchy["Ref"].push_back("Technique");
  98. hierarchy["Ref"].push_back("TextBox");
  99. hierarchy["Ref"].push_back("Texture");
  100. hierarchy["Ref"].push_back("Texture::Sampler");
  101. hierarchy["Ref"].push_back("Theme");
  102. hierarchy["Ref"].push_back("Theme::ThemeImage");
  103. hierarchy["Ref"].push_back("VertexAttributeBinding");
  104. hierarchy["Ref"].push_back("VerticalLayout");
  105. hierarchy["RenderState"].push_back("Material");
  106. hierarchy["RenderState"].push_back("Pass");
  107. hierarchy["RenderState"].push_back("Technique");
  108. hierarchy["ScriptTarget"].push_back("AIAgent");
  109. hierarchy["ScriptTarget"].push_back("AIState");
  110. hierarchy["ScriptTarget"].push_back("Button");
  111. hierarchy["ScriptTarget"].push_back("CheckBox");
  112. hierarchy["ScriptTarget"].push_back("Container");
  113. hierarchy["ScriptTarget"].push_back("Control");
  114. hierarchy["ScriptTarget"].push_back("Form");
  115. hierarchy["ScriptTarget"].push_back("Joint");
  116. hierarchy["ScriptTarget"].push_back("Joystick");
  117. hierarchy["ScriptTarget"].push_back("Label");
  118. hierarchy["ScriptTarget"].push_back("Node");
  119. hierarchy["ScriptTarget"].push_back("PhysicsController");
  120. hierarchy["ScriptTarget"].push_back("RadioButton");
  121. hierarchy["ScriptTarget"].push_back("Slider");
  122. hierarchy["ScriptTarget"].push_back("TextBox");
  123. hierarchy["ScriptTarget"].push_back("Transform");
  124. hierarchy["Transform"].push_back("Joint");
  125. hierarchy["Transform"].push_back("Node");
  126. hierarchy["Transform::Listener"].push_back("AudioListener");
  127. hierarchy["Transform::Listener"].push_back("AudioSource");
  128. hierarchy["Transform::Listener"].push_back("Camera");
  129. hierarchy["Transform::Listener"].push_back("MeshSkin");
  130. hierarchy["Transform::Listener"].push_back("PhysicsCharacter");
  131. hierarchy["Transform::Listener"].push_back("PhysicsGhostObject");
  132. hierarchy["Transform::Listener"].push_back("PhysicsRigidBody");
  133. ScriptUtil::setGlobalHierarchy(hierarchy);
  134. // Register enumeration AIMessage::ParameterType.
  135. {
  136. std::vector<std::string> scopePath;
  137. scopePath.push_back("AIMessage");
  138. ScriptUtil::registerConstantString("UNDEFINED", "UNDEFINED", scopePath);
  139. ScriptUtil::registerConstantString("INTEGER", "INTEGER", scopePath);
  140. ScriptUtil::registerConstantString("LONG", "LONG", scopePath);
  141. ScriptUtil::registerConstantString("FLOAT", "FLOAT", scopePath);
  142. ScriptUtil::registerConstantString("DOUBLE", "DOUBLE", scopePath);
  143. ScriptUtil::registerConstantString("BOOLEAN", "BOOLEAN", scopePath);
  144. ScriptUtil::registerConstantString("STRING", "STRING", scopePath);
  145. }
  146. // Register enumeration AnimationClip::Listener::EventType.
  147. {
  148. std::vector<std::string> scopePath;
  149. scopePath.push_back("AnimationClip");
  150. scopePath.push_back("Listener");
  151. ScriptUtil::registerConstantString("BEGIN", "BEGIN", scopePath);
  152. ScriptUtil::registerConstantString("END", "END", scopePath);
  153. ScriptUtil::registerConstantString("TIME", "TIME", scopePath);
  154. }
  155. // Register enumeration AudioSource::State.
  156. {
  157. std::vector<std::string> scopePath;
  158. scopePath.push_back("AudioSource");
  159. ScriptUtil::registerConstantString("INITIAL", "INITIAL", scopePath);
  160. ScriptUtil::registerConstantString("PLAYING", "PLAYING", scopePath);
  161. ScriptUtil::registerConstantString("PAUSED", "PAUSED", scopePath);
  162. ScriptUtil::registerConstantString("STOPPED", "STOPPED", scopePath);
  163. }
  164. // Register enumeration Camera::Type.
  165. {
  166. std::vector<std::string> scopePath;
  167. scopePath.push_back("Camera");
  168. ScriptUtil::registerConstantString("PERSPECTIVE", "PERSPECTIVE", scopePath);
  169. ScriptUtil::registerConstantString("ORTHOGRAPHIC", "ORTHOGRAPHIC", scopePath);
  170. }
  171. // Register enumeration Container::Scroll.
  172. {
  173. std::vector<std::string> scopePath;
  174. scopePath.push_back("Container");
  175. ScriptUtil::registerConstantString("SCROLL_NONE", "SCROLL_NONE", scopePath);
  176. ScriptUtil::registerConstantString("SCROLL_HORIZONTAL", "SCROLL_HORIZONTAL", scopePath);
  177. ScriptUtil::registerConstantString("SCROLL_VERTICAL", "SCROLL_VERTICAL", scopePath);
  178. ScriptUtil::registerConstantString("SCROLL_BOTH", "SCROLL_BOTH", scopePath);
  179. }
  180. // Register enumeration Control::Alignment.
  181. {
  182. std::vector<std::string> scopePath;
  183. scopePath.push_back("Control");
  184. ScriptUtil::registerConstantString("ALIGN_LEFT", "ALIGN_LEFT", scopePath);
  185. ScriptUtil::registerConstantString("ALIGN_HCENTER", "ALIGN_HCENTER", scopePath);
  186. ScriptUtil::registerConstantString("ALIGN_RIGHT", "ALIGN_RIGHT", scopePath);
  187. ScriptUtil::registerConstantString("ALIGN_TOP", "ALIGN_TOP", scopePath);
  188. ScriptUtil::registerConstantString("ALIGN_VCENTER", "ALIGN_VCENTER", scopePath);
  189. ScriptUtil::registerConstantString("ALIGN_BOTTOM", "ALIGN_BOTTOM", scopePath);
  190. ScriptUtil::registerConstantString("ALIGN_TOP_LEFT", "ALIGN_TOP_LEFT", scopePath);
  191. ScriptUtil::registerConstantString("ALIGN_VCENTER_LEFT", "ALIGN_VCENTER_LEFT", scopePath);
  192. ScriptUtil::registerConstantString("ALIGN_BOTTOM_LEFT", "ALIGN_BOTTOM_LEFT", scopePath);
  193. ScriptUtil::registerConstantString("ALIGN_TOP_HCENTER", "ALIGN_TOP_HCENTER", scopePath);
  194. ScriptUtil::registerConstantString("ALIGN_VCENTER_HCENTER", "ALIGN_VCENTER_HCENTER", scopePath);
  195. ScriptUtil::registerConstantString("ALIGN_BOTTOM_HCENTER", "ALIGN_BOTTOM_HCENTER", scopePath);
  196. ScriptUtil::registerConstantString("ALIGN_TOP_RIGHT", "ALIGN_TOP_RIGHT", scopePath);
  197. ScriptUtil::registerConstantString("ALIGN_VCENTER_RIGHT", "ALIGN_VCENTER_RIGHT", scopePath);
  198. ScriptUtil::registerConstantString("ALIGN_BOTTOM_RIGHT", "ALIGN_BOTTOM_RIGHT", scopePath);
  199. }
  200. // Register enumeration Control::Listener::EventType.
  201. {
  202. std::vector<std::string> scopePath;
  203. scopePath.push_back("Control");
  204. scopePath.push_back("Listener");
  205. ScriptUtil::registerConstantString("PRESS", "PRESS", scopePath);
  206. ScriptUtil::registerConstantString("RELEASE", "RELEASE", scopePath);
  207. ScriptUtil::registerConstantString("CLICK", "CLICK", scopePath);
  208. ScriptUtil::registerConstantString("VALUE_CHANGED", "VALUE_CHANGED", scopePath);
  209. ScriptUtil::registerConstantString("TEXT_CHANGED", "TEXT_CHANGED", scopePath);
  210. ScriptUtil::registerConstantString("MIDDLE_CLICK", "MIDDLE_CLICK", scopePath);
  211. ScriptUtil::registerConstantString("RIGHT_CLICK", "RIGHT_CLICK", scopePath);
  212. }
  213. // Register enumeration Control::State.
  214. {
  215. std::vector<std::string> scopePath;
  216. scopePath.push_back("Control");
  217. ScriptUtil::registerConstantString("NORMAL", "NORMAL", scopePath);
  218. ScriptUtil::registerConstantString("FOCUS", "FOCUS", scopePath);
  219. ScriptUtil::registerConstantString("ACTIVE", "ACTIVE", scopePath);
  220. ScriptUtil::registerConstantString("DISABLED", "DISABLED", scopePath);
  221. }
  222. // Register enumeration Curve::InterpolationType.
  223. {
  224. std::vector<std::string> scopePath;
  225. scopePath.push_back("Curve");
  226. ScriptUtil::registerConstantString("BEZIER", "BEZIER", scopePath);
  227. ScriptUtil::registerConstantString("BSPLINE", "BSPLINE", scopePath);
  228. ScriptUtil::registerConstantString("FLAT", "FLAT", scopePath);
  229. ScriptUtil::registerConstantString("HERMITE", "HERMITE", scopePath);
  230. ScriptUtil::registerConstantString("LINEAR", "LINEAR", scopePath);
  231. ScriptUtil::registerConstantString("SMOOTH", "SMOOTH", scopePath);
  232. ScriptUtil::registerConstantString("STEP", "STEP", scopePath);
  233. ScriptUtil::registerConstantString("QUADRATIC_IN", "QUADRATIC_IN", scopePath);
  234. ScriptUtil::registerConstantString("QUADRATIC_OUT", "QUADRATIC_OUT", scopePath);
  235. ScriptUtil::registerConstantString("QUADRATIC_IN_OUT", "QUADRATIC_IN_OUT", scopePath);
  236. ScriptUtil::registerConstantString("QUADRATIC_OUT_IN", "QUADRATIC_OUT_IN", scopePath);
  237. ScriptUtil::registerConstantString("CUBIC_IN", "CUBIC_IN", scopePath);
  238. ScriptUtil::registerConstantString("CUBIC_OUT", "CUBIC_OUT", scopePath);
  239. ScriptUtil::registerConstantString("CUBIC_IN_OUT", "CUBIC_IN_OUT", scopePath);
  240. ScriptUtil::registerConstantString("CUBIC_OUT_IN", "CUBIC_OUT_IN", scopePath);
  241. ScriptUtil::registerConstantString("QUARTIC_IN", "QUARTIC_IN", scopePath);
  242. ScriptUtil::registerConstantString("QUARTIC_OUT", "QUARTIC_OUT", scopePath);
  243. ScriptUtil::registerConstantString("QUARTIC_IN_OUT", "QUARTIC_IN_OUT", scopePath);
  244. ScriptUtil::registerConstantString("QUARTIC_OUT_IN", "QUARTIC_OUT_IN", scopePath);
  245. ScriptUtil::registerConstantString("QUINTIC_IN", "QUINTIC_IN", scopePath);
  246. ScriptUtil::registerConstantString("QUINTIC_OUT", "QUINTIC_OUT", scopePath);
  247. ScriptUtil::registerConstantString("QUINTIC_IN_OUT", "QUINTIC_IN_OUT", scopePath);
  248. ScriptUtil::registerConstantString("QUINTIC_OUT_IN", "QUINTIC_OUT_IN", scopePath);
  249. ScriptUtil::registerConstantString("SINE_IN", "SINE_IN", scopePath);
  250. ScriptUtil::registerConstantString("SINE_OUT", "SINE_OUT", scopePath);
  251. ScriptUtil::registerConstantString("SINE_IN_OUT", "SINE_IN_OUT", scopePath);
  252. ScriptUtil::registerConstantString("SINE_OUT_IN", "SINE_OUT_IN", scopePath);
  253. ScriptUtil::registerConstantString("EXPONENTIAL_IN", "EXPONENTIAL_IN", scopePath);
  254. ScriptUtil::registerConstantString("EXPONENTIAL_OUT", "EXPONENTIAL_OUT", scopePath);
  255. ScriptUtil::registerConstantString("EXPONENTIAL_IN_OUT", "EXPONENTIAL_IN_OUT", scopePath);
  256. ScriptUtil::registerConstantString("EXPONENTIAL_OUT_IN", "EXPONENTIAL_OUT_IN", scopePath);
  257. ScriptUtil::registerConstantString("CIRCULAR_IN", "CIRCULAR_IN", scopePath);
  258. ScriptUtil::registerConstantString("CIRCULAR_OUT", "CIRCULAR_OUT", scopePath);
  259. ScriptUtil::registerConstantString("CIRCULAR_IN_OUT", "CIRCULAR_IN_OUT", scopePath);
  260. ScriptUtil::registerConstantString("CIRCULAR_OUT_IN", "CIRCULAR_OUT_IN", scopePath);
  261. ScriptUtil::registerConstantString("ELASTIC_IN", "ELASTIC_IN", scopePath);
  262. ScriptUtil::registerConstantString("ELASTIC_OUT", "ELASTIC_OUT", scopePath);
  263. ScriptUtil::registerConstantString("ELASTIC_IN_OUT", "ELASTIC_IN_OUT", scopePath);
  264. ScriptUtil::registerConstantString("ELASTIC_OUT_IN", "ELASTIC_OUT_IN", scopePath);
  265. ScriptUtil::registerConstantString("OVERSHOOT_IN", "OVERSHOOT_IN", scopePath);
  266. ScriptUtil::registerConstantString("OVERSHOOT_OUT", "OVERSHOOT_OUT", scopePath);
  267. ScriptUtil::registerConstantString("OVERSHOOT_IN_OUT", "OVERSHOOT_IN_OUT", scopePath);
  268. ScriptUtil::registerConstantString("OVERSHOOT_OUT_IN", "OVERSHOOT_OUT_IN", scopePath);
  269. ScriptUtil::registerConstantString("BOUNCE_IN", "BOUNCE_IN", scopePath);
  270. ScriptUtil::registerConstantString("BOUNCE_OUT", "BOUNCE_OUT", scopePath);
  271. ScriptUtil::registerConstantString("BOUNCE_IN_OUT", "BOUNCE_IN_OUT", scopePath);
  272. ScriptUtil::registerConstantString("BOUNCE_OUT_IN", "BOUNCE_OUT_IN", scopePath);
  273. }
  274. // Register enumeration DepthStencilTarget::Format.
  275. {
  276. std::vector<std::string> scopePath;
  277. scopePath.push_back("DepthStencilTarget");
  278. ScriptUtil::registerConstantString("DEPTH", "DEPTH", scopePath);
  279. ScriptUtil::registerConstantString("DEPTH_STENCIL", "DEPTH_STENCIL", scopePath);
  280. }
  281. // Register enumeration Font::Justify.
  282. {
  283. std::vector<std::string> scopePath;
  284. scopePath.push_back("Font");
  285. ScriptUtil::registerConstantString("ALIGN_LEFT", "ALIGN_LEFT", scopePath);
  286. ScriptUtil::registerConstantString("ALIGN_HCENTER", "ALIGN_HCENTER", scopePath);
  287. ScriptUtil::registerConstantString("ALIGN_RIGHT", "ALIGN_RIGHT", scopePath);
  288. ScriptUtil::registerConstantString("ALIGN_TOP", "ALIGN_TOP", scopePath);
  289. ScriptUtil::registerConstantString("ALIGN_VCENTER", "ALIGN_VCENTER", scopePath);
  290. ScriptUtil::registerConstantString("ALIGN_BOTTOM", "ALIGN_BOTTOM", scopePath);
  291. ScriptUtil::registerConstantString("ALIGN_TOP_LEFT", "ALIGN_TOP_LEFT", scopePath);
  292. ScriptUtil::registerConstantString("ALIGN_VCENTER_LEFT", "ALIGN_VCENTER_LEFT", scopePath);
  293. ScriptUtil::registerConstantString("ALIGN_BOTTOM_LEFT", "ALIGN_BOTTOM_LEFT", scopePath);
  294. ScriptUtil::registerConstantString("ALIGN_TOP_HCENTER", "ALIGN_TOP_HCENTER", scopePath);
  295. ScriptUtil::registerConstantString("ALIGN_VCENTER_HCENTER", "ALIGN_VCENTER_HCENTER", scopePath);
  296. ScriptUtil::registerConstantString("ALIGN_BOTTOM_HCENTER", "ALIGN_BOTTOM_HCENTER", scopePath);
  297. ScriptUtil::registerConstantString("ALIGN_TOP_RIGHT", "ALIGN_TOP_RIGHT", scopePath);
  298. ScriptUtil::registerConstantString("ALIGN_VCENTER_RIGHT", "ALIGN_VCENTER_RIGHT", scopePath);
  299. ScriptUtil::registerConstantString("ALIGN_BOTTOM_RIGHT", "ALIGN_BOTTOM_RIGHT", scopePath);
  300. }
  301. // Register enumeration Font::Style.
  302. {
  303. std::vector<std::string> scopePath;
  304. scopePath.push_back("Font");
  305. ScriptUtil::registerConstantString("PLAIN", "PLAIN", scopePath);
  306. ScriptUtil::registerConstantString("BOLD", "BOLD", scopePath);
  307. ScriptUtil::registerConstantString("ITALIC", "ITALIC", scopePath);
  308. ScriptUtil::registerConstantString("BOLD_ITALIC", "BOLD_ITALIC", scopePath);
  309. }
  310. // Register enumeration Game::ClearFlags.
  311. {
  312. std::vector<std::string> scopePath;
  313. scopePath.push_back("Game");
  314. ScriptUtil::registerConstantString("CLEAR_COLOR", "CLEAR_COLOR", scopePath);
  315. ScriptUtil::registerConstantString("CLEAR_DEPTH", "CLEAR_DEPTH", scopePath);
  316. ScriptUtil::registerConstantString("CLEAR_STENCIL", "CLEAR_STENCIL", scopePath);
  317. ScriptUtil::registerConstantString("CLEAR_COLOR_DEPTH", "CLEAR_COLOR_DEPTH", scopePath);
  318. ScriptUtil::registerConstantString("CLEAR_COLOR_STENCIL", "CLEAR_COLOR_STENCIL", scopePath);
  319. ScriptUtil::registerConstantString("CLEAR_DEPTH_STENCIL", "CLEAR_DEPTH_STENCIL", scopePath);
  320. ScriptUtil::registerConstantString("CLEAR_COLOR_DEPTH_STENCIL", "CLEAR_COLOR_DEPTH_STENCIL", scopePath);
  321. }
  322. // Register enumeration Game::State.
  323. {
  324. std::vector<std::string> scopePath;
  325. scopePath.push_back("Game");
  326. ScriptUtil::registerConstantString("UNINITIALIZED", "UNINITIALIZED", scopePath);
  327. ScriptUtil::registerConstantString("RUNNING", "RUNNING", scopePath);
  328. ScriptUtil::registerConstantString("PAUSED", "PAUSED", scopePath);
  329. }
  330. // Register enumeration Gamepad::ButtonState.
  331. {
  332. std::vector<std::string> scopePath;
  333. scopePath.push_back("Gamepad");
  334. ScriptUtil::registerConstantString("BUTTON_PRESSED", "BUTTON_PRESSED", scopePath);
  335. ScriptUtil::registerConstantString("BUTTON_RELEASED", "BUTTON_RELEASED", scopePath);
  336. }
  337. // Register enumeration Gamepad::GamepadEvent.
  338. {
  339. std::vector<std::string> scopePath;
  340. scopePath.push_back("Gamepad");
  341. ScriptUtil::registerConstantString("ATTACHED_EVENT", "ATTACHED_EVENT", scopePath);
  342. ScriptUtil::registerConstantString("DETACHED_EVENT", "DETACHED_EVENT", scopePath);
  343. }
  344. // Register enumeration Image::Format.
  345. {
  346. std::vector<std::string> scopePath;
  347. scopePath.push_back("Image");
  348. ScriptUtil::registerConstantString("RGB", "RGB", scopePath);
  349. ScriptUtil::registerConstantString("RGBA", "RGBA", scopePath);
  350. }
  351. // Register enumeration Keyboard::Key.
  352. {
  353. std::vector<std::string> scopePath;
  354. scopePath.push_back("Keyboard");
  355. ScriptUtil::registerConstantString("KEY_NONE", "KEY_NONE", scopePath);
  356. ScriptUtil::registerConstantString("KEY_PAUSE", "KEY_PAUSE", scopePath);
  357. ScriptUtil::registerConstantString("KEY_SCROLL_LOCK", "KEY_SCROLL_LOCK", scopePath);
  358. ScriptUtil::registerConstantString("KEY_PRINT", "KEY_PRINT", scopePath);
  359. ScriptUtil::registerConstantString("KEY_SYSREQ", "KEY_SYSREQ", scopePath);
  360. ScriptUtil::registerConstantString("KEY_BREAK", "KEY_BREAK", scopePath);
  361. ScriptUtil::registerConstantString("KEY_ESCAPE", "KEY_ESCAPE", scopePath);
  362. ScriptUtil::registerConstantString("KEY_BACKSPACE", "KEY_BACKSPACE", scopePath);
  363. ScriptUtil::registerConstantString("KEY_TAB", "KEY_TAB", scopePath);
  364. ScriptUtil::registerConstantString("KEY_BACK_TAB", "KEY_BACK_TAB", scopePath);
  365. ScriptUtil::registerConstantString("KEY_RETURN", "KEY_RETURN", scopePath);
  366. ScriptUtil::registerConstantString("KEY_CAPS_LOCK", "KEY_CAPS_LOCK", scopePath);
  367. ScriptUtil::registerConstantString("KEY_SHIFT", "KEY_SHIFT", scopePath);
  368. ScriptUtil::registerConstantString("KEY_CTRL", "KEY_CTRL", scopePath);
  369. ScriptUtil::registerConstantString("KEY_ALT", "KEY_ALT", scopePath);
  370. ScriptUtil::registerConstantString("KEY_MENU", "KEY_MENU", scopePath);
  371. ScriptUtil::registerConstantString("KEY_HYPER", "KEY_HYPER", scopePath);
  372. ScriptUtil::registerConstantString("KEY_INSERT", "KEY_INSERT", scopePath);
  373. ScriptUtil::registerConstantString("KEY_HOME", "KEY_HOME", scopePath);
  374. ScriptUtil::registerConstantString("KEY_PG_UP", "KEY_PG_UP", scopePath);
  375. ScriptUtil::registerConstantString("KEY_DELETE", "KEY_DELETE", scopePath);
  376. ScriptUtil::registerConstantString("KEY_END", "KEY_END", scopePath);
  377. ScriptUtil::registerConstantString("KEY_PG_DOWN", "KEY_PG_DOWN", scopePath);
  378. ScriptUtil::registerConstantString("KEY_LEFT_ARROW", "KEY_LEFT_ARROW", scopePath);
  379. ScriptUtil::registerConstantString("KEY_RIGHT_ARROW", "KEY_RIGHT_ARROW", scopePath);
  380. ScriptUtil::registerConstantString("KEY_UP_ARROW", "KEY_UP_ARROW", scopePath);
  381. ScriptUtil::registerConstantString("KEY_DOWN_ARROW", "KEY_DOWN_ARROW", scopePath);
  382. ScriptUtil::registerConstantString("KEY_NUM_LOCK", "KEY_NUM_LOCK", scopePath);
  383. ScriptUtil::registerConstantString("KEY_KP_PLUS", "KEY_KP_PLUS", scopePath);
  384. ScriptUtil::registerConstantString("KEY_KP_MINUS", "KEY_KP_MINUS", scopePath);
  385. ScriptUtil::registerConstantString("KEY_KP_MULTIPLY", "KEY_KP_MULTIPLY", scopePath);
  386. ScriptUtil::registerConstantString("KEY_KP_DIVIDE", "KEY_KP_DIVIDE", scopePath);
  387. ScriptUtil::registerConstantString("KEY_KP_ENTER", "KEY_KP_ENTER", scopePath);
  388. ScriptUtil::registerConstantString("KEY_KP_HOME", "KEY_KP_HOME", scopePath);
  389. ScriptUtil::registerConstantString("KEY_KP_UP", "KEY_KP_UP", scopePath);
  390. ScriptUtil::registerConstantString("KEY_KP_PG_UP", "KEY_KP_PG_UP", scopePath);
  391. ScriptUtil::registerConstantString("KEY_KP_LEFT", "KEY_KP_LEFT", scopePath);
  392. ScriptUtil::registerConstantString("KEY_KP_FIVE", "KEY_KP_FIVE", scopePath);
  393. ScriptUtil::registerConstantString("KEY_KP_RIGHT", "KEY_KP_RIGHT", scopePath);
  394. ScriptUtil::registerConstantString("KEY_KP_END", "KEY_KP_END", scopePath);
  395. ScriptUtil::registerConstantString("KEY_KP_DOWN", "KEY_KP_DOWN", scopePath);
  396. ScriptUtil::registerConstantString("KEY_KP_PG_DOWN", "KEY_KP_PG_DOWN", scopePath);
  397. ScriptUtil::registerConstantString("KEY_KP_INSERT", "KEY_KP_INSERT", scopePath);
  398. ScriptUtil::registerConstantString("KEY_KP_DELETE", "KEY_KP_DELETE", scopePath);
  399. ScriptUtil::registerConstantString("KEY_F1", "KEY_F1", scopePath);
  400. ScriptUtil::registerConstantString("KEY_F2", "KEY_F2", scopePath);
  401. ScriptUtil::registerConstantString("KEY_F3", "KEY_F3", scopePath);
  402. ScriptUtil::registerConstantString("KEY_F4", "KEY_F4", scopePath);
  403. ScriptUtil::registerConstantString("KEY_F5", "KEY_F5", scopePath);
  404. ScriptUtil::registerConstantString("KEY_F6", "KEY_F6", scopePath);
  405. ScriptUtil::registerConstantString("KEY_F7", "KEY_F7", scopePath);
  406. ScriptUtil::registerConstantString("KEY_F8", "KEY_F8", scopePath);
  407. ScriptUtil::registerConstantString("KEY_F9", "KEY_F9", scopePath);
  408. ScriptUtil::registerConstantString("KEY_F10", "KEY_F10", scopePath);
  409. ScriptUtil::registerConstantString("KEY_F11", "KEY_F11", scopePath);
  410. ScriptUtil::registerConstantString("KEY_F12", "KEY_F12", scopePath);
  411. ScriptUtil::registerConstantString("KEY_SPACE", "KEY_SPACE", scopePath);
  412. ScriptUtil::registerConstantString("KEY_EXCLAM", "KEY_EXCLAM", scopePath);
  413. ScriptUtil::registerConstantString("KEY_QUOTE", "KEY_QUOTE", scopePath);
  414. ScriptUtil::registerConstantString("KEY_NUMBER", "KEY_NUMBER", scopePath);
  415. ScriptUtil::registerConstantString("KEY_DOLLAR", "KEY_DOLLAR", scopePath);
  416. ScriptUtil::registerConstantString("KEY_PERCENT", "KEY_PERCENT", scopePath);
  417. ScriptUtil::registerConstantString("KEY_CIRCUMFLEX", "KEY_CIRCUMFLEX", scopePath);
  418. ScriptUtil::registerConstantString("KEY_AMPERSAND", "KEY_AMPERSAND", scopePath);
  419. ScriptUtil::registerConstantString("KEY_APOSTROPHE", "KEY_APOSTROPHE", scopePath);
  420. ScriptUtil::registerConstantString("KEY_LEFT_PARENTHESIS", "KEY_LEFT_PARENTHESIS", scopePath);
  421. ScriptUtil::registerConstantString("KEY_RIGHT_PARENTHESIS", "KEY_RIGHT_PARENTHESIS", scopePath);
  422. ScriptUtil::registerConstantString("KEY_ASTERISK", "KEY_ASTERISK", scopePath);
  423. ScriptUtil::registerConstantString("KEY_PLUS", "KEY_PLUS", scopePath);
  424. ScriptUtil::registerConstantString("KEY_COMMA", "KEY_COMMA", scopePath);
  425. ScriptUtil::registerConstantString("KEY_MINUS", "KEY_MINUS", scopePath);
  426. ScriptUtil::registerConstantString("KEY_PERIOD", "KEY_PERIOD", scopePath);
  427. ScriptUtil::registerConstantString("KEY_SLASH", "KEY_SLASH", scopePath);
  428. ScriptUtil::registerConstantString("KEY_ZERO", "KEY_ZERO", scopePath);
  429. ScriptUtil::registerConstantString("KEY_ONE", "KEY_ONE", scopePath);
  430. ScriptUtil::registerConstantString("KEY_TWO", "KEY_TWO", scopePath);
  431. ScriptUtil::registerConstantString("KEY_THREE", "KEY_THREE", scopePath);
  432. ScriptUtil::registerConstantString("KEY_FOUR", "KEY_FOUR", scopePath);
  433. ScriptUtil::registerConstantString("KEY_FIVE", "KEY_FIVE", scopePath);
  434. ScriptUtil::registerConstantString("KEY_SIX", "KEY_SIX", scopePath);
  435. ScriptUtil::registerConstantString("KEY_SEVEN", "KEY_SEVEN", scopePath);
  436. ScriptUtil::registerConstantString("KEY_EIGHT", "KEY_EIGHT", scopePath);
  437. ScriptUtil::registerConstantString("KEY_NINE", "KEY_NINE", scopePath);
  438. ScriptUtil::registerConstantString("KEY_COLON", "KEY_COLON", scopePath);
  439. ScriptUtil::registerConstantString("KEY_SEMICOLON", "KEY_SEMICOLON", scopePath);
  440. ScriptUtil::registerConstantString("KEY_LESS_THAN", "KEY_LESS_THAN", scopePath);
  441. ScriptUtil::registerConstantString("KEY_EQUAL", "KEY_EQUAL", scopePath);
  442. ScriptUtil::registerConstantString("KEY_GREATER_THAN", "KEY_GREATER_THAN", scopePath);
  443. ScriptUtil::registerConstantString("KEY_QUESTION", "KEY_QUESTION", scopePath);
  444. ScriptUtil::registerConstantString("KEY_AT", "KEY_AT", scopePath);
  445. ScriptUtil::registerConstantString("KEY_CAPITAL_A", "KEY_CAPITAL_A", scopePath);
  446. ScriptUtil::registerConstantString("KEY_CAPITAL_B", "KEY_CAPITAL_B", scopePath);
  447. ScriptUtil::registerConstantString("KEY_CAPITAL_C", "KEY_CAPITAL_C", scopePath);
  448. ScriptUtil::registerConstantString("KEY_CAPITAL_D", "KEY_CAPITAL_D", scopePath);
  449. ScriptUtil::registerConstantString("KEY_CAPITAL_E", "KEY_CAPITAL_E", scopePath);
  450. ScriptUtil::registerConstantString("KEY_CAPITAL_F", "KEY_CAPITAL_F", scopePath);
  451. ScriptUtil::registerConstantString("KEY_CAPITAL_G", "KEY_CAPITAL_G", scopePath);
  452. ScriptUtil::registerConstantString("KEY_CAPITAL_H", "KEY_CAPITAL_H", scopePath);
  453. ScriptUtil::registerConstantString("KEY_CAPITAL_I", "KEY_CAPITAL_I", scopePath);
  454. ScriptUtil::registerConstantString("KEY_CAPITAL_J", "KEY_CAPITAL_J", scopePath);
  455. ScriptUtil::registerConstantString("KEY_CAPITAL_K", "KEY_CAPITAL_K", scopePath);
  456. ScriptUtil::registerConstantString("KEY_CAPITAL_L", "KEY_CAPITAL_L", scopePath);
  457. ScriptUtil::registerConstantString("KEY_CAPITAL_M", "KEY_CAPITAL_M", scopePath);
  458. ScriptUtil::registerConstantString("KEY_CAPITAL_N", "KEY_CAPITAL_N", scopePath);
  459. ScriptUtil::registerConstantString("KEY_CAPITAL_O", "KEY_CAPITAL_O", scopePath);
  460. ScriptUtil::registerConstantString("KEY_CAPITAL_P", "KEY_CAPITAL_P", scopePath);
  461. ScriptUtil::registerConstantString("KEY_CAPITAL_Q", "KEY_CAPITAL_Q", scopePath);
  462. ScriptUtil::registerConstantString("KEY_CAPITAL_R", "KEY_CAPITAL_R", scopePath);
  463. ScriptUtil::registerConstantString("KEY_CAPITAL_S", "KEY_CAPITAL_S", scopePath);
  464. ScriptUtil::registerConstantString("KEY_CAPITAL_T", "KEY_CAPITAL_T", scopePath);
  465. ScriptUtil::registerConstantString("KEY_CAPITAL_U", "KEY_CAPITAL_U", scopePath);
  466. ScriptUtil::registerConstantString("KEY_CAPITAL_V", "KEY_CAPITAL_V", scopePath);
  467. ScriptUtil::registerConstantString("KEY_CAPITAL_W", "KEY_CAPITAL_W", scopePath);
  468. ScriptUtil::registerConstantString("KEY_CAPITAL_X", "KEY_CAPITAL_X", scopePath);
  469. ScriptUtil::registerConstantString("KEY_CAPITAL_Y", "KEY_CAPITAL_Y", scopePath);
  470. ScriptUtil::registerConstantString("KEY_CAPITAL_Z", "KEY_CAPITAL_Z", scopePath);
  471. ScriptUtil::registerConstantString("KEY_LEFT_BRACKET", "KEY_LEFT_BRACKET", scopePath);
  472. ScriptUtil::registerConstantString("KEY_BACK_SLASH", "KEY_BACK_SLASH", scopePath);
  473. ScriptUtil::registerConstantString("KEY_RIGHT_BRACKET", "KEY_RIGHT_BRACKET", scopePath);
  474. ScriptUtil::registerConstantString("KEY_UNDERSCORE", "KEY_UNDERSCORE", scopePath);
  475. ScriptUtil::registerConstantString("KEY_GRAVE", "KEY_GRAVE", scopePath);
  476. ScriptUtil::registerConstantString("KEY_A", "KEY_A", scopePath);
  477. ScriptUtil::registerConstantString("KEY_B", "KEY_B", scopePath);
  478. ScriptUtil::registerConstantString("KEY_C", "KEY_C", scopePath);
  479. ScriptUtil::registerConstantString("KEY_D", "KEY_D", scopePath);
  480. ScriptUtil::registerConstantString("KEY_E", "KEY_E", scopePath);
  481. ScriptUtil::registerConstantString("KEY_F", "KEY_F", scopePath);
  482. ScriptUtil::registerConstantString("KEY_G", "KEY_G", scopePath);
  483. ScriptUtil::registerConstantString("KEY_H", "KEY_H", scopePath);
  484. ScriptUtil::registerConstantString("KEY_I", "KEY_I", scopePath);
  485. ScriptUtil::registerConstantString("KEY_J", "KEY_J", scopePath);
  486. ScriptUtil::registerConstantString("KEY_K", "KEY_K", scopePath);
  487. ScriptUtil::registerConstantString("KEY_L", "KEY_L", scopePath);
  488. ScriptUtil::registerConstantString("KEY_M", "KEY_M", scopePath);
  489. ScriptUtil::registerConstantString("KEY_N", "KEY_N", scopePath);
  490. ScriptUtil::registerConstantString("KEY_O", "KEY_O", scopePath);
  491. ScriptUtil::registerConstantString("KEY_P", "KEY_P", scopePath);
  492. ScriptUtil::registerConstantString("KEY_Q", "KEY_Q", scopePath);
  493. ScriptUtil::registerConstantString("KEY_R", "KEY_R", scopePath);
  494. ScriptUtil::registerConstantString("KEY_S", "KEY_S", scopePath);
  495. ScriptUtil::registerConstantString("KEY_T", "KEY_T", scopePath);
  496. ScriptUtil::registerConstantString("KEY_U", "KEY_U", scopePath);
  497. ScriptUtil::registerConstantString("KEY_V", "KEY_V", scopePath);
  498. ScriptUtil::registerConstantString("KEY_W", "KEY_W", scopePath);
  499. ScriptUtil::registerConstantString("KEY_X", "KEY_X", scopePath);
  500. ScriptUtil::registerConstantString("KEY_Y", "KEY_Y", scopePath);
  501. ScriptUtil::registerConstantString("KEY_Z", "KEY_Z", scopePath);
  502. ScriptUtil::registerConstantString("KEY_LEFT_BRACE", "KEY_LEFT_BRACE", scopePath);
  503. ScriptUtil::registerConstantString("KEY_BAR", "KEY_BAR", scopePath);
  504. ScriptUtil::registerConstantString("KEY_RIGHT_BRACE", "KEY_RIGHT_BRACE", scopePath);
  505. ScriptUtil::registerConstantString("KEY_TILDE", "KEY_TILDE", scopePath);
  506. ScriptUtil::registerConstantString("KEY_EURO", "KEY_EURO", scopePath);
  507. ScriptUtil::registerConstantString("KEY_POUND", "KEY_POUND", scopePath);
  508. ScriptUtil::registerConstantString("KEY_YEN", "KEY_YEN", scopePath);
  509. ScriptUtil::registerConstantString("KEY_MIDDLE_DOT", "KEY_MIDDLE_DOT", scopePath);
  510. ScriptUtil::registerConstantString("KEY_SEARCH", "KEY_SEARCH", scopePath);
  511. }
  512. // Register enumeration Keyboard::KeyEvent.
  513. {
  514. std::vector<std::string> scopePath;
  515. scopePath.push_back("Keyboard");
  516. ScriptUtil::registerConstantString("KEY_PRESS", "KEY_PRESS", scopePath);
  517. ScriptUtil::registerConstantString("KEY_RELEASE", "KEY_RELEASE", scopePath);
  518. ScriptUtil::registerConstantString("KEY_CHAR", "KEY_CHAR", scopePath);
  519. }
  520. // Register enumeration Layout::Type.
  521. {
  522. std::vector<std::string> scopePath;
  523. scopePath.push_back("Layout");
  524. ScriptUtil::registerConstantString("LAYOUT_FLOW", "LAYOUT_FLOW", scopePath);
  525. ScriptUtil::registerConstantString("LAYOUT_VERTICAL", "LAYOUT_VERTICAL", scopePath);
  526. ScriptUtil::registerConstantString("LAYOUT_ABSOLUTE", "LAYOUT_ABSOLUTE", scopePath);
  527. ScriptUtil::registerConstantString("LAYOUT_SCROLL", "LAYOUT_SCROLL", scopePath);
  528. }
  529. // Register enumeration Light::Type.
  530. {
  531. std::vector<std::string> scopePath;
  532. scopePath.push_back("Light");
  533. ScriptUtil::registerConstantString("DIRECTIONAL", "DIRECTIONAL", scopePath);
  534. ScriptUtil::registerConstantString("POINT", "POINT", scopePath);
  535. ScriptUtil::registerConstantString("SPOT", "SPOT", scopePath);
  536. }
  537. // Register enumeration Mesh::IndexFormat.
  538. {
  539. std::vector<std::string> scopePath;
  540. scopePath.push_back("Mesh");
  541. ScriptUtil::registerConstantString("INDEX8", "INDEX8", scopePath);
  542. ScriptUtil::registerConstantString("INDEX16", "INDEX16", scopePath);
  543. ScriptUtil::registerConstantString("INDEX32", "INDEX32", scopePath);
  544. }
  545. // Register enumeration Mesh::PrimitiveType.
  546. {
  547. std::vector<std::string> scopePath;
  548. scopePath.push_back("Mesh");
  549. ScriptUtil::registerConstantString("TRIANGLES", "TRIANGLES", scopePath);
  550. ScriptUtil::registerConstantString("TRIANGLE_STRIP", "TRIANGLE_STRIP", scopePath);
  551. ScriptUtil::registerConstantString("LINES", "LINES", scopePath);
  552. ScriptUtil::registerConstantString("LINE_STRIP", "LINE_STRIP", scopePath);
  553. ScriptUtil::registerConstantString("POINTS", "POINTS", scopePath);
  554. }
  555. // Register enumeration Mouse::MouseEvent.
  556. {
  557. std::vector<std::string> scopePath;
  558. scopePath.push_back("Mouse");
  559. ScriptUtil::registerConstantString("MOUSE_PRESS_LEFT_BUTTON", "MOUSE_PRESS_LEFT_BUTTON", scopePath);
  560. ScriptUtil::registerConstantString("MOUSE_RELEASE_LEFT_BUTTON", "MOUSE_RELEASE_LEFT_BUTTON", scopePath);
  561. ScriptUtil::registerConstantString("MOUSE_PRESS_MIDDLE_BUTTON", "MOUSE_PRESS_MIDDLE_BUTTON", scopePath);
  562. ScriptUtil::registerConstantString("MOUSE_RELEASE_MIDDLE_BUTTON", "MOUSE_RELEASE_MIDDLE_BUTTON", scopePath);
  563. ScriptUtil::registerConstantString("MOUSE_PRESS_RIGHT_BUTTON", "MOUSE_PRESS_RIGHT_BUTTON", scopePath);
  564. ScriptUtil::registerConstantString("MOUSE_RELEASE_RIGHT_BUTTON", "MOUSE_RELEASE_RIGHT_BUTTON", scopePath);
  565. ScriptUtil::registerConstantString("MOUSE_MOVE", "MOUSE_MOVE", scopePath);
  566. ScriptUtil::registerConstantString("MOUSE_WHEEL", "MOUSE_WHEEL", scopePath);
  567. }
  568. // Register enumeration Node::Type.
  569. {
  570. std::vector<std::string> scopePath;
  571. scopePath.push_back("Node");
  572. ScriptUtil::registerConstantString("NODE", "NODE", scopePath);
  573. ScriptUtil::registerConstantString("JOINT", "JOINT", scopePath);
  574. }
  575. // Register enumeration ParticleEmitter::TextureBlending.
  576. {
  577. std::vector<std::string> scopePath;
  578. scopePath.push_back("ParticleEmitter");
  579. ScriptUtil::registerConstantString("BLEND_OPAQUE", "BLEND_OPAQUE", scopePath);
  580. ScriptUtil::registerConstantString("BLEND_TRANSPARENT", "BLEND_TRANSPARENT", scopePath);
  581. ScriptUtil::registerConstantString("BLEND_ADDITIVE", "BLEND_ADDITIVE", scopePath);
  582. ScriptUtil::registerConstantString("BLEND_MULTIPLIED", "BLEND_MULTIPLIED", scopePath);
  583. }
  584. // Register enumeration PhysicsCollisionObject::CollisionListener::EventType.
  585. {
  586. std::vector<std::string> scopePath;
  587. scopePath.push_back("PhysicsCollisionObject");
  588. scopePath.push_back("CollisionListener");
  589. ScriptUtil::registerConstantString("COLLIDING", "COLLIDING", scopePath);
  590. ScriptUtil::registerConstantString("NOT_COLLIDING", "NOT_COLLIDING", scopePath);
  591. }
  592. // Register enumeration PhysicsCollisionObject::Type.
  593. {
  594. std::vector<std::string> scopePath;
  595. scopePath.push_back("PhysicsCollisionObject");
  596. ScriptUtil::registerConstantString("RIGID_BODY", "RIGID_BODY", scopePath);
  597. ScriptUtil::registerConstantString("CHARACTER", "CHARACTER", scopePath);
  598. ScriptUtil::registerConstantString("GHOST_OBJECT", "GHOST_OBJECT", scopePath);
  599. ScriptUtil::registerConstantString("NONE", "NONE", scopePath);
  600. }
  601. // Register enumeration PhysicsCollisionShape::Type.
  602. {
  603. std::vector<std::string> scopePath;
  604. scopePath.push_back("PhysicsCollisionShape");
  605. ScriptUtil::registerConstantString("SHAPE_BOX", "SHAPE_BOX", scopePath);
  606. ScriptUtil::registerConstantString("SHAPE_SPHERE", "SHAPE_SPHERE", scopePath);
  607. ScriptUtil::registerConstantString("SHAPE_CAPSULE", "SHAPE_CAPSULE", scopePath);
  608. ScriptUtil::registerConstantString("SHAPE_MESH", "SHAPE_MESH", scopePath);
  609. ScriptUtil::registerConstantString("SHAPE_HEIGHTFIELD", "SHAPE_HEIGHTFIELD", scopePath);
  610. }
  611. // Register enumeration PhysicsController::Listener::EventType.
  612. {
  613. std::vector<std::string> scopePath;
  614. scopePath.push_back("PhysicsController");
  615. scopePath.push_back("Listener");
  616. ScriptUtil::registerConstantString("ACTIVATED", "ACTIVATED", scopePath);
  617. ScriptUtil::registerConstantString("DEACTIVATED", "DEACTIVATED", scopePath);
  618. }
  619. // Register enumeration Properties::Type.
  620. {
  621. std::vector<std::string> scopePath;
  622. scopePath.push_back("Properties");
  623. ScriptUtil::registerConstantString("NONE", "NONE", scopePath);
  624. ScriptUtil::registerConstantString("STRING", "STRING", scopePath);
  625. ScriptUtil::registerConstantString("NUMBER", "NUMBER", scopePath);
  626. ScriptUtil::registerConstantString("VECTOR2", "VECTOR2", scopePath);
  627. ScriptUtil::registerConstantString("VECTOR3", "VECTOR3", scopePath);
  628. ScriptUtil::registerConstantString("VECTOR4", "VECTOR4", scopePath);
  629. ScriptUtil::registerConstantString("MATRIX", "MATRIX", scopePath);
  630. }
  631. // Register enumeration RenderState::AutoBinding.
  632. {
  633. std::vector<std::string> scopePath;
  634. scopePath.push_back("RenderState");
  635. ScriptUtil::registerConstantString("NONE", "NONE", scopePath);
  636. ScriptUtil::registerConstantString("WORLD_MATRIX", "WORLD_MATRIX", scopePath);
  637. ScriptUtil::registerConstantString("VIEW_MATRIX", "VIEW_MATRIX", scopePath);
  638. ScriptUtil::registerConstantString("PROJECTION_MATRIX", "PROJECTION_MATRIX", scopePath);
  639. ScriptUtil::registerConstantString("WORLD_VIEW_MATRIX", "WORLD_VIEW_MATRIX", scopePath);
  640. ScriptUtil::registerConstantString("VIEW_PROJECTION_MATRIX", "VIEW_PROJECTION_MATRIX", scopePath);
  641. ScriptUtil::registerConstantString("WORLD_VIEW_PROJECTION_MATRIX", "WORLD_VIEW_PROJECTION_MATRIX", scopePath);
  642. ScriptUtil::registerConstantString("INVERSE_TRANSPOSE_WORLD_MATRIX", "INVERSE_TRANSPOSE_WORLD_MATRIX", scopePath);
  643. ScriptUtil::registerConstantString("INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX", "INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX", scopePath);
  644. ScriptUtil::registerConstantString("CAMERA_WORLD_POSITION", "CAMERA_WORLD_POSITION", scopePath);
  645. ScriptUtil::registerConstantString("CAMERA_VIEW_POSITION", "CAMERA_VIEW_POSITION", scopePath);
  646. ScriptUtil::registerConstantString("MATRIX_PALETTE", "MATRIX_PALETTE", scopePath);
  647. }
  648. // Register enumeration RenderState::Blend.
  649. {
  650. std::vector<std::string> scopePath;
  651. scopePath.push_back("RenderState");
  652. ScriptUtil::registerConstantString("BLEND_ZERO", "BLEND_ZERO", scopePath);
  653. ScriptUtil::registerConstantString("BLEND_ONE", "BLEND_ONE", scopePath);
  654. ScriptUtil::registerConstantString("BLEND_SRC_COLOR", "BLEND_SRC_COLOR", scopePath);
  655. ScriptUtil::registerConstantString("BLEN_ONE_MINUS_SRC_COLOR", "BLEN_ONE_MINUS_SRC_COLOR", scopePath);
  656. ScriptUtil::registerConstantString("BLEND_DST_COLOR", "BLEND_DST_COLOR", scopePath);
  657. ScriptUtil::registerConstantString("BLEND_ONE_MINUS_DST_COLOR", "BLEND_ONE_MINUS_DST_COLOR", scopePath);
  658. ScriptUtil::registerConstantString("BLEND_SRC_ALPHA", "BLEND_SRC_ALPHA", scopePath);
  659. ScriptUtil::registerConstantString("BLEND_ONE_MINUS_SRC_ALPHA", "BLEND_ONE_MINUS_SRC_ALPHA", scopePath);
  660. ScriptUtil::registerConstantString("BLEND_DST_ALPHA", "BLEND_DST_ALPHA", scopePath);
  661. ScriptUtil::registerConstantString("BLEND_ONE_MINUS_DST_ALPHA", "BLEND_ONE_MINUS_DST_ALPHA", scopePath);
  662. ScriptUtil::registerConstantString("BLEND_CONSTANT_ALPHA", "BLEND_CONSTANT_ALPHA", scopePath);
  663. ScriptUtil::registerConstantString("BLEND_ONE_MINUS_CONSTANT_ALPHA", "BLEND_ONE_MINUS_CONSTANT_ALPHA", scopePath);
  664. ScriptUtil::registerConstantString("BLEND_SRC_ALPHA_SATURATE", "BLEND_SRC_ALPHA_SATURATE", scopePath);
  665. }
  666. // Register enumeration Scene::DebugFlags.
  667. {
  668. std::vector<std::string> scopePath;
  669. scopePath.push_back("Scene");
  670. ScriptUtil::registerConstantString("DEBUG_BOXES", "DEBUG_BOXES", scopePath);
  671. ScriptUtil::registerConstantString("DEBUG_SPHERES", "DEBUG_SPHERES", scopePath);
  672. }
  673. // Register enumeration Texture::Filter.
  674. {
  675. std::vector<std::string> scopePath;
  676. scopePath.push_back("Texture");
  677. ScriptUtil::registerConstantString("NEAREST", "NEAREST", scopePath);
  678. ScriptUtil::registerConstantString("LINEAR", "LINEAR", scopePath);
  679. ScriptUtil::registerConstantString("NEAREST_MIPMAP_NEAREST", "NEAREST_MIPMAP_NEAREST", scopePath);
  680. ScriptUtil::registerConstantString("LINEAR_MIPMAP_NEAREST", "LINEAR_MIPMAP_NEAREST", scopePath);
  681. ScriptUtil::registerConstantString("NEAREST_MIPMAP_LINEAR", "NEAREST_MIPMAP_LINEAR", scopePath);
  682. ScriptUtil::registerConstantString("LINEAR_MIPMAP_LINEAR", "LINEAR_MIPMAP_LINEAR", scopePath);
  683. }
  684. // Register enumeration Texture::Format.
  685. {
  686. std::vector<std::string> scopePath;
  687. scopePath.push_back("Texture");
  688. ScriptUtil::registerConstantString("RGB", "RGB", scopePath);
  689. ScriptUtil::registerConstantString("RGBA", "RGBA", scopePath);
  690. ScriptUtil::registerConstantString("ALPHA", "ALPHA", scopePath);
  691. }
  692. // Register enumeration Texture::Wrap.
  693. {
  694. std::vector<std::string> scopePath;
  695. scopePath.push_back("Texture");
  696. ScriptUtil::registerConstantString("REPEAT", "REPEAT", scopePath);
  697. ScriptUtil::registerConstantString("CLAMP", "CLAMP", scopePath);
  698. }
  699. // Register enumeration Touch::TouchEvent.
  700. {
  701. std::vector<std::string> scopePath;
  702. scopePath.push_back("Touch");
  703. ScriptUtil::registerConstantString("TOUCH_PRESS", "TOUCH_PRESS", scopePath);
  704. ScriptUtil::registerConstantString("TOUCH_RELEASE", "TOUCH_RELEASE", scopePath);
  705. ScriptUtil::registerConstantString("TOUCH_MOVE", "TOUCH_MOVE", scopePath);
  706. }
  707. // Register enumeration VertexFormat::Usage.
  708. {
  709. std::vector<std::string> scopePath;
  710. scopePath.push_back("VertexFormat");
  711. ScriptUtil::registerConstantString("POSITION", "POSITION", scopePath);
  712. ScriptUtil::registerConstantString("NORMAL", "NORMAL", scopePath);
  713. ScriptUtil::registerConstantString("COLOR", "COLOR", scopePath);
  714. ScriptUtil::registerConstantString("TANGENT", "TANGENT", scopePath);
  715. ScriptUtil::registerConstantString("BINORMAL", "BINORMAL", scopePath);
  716. ScriptUtil::registerConstantString("BLENDWEIGHTS", "BLENDWEIGHTS", scopePath);
  717. ScriptUtil::registerConstantString("BLENDINDICES", "BLENDINDICES", scopePath);
  718. ScriptUtil::registerConstantString("TEXCOORD0", "TEXCOORD0", scopePath);
  719. ScriptUtil::registerConstantString("TEXCOORD1", "TEXCOORD1", scopePath);
  720. ScriptUtil::registerConstantString("TEXCOORD2", "TEXCOORD2", scopePath);
  721. ScriptUtil::registerConstantString("TEXCOORD3", "TEXCOORD3", scopePath);
  722. ScriptUtil::registerConstantString("TEXCOORD4", "TEXCOORD4", scopePath);
  723. ScriptUtil::registerConstantString("TEXCOORD5", "TEXCOORD5", scopePath);
  724. ScriptUtil::registerConstantString("TEXCOORD6", "TEXCOORD6", scopePath);
  725. ScriptUtil::registerConstantString("TEXCOORD7", "TEXCOORD7", scopePath);
  726. }
  727. }
  728. int lua____al_error_code(lua_State* state)
  729. {
  730. // Validate the number of parameters.
  731. if (lua_gettop(state) > 1)
  732. {
  733. lua_pushstring(state, "Invalid number of parameters (expected 0 or 1).");
  734. lua_error(state);
  735. }
  736. if (lua_gettop(state) == 1)
  737. {
  738. // Get parameter 1 off the stack.
  739. GP_WARN("Attempting to get parameter 1 with unrecognized type ALenum as an unsigned integer.");
  740. ALenum param1 = (ALenum)luaL_checkunsigned(state, 1);
  741. __al_error_code = param1;
  742. return 0;
  743. }
  744. else
  745. {
  746. ALenum result = __al_error_code;
  747. // Push the return value onto the stack.
  748. GP_WARN("Attempting to return value with unrecognized type ALenum as an unsigned integer.");
  749. lua_pushunsigned(state, result);
  750. return 1;
  751. }
  752. }
  753. int lua____gl_error_code(lua_State* state)
  754. {
  755. // Validate the number of parameters.
  756. if (lua_gettop(state) > 1)
  757. {
  758. lua_pushstring(state, "Invalid number of parameters (expected 0 or 1).");
  759. lua_error(state);
  760. }
  761. if (lua_gettop(state) == 1)
  762. {
  763. // Get parameter 1 off the stack.
  764. GP_WARN("Attempting to get parameter 1 with unrecognized type GLenum as an unsigned integer.");
  765. GLenum param1 = (GLenum)luaL_checkunsigned(state, 1);
  766. __gl_error_code = param1;
  767. return 0;
  768. }
  769. else
  770. {
  771. GLenum result = __gl_error_code;
  772. // Push the return value onto the stack.
  773. GP_WARN("Attempting to return value with unrecognized type GLenum as an unsigned integer.");
  774. lua_pushunsigned(state, result);
  775. return 1;
  776. }
  777. }
  778. int lua__printError(lua_State* state)
  779. {
  780. // Get the number of parameters.
  781. int paramCount = lua_gettop(state);
  782. // Attempt to match the parameters to a valid binding.
  783. switch (paramCount)
  784. {
  785. case 1:
  786. {
  787. if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
  788. {
  789. // Get parameter 1 off the stack.
  790. const char* param1 = ScriptUtil::getString(1, false);
  791. printError(param1);
  792. return 0;
  793. }
  794. else
  795. {
  796. lua_pushstring(state, "lua__printError - Failed to match the given parameters to a valid function signature.");
  797. lua_error(state);
  798. }
  799. break;
  800. }
  801. default:
  802. {
  803. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  804. lua_error(state);
  805. break;
  806. }
  807. }
  808. return 0;
  809. }
  810. static const char* enumStringEmpty = "";
  811. const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value)
  812. {
  813. if (enumname == "AIMessage::ParameterType")
  814. return lua_stringFromEnum_AIMessageParameterType((AIMessage::ParameterType)value);
  815. if (enumname == "AnimationClip::Listener::EventType")
  816. return lua_stringFromEnum_AnimationClipListenerEventType((AnimationClip::Listener::EventType)value);
  817. if (enumname == "AudioSource::State")
  818. return lua_stringFromEnum_AudioSourceState((AudioSource::State)value);
  819. if (enumname == "Camera::Type")
  820. return lua_stringFromEnum_CameraType((Camera::Type)value);
  821. if (enumname == "Container::Scroll")
  822. return lua_stringFromEnum_ContainerScroll((Container::Scroll)value);
  823. if (enumname == "Control::Alignment")
  824. return lua_stringFromEnum_ControlAlignment((Control::Alignment)value);
  825. if (enumname == "Control::Listener::EventType")
  826. return lua_stringFromEnum_ControlListenerEventType((Control::Listener::EventType)value);
  827. if (enumname == "Control::State")
  828. return lua_stringFromEnum_ControlState((Control::State)value);
  829. if (enumname == "Curve::InterpolationType")
  830. return lua_stringFromEnum_CurveInterpolationType((Curve::InterpolationType)value);
  831. if (enumname == "DepthStencilTarget::Format")
  832. return lua_stringFromEnum_DepthStencilTargetFormat((DepthStencilTarget::Format)value);
  833. if (enumname == "Font::Justify")
  834. return lua_stringFromEnum_FontJustify((Font::Justify)value);
  835. if (enumname == "Font::Style")
  836. return lua_stringFromEnum_FontStyle((Font::Style)value);
  837. if (enumname == "Game::ClearFlags")
  838. return lua_stringFromEnum_GameClearFlags((Game::ClearFlags)value);
  839. if (enumname == "Game::State")
  840. return lua_stringFromEnum_GameState((Game::State)value);
  841. if (enumname == "Gamepad::ButtonState")
  842. return lua_stringFromEnum_GamepadButtonState((Gamepad::ButtonState)value);
  843. if (enumname == "Gamepad::GamepadEvent")
  844. return lua_stringFromEnum_GamepadGamepadEvent((Gamepad::GamepadEvent)value);
  845. if (enumname == "Image::Format")
  846. return lua_stringFromEnum_ImageFormat((Image::Format)value);
  847. if (enumname == "Keyboard::Key")
  848. return lua_stringFromEnum_KeyboardKey((Keyboard::Key)value);
  849. if (enumname == "Keyboard::KeyEvent")
  850. return lua_stringFromEnum_KeyboardKeyEvent((Keyboard::KeyEvent)value);
  851. if (enumname == "Layout::Type")
  852. return lua_stringFromEnum_LayoutType((Layout::Type)value);
  853. if (enumname == "Light::Type")
  854. return lua_stringFromEnum_LightType((Light::Type)value);
  855. if (enumname == "Mesh::IndexFormat")
  856. return lua_stringFromEnum_MeshIndexFormat((Mesh::IndexFormat)value);
  857. if (enumname == "Mesh::PrimitiveType")
  858. return lua_stringFromEnum_MeshPrimitiveType((Mesh::PrimitiveType)value);
  859. if (enumname == "Mouse::MouseEvent")
  860. return lua_stringFromEnum_MouseMouseEvent((Mouse::MouseEvent)value);
  861. if (enumname == "Node::Type")
  862. return lua_stringFromEnum_NodeType((Node::Type)value);
  863. if (enumname == "ParticleEmitter::TextureBlending")
  864. return lua_stringFromEnum_ParticleEmitterTextureBlending((ParticleEmitter::TextureBlending)value);
  865. if (enumname == "PhysicsCollisionObject::CollisionListener::EventType")
  866. return lua_stringFromEnum_PhysicsCollisionObjectCollisionListenerEventType((PhysicsCollisionObject::CollisionListener::EventType)value);
  867. if (enumname == "PhysicsCollisionObject::Type")
  868. return lua_stringFromEnum_PhysicsCollisionObjectType((PhysicsCollisionObject::Type)value);
  869. if (enumname == "PhysicsCollisionShape::Type")
  870. return lua_stringFromEnum_PhysicsCollisionShapeType((PhysicsCollisionShape::Type)value);
  871. if (enumname == "PhysicsController::Listener::EventType")
  872. return lua_stringFromEnum_PhysicsControllerListenerEventType((PhysicsController::Listener::EventType)value);
  873. if (enumname == "Properties::Type")
  874. return lua_stringFromEnum_PropertiesType((Properties::Type)value);
  875. if (enumname == "RenderState::AutoBinding")
  876. return lua_stringFromEnum_RenderStateAutoBinding((RenderState::AutoBinding)value);
  877. if (enumname == "RenderState::Blend")
  878. return lua_stringFromEnum_RenderStateBlend((RenderState::Blend)value);
  879. if (enumname == "Scene::DebugFlags")
  880. return lua_stringFromEnum_SceneDebugFlags((Scene::DebugFlags)value);
  881. if (enumname == "Texture::Filter")
  882. return lua_stringFromEnum_TextureFilter((Texture::Filter)value);
  883. if (enumname == "Texture::Format")
  884. return lua_stringFromEnum_TextureFormat((Texture::Format)value);
  885. if (enumname == "Texture::Wrap")
  886. return lua_stringFromEnum_TextureWrap((Texture::Wrap)value);
  887. if (enumname == "Touch::TouchEvent")
  888. return lua_stringFromEnum_TouchTouchEvent((Touch::TouchEvent)value);
  889. if (enumname == "VertexFormat::Usage")
  890. return lua_stringFromEnum_VertexFormatUsage((VertexFormat::Usage)value);
  891. GP_ERROR("Unrecognized enumeration type '%s'.", enumname.c_str());
  892. return enumStringEmpty;
  893. }
  894. }