lua_Global.cpp 54 KB

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