tolua++urho3d.h 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // Copyright (c) 2008-2013 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "OctreeQuery.h"
  24. #include "PhysicsWorld.h"
  25. #include "Vector2.h"
  26. #include "Vector3.h"
  27. struct lua_State;
  28. namespace Urho3D
  29. {
  30. class SoundSource;
  31. class UIElement;
  32. }
  33. using namespace Urho3D;
  34. /// Check is String.
  35. #define tolua_isurho3dstring tolua_isstring
  36. /// Push String.
  37. #define tolua_pushurho3dstring(x, y) tolua_pushstring(x, y.CString())
  38. /// Convert to String.
  39. const char* tolua_tourho3dstring(lua_State* L, int narg, const char* str);
  40. /// Convert to String.
  41. const char* tolua_tourho3dstring(lua_State* L, int narg, const String& str);
  42. /// Check Lua table is Vector<T>.
  43. template<typename T> int tolua_isurho3dvector(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
  44. /// Check Lua table is Vector<String>.
  45. template<> int tolua_isurho3dvector<String>(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
  46. /// Convert Lua table to Vector<T>.
  47. template<typename T> void* tolua_tourho3dvector(lua_State* L, int narg, void* def);
  48. /// Convert Lua table to Vector<String>.
  49. template<> void* tolua_tourho3dvector<String>(lua_State* L, int narg, void* def);
  50. /// Push Vector<T> to Lua as a table.
  51. template<typename T> int tolua_pushurho3dvector(lua_State*L, void* data, const char* type);
  52. /// Push Vector<String> to Lua as a table.
  53. template<> int tolua_pushurho3dvector<String>(lua_State* L, void* data, const char* type);
  54. /// Check Lua table is Vector<T>.
  55. template<typename T> int tolua_isurho3dpodvector(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
  56. /// Check Lua table is Vector<unsigned>.
  57. template<> int tolua_isurho3dpodvector<unsigned>(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
  58. /// Convert Lua table to PODVector<T>.
  59. template<typename T> void* tolua_tourho3dpodvector(lua_State* L, int narg, void* def);
  60. /// Convert Lua table to PODVector<unsigned>.
  61. template<> void* tolua_tourho3dpodvector<unsigned>(lua_State* L, int narg, void* def);
  62. /// Push PODVector<T> to Lua as a table.
  63. template<typename T> int tolua_pushurho3dpodvector(lua_State* L, void* data, const char* type);
  64. /// Push PODVector<int> to Lua as a table.
  65. template<> int tolua_pushurho3dpodvector<int>(lua_State* L, void* data, const char* type);
  66. /// Push PODVector<unsigned> to Lua as a table.
  67. template<> int tolua_pushurho3dpodvector<unsigned>(lua_State* L, void* data, const char* type);
  68. /// Push PODVector<SoundSource*> to Lua as a table.
  69. template<> int tolua_pushurho3dpodvector<SoundSource*>(lua_State* L, void* data, const char* type);
  70. /// Push PODVector<UIElement*> to Lua as a table.
  71. template<> int tolua_pushurho3dpodvector<UIElement*>(lua_State* L, void* data, const char* type);
  72. /// Push PODVector<Vector3> to Lua as a table.
  73. template<> int tolua_pushurho3dpodvector<Vector3>(lua_State* L, void* data, const char* type);
  74. /// Push PODVector<IntVector2> to Lua as a table.
  75. template<> int tolua_pushurho3dpodvector<IntVector2>(lua_State* L, void* data, const char* type);
  76. /// Push PODVector<OctreeQueryResult> to Lua as a table.
  77. template<> int tolua_pushurho3dpodvector<OctreeQueryResult>(lua_State* L, void* data, const char* type);
  78. /// Push PODVector<PhysicsRaycastResult> to Lua as a table.
  79. template<> int tolua_pushurho3dpodvector<PhysicsRaycastResult>(lua_State* L, void* data, const char* type);
  80. /// Push PODVector<RayQueryResult> to Lua as a table.
  81. template<> int tolua_pushurho3dpodvector<RayQueryResult>(lua_State* L, void* data, const char* type);