Browse Source

Remove context from object's constructor, make all constructor look like AngleScript, rename file.

aster2013 12 years ago
parent
commit
d1c3d96844
35 changed files with 1015 additions and 153 deletions
  1. 1 1
      Source/Engine/LuaScript/LuaFunction.cpp
  2. 5 1
      Source/Engine/LuaScript/LuaScript.cpp
  3. 1 1
      Source/Engine/LuaScript/LuaScriptInstance.cpp
  4. 35 15
      Source/Engine/LuaScript/ToluaUtils.cpp
  5. 116 0
      Source/Engine/LuaScript/ToluaUtils.h
  6. 15 1
      Source/Engine/LuaScript/pkgs/Audio/Sound.pkg
  7. 14 1
      Source/Engine/LuaScript/pkgs/Graphics/Material.pkg
  8. 15 1
      Source/Engine/LuaScript/pkgs/Graphics/Texture2D.pkg
  9. 135 3
      Source/Engine/LuaScript/pkgs/Graphics/Viewport.pkg
  10. 123 3
      Source/Engine/LuaScript/pkgs/IO/File.pkg
  11. 69 2
      Source/Engine/LuaScript/pkgs/IO/PackageFile.pkg
  12. 13 1
      Source/Engine/LuaScript/pkgs/Scene/Node.pkg
  13. 13 1
      Source/Engine/LuaScript/pkgs/Scene/Scene.pkg
  14. 16 1
      Source/Engine/LuaScript/pkgs/UI/BorderImage.pkg
  15. 15 1
      Source/Engine/LuaScript/pkgs/UI/Button.pkg
  16. 15 1
      Source/Engine/LuaScript/pkgs/UI/CheckBox.pkg
  17. 15 1
      Source/Engine/LuaScript/pkgs/UI/Cursor.pkg
  18. 13 1
      Source/Engine/LuaScript/pkgs/UI/DropDownList.pkg
  19. 15 1
      Source/Engine/LuaScript/pkgs/UI/FileSelector.pkg
  20. 15 1
      Source/Engine/LuaScript/pkgs/UI/LineEdit.pkg
  21. 13 1
      Source/Engine/LuaScript/pkgs/UI/ListView.pkg
  22. 16 2
      Source/Engine/LuaScript/pkgs/UI/Menu.pkg
  23. 174 1
      Source/Engine/LuaScript/pkgs/UI/MessageBox.pkg
  24. 15 1
      Source/Engine/LuaScript/pkgs/UI/ScrollBar.pkg
  25. 15 1
      Source/Engine/LuaScript/pkgs/UI/ScrollView.pkg
  26. 15 1
      Source/Engine/LuaScript/pkgs/UI/Slider.pkg
  27. 15 1
      Source/Engine/LuaScript/pkgs/UI/Sprite.pkg
  28. 15 1
      Source/Engine/LuaScript/pkgs/UI/Text.pkg
  29. 13 1
      Source/Engine/LuaScript/pkgs/UI/Text3D.pkg
  30. 15 1
      Source/Engine/LuaScript/pkgs/UI/ToolTip.pkg
  31. 13 1
      Source/Engine/LuaScript/pkgs/UI/UIElement.pkg
  32. 15 1
      Source/Engine/LuaScript/pkgs/UI/View3D.pkg
  33. 15 1
      Source/Engine/LuaScript/pkgs/UI/Window.pkg
  34. 7 7
      Source/Engine/LuaScript/pkgs/basic.lua
  35. 0 94
      Source/Engine/LuaScript/tolua++urho3d.h

+ 1 - 1
Source/Engine/LuaScript/LuaFunction.cpp

@@ -34,7 +34,7 @@ extern "C"
 #include <lauxlib.h>
 #include <lauxlib.h>
 }
 }
 #include "tolua++.h"
 #include "tolua++.h"
-#include "tolua++urho3d.h"
+#include "ToluaUtils.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 

+ 5 - 1
Source/Engine/LuaScript/LuaScript.cpp

@@ -40,7 +40,7 @@ extern "C"
 #include <lauxlib.h>
 #include <lauxlib.h>
 }
 }
 #include "tolua++.h"
 #include "tolua++.h"
-#include "tolua++urho3d.h"
+#include "ToluaUtils.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
@@ -80,6 +80,8 @@ LuaScript::LuaScript(Context* context) :
         return;
         return;
     }
     }
 
 
+    SetContext(luaState_, context_);
+
     lua_gc(luaState_, LUA_GCSETPAUSE, 125);
     lua_gc(luaState_, LUA_GCSETPAUSE, 125);
     lua_atpanic(luaState_, &LuaScript::AtPanic);
     lua_atpanic(luaState_, &LuaScript::AtPanic);
 
 
@@ -114,6 +116,8 @@ LuaScript::~LuaScript()
     lua_State* luaState = luaState_;
     lua_State* luaState = luaState_;
     luaState_ = 0;
     luaState_ = 0;
 
 
+    SetContext(luaState_, 0);
+
     if (luaState)
     if (luaState)
         lua_close(luaState);
         lua_close(luaState);
 }
 }

+ 1 - 1
Source/Engine/LuaScript/LuaScriptInstance.cpp

@@ -44,7 +44,7 @@ extern "C"
 #include <lauxlib.h>
 #include <lauxlib.h>
 }
 }
 #include "tolua++.h"
 #include "tolua++.h"
-#include "tolua++urho3d.h"
+#include "ToluaUtils.h"
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 

+ 35 - 15
Source/Engine/LuaScript/tolua++urho3d.cpp → Source/Engine/LuaScript/ToluaUtils.cpp

@@ -23,7 +23,7 @@
 #include "Precompiled.h"
 #include "Precompiled.h"
 #include "Ptr.h"
 #include "Ptr.h"
 #include "tolua++.h"
 #include "tolua++.h"
-#include "tolua++urho3d.h"
+#include "ToluaUtils.h"
 
 
 const char* tolua_tourho3dstring(lua_State* L, int narg, const char* str)
 const char* tolua_tourho3dstring(lua_State* L, int narg, const char* str)
 {
 {
@@ -36,7 +36,27 @@ const char* tolua_tourho3dstring(lua_State* L, int narg, const String& str)
     return tolua_tourho3dstring(L, narg, str.CString());
     return tolua_tourho3dstring(L, narg, str.CString());
 }
 }
 
 
-template<> int tolua_isurho3dvector<String>(lua_State* L, int lo, const char* type, int def, tolua_Error* err)
+// Lua state to context mapping.
+static HashMap<void*, Context*> contextMapping;
+
+void SetContext(lua_State* L, Context* context)
+{
+    if (context == 0)
+        contextMapping.Erase(L);
+    else
+        contextMapping[L] = context;
+}
+
+Context* GetContext(lua_State* L)
+{   
+    HashMap<void*, Context*>::ConstIterator i = contextMapping.Find(L);
+    if (i == contextMapping.End())
+        return 0;
+
+    return i->second_;
+}
+
+template<> int ToluaIsVector<String>(lua_State* L, int lo, const char* type, int def, tolua_Error* err)
 {
 {
     if (lua_istable(L, lo))
     if (lua_istable(L, lo))
     {
     {
@@ -68,7 +88,7 @@ template<> int tolua_isurho3dvector<String>(lua_State* L, int lo, const char* ty
     return 0;
     return 0;
 }
 }
 
 
-template<> void* tolua_tourho3dvector<String>(lua_State* L, int narg, void* def)
+template<> void* ToluaToVector<String>(lua_State* L, int narg, void* def)
 {
 {
     if (!lua_istable(L, narg))
     if (!lua_istable(L, narg))
         return 0;
         return 0;
@@ -97,7 +117,7 @@ template<> void* tolua_tourho3dvector<String>(lua_State* L, int narg, void* def)
     return &result;
     return &result;
 }
 }
 
 
-template<> int tolua_pushurho3dvector<String>(lua_State* L, void* data, const char* type)
+template<> int ToluaPushVector<String>(lua_State* L, void* data, const char* type)
 {
 {
     const Vector<String>& vectorstring = *((const Vector<String>*)data);
     const Vector<String>& vectorstring = *((const Vector<String>*)data);
     lua_newtable(L);
     lua_newtable(L);
@@ -109,7 +129,7 @@ template<> int tolua_pushurho3dvector<String>(lua_State* L, void* data, const ch
     return 1;
     return 1;
 }
 }
 
 
-template<> int tolua_isurho3dpodvector<unsigned>(lua_State* L, int lo, const char* type, int def, tolua_Error* err)
+template<> int ToluaIsPODVector<unsigned>(lua_State* L, int lo, const char* type, int def, tolua_Error* err)
 {
 {
     if (lua_istable(L, lo))
     if (lua_istable(L, lo))
     {
     {
@@ -141,7 +161,7 @@ template<> int tolua_isurho3dpodvector<unsigned>(lua_State* L, int lo, const cha
     return 0;
     return 0;
 }
 }
 
 
-template<> void* tolua_tourho3dpodvector<unsigned>(lua_State* L, int narg, void* def)
+template<> void* ToluaToPODVector<unsigned>(lua_State* L, int narg, void* def)
 {
 {
     if (!lua_istable(L, narg))
     if (!lua_istable(L, narg))
         return 0;
         return 0;
@@ -170,7 +190,7 @@ template<> void* tolua_tourho3dpodvector<unsigned>(lua_State* L, int narg, void*
     return &result;
     return &result;
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<int>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<int>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     const PODVector<int>& vector = *((const PODVector<int>*)data);
     const PODVector<int>& vector = *((const PODVector<int>*)data);
     lua_newtable(L);
     lua_newtable(L);
@@ -183,7 +203,7 @@ template<> int tolua_pushurho3dpodvector<int>(lua_State* L, void* data, const ch
     return 1;
     return 1;
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<unsigned>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<unsigned>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     const PODVector<unsigned>& vector = *((const PODVector<unsigned>*)data);
     const PODVector<unsigned>& vector = *((const PODVector<unsigned>*)data);
     lua_newtable(L);
     lua_newtable(L);
@@ -196,7 +216,7 @@ template<> int tolua_pushurho3dpodvector<unsigned>(lua_State* L, void* data, con
     return 1;
     return 1;
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<SoundSource*>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<SoundSource*>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     const PODVector<SoundSource*>& vector = *((const PODVector<SoundSource*>*)data);
     const PODVector<SoundSource*>& vector = *((const PODVector<SoundSource*>*)data);
     lua_newtable(L);
     lua_newtable(L);
@@ -208,7 +228,7 @@ template<> int tolua_pushurho3dpodvector<SoundSource*>(lua_State* L, void* data,
     return 1;
     return 1;
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<UIElement*>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<UIElement*>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     const PODVector<UIElement*>& vector = *((const PODVector<UIElement*>*)data);
     const PODVector<UIElement*>& vector = *((const PODVector<UIElement*>*)data);
     lua_newtable(L);
     lua_newtable(L);
@@ -235,27 +255,27 @@ template<typename T> int tolua_pushurho3dpodvectorusertype(lua_State* L, const P
     return 1;
     return 1;
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<Vector3>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<Vector3>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<Vector3>*)data), "Vector3");
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<Vector3>*)data), "Vector3");
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<IntVector2>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<IntVector2>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<IntVector2>*)data), "IntVector2");
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<IntVector2>*)data), "IntVector2");
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<OctreeQueryResult>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<OctreeQueryResult>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<OctreeQueryResult>*)data), "OctreeQueryResult");
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<OctreeQueryResult>*)data), "OctreeQueryResult");
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<PhysicsRaycastResult>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<PhysicsRaycastResult>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<PhysicsRaycastResult>*)data), "PhysicsRaycastResult");
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<PhysicsRaycastResult>*)data), "PhysicsRaycastResult");
 }
 }
 
 
-template<> int tolua_pushurho3dpodvector<RayQueryResult>(lua_State* L, void* data, const char* /*type*/)
+template<> int ToluaPushPODVector<RayQueryResult>(lua_State* L, void* data, const char* /*type*/)
 {
 {
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<RayQueryResult>*)data), "RayQueryResult");
     return tolua_pushurho3dpodvectorusertype(L, *((const PODVector<RayQueryResult>*)data), "RayQueryResult");
 }
 }

+ 116 - 0
Source/Engine/LuaScript/ToluaUtils.h

@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2008-2013 the Urho3D project.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#pragma once
+
+#include "OctreeQuery.h"
+#include "PhysicsWorld.h"
+#include "Vector2.h"
+#include "Vector3.h"
+
+struct lua_State;
+
+namespace Urho3D
+{
+class Context;
+class SoundSource;
+class UIElement;
+}
+
+using namespace Urho3D;
+
+/// Check is String.
+#define tolua_isurho3dstring tolua_isstring
+/// Push String.
+#define tolua_pushurho3dstring(x, y) tolua_pushstring(x, y.CString())
+/// Convert to String.
+const char* tolua_tourho3dstring(lua_State* L, int narg, const char* str);
+/// Convert to String.
+const char* tolua_tourho3dstring(lua_State* L, int narg, const String& str);
+
+/// Set context.
+void SetContext(lua_State* L, Context* context);
+/// Return context.
+Context* GetContext(lua_State* L);
+
+/// Create new object.
+template<typename T> int ToluaNewObject(lua_State* tolua_S)
+{
+    T* object = Mtolua_new(T(GetContext(tolua_S)));
+    tolua_pushusertype(tolua_S, (void*)object,T::GetTypeNameStatic().CString());
+    return 1;
+}
+/// Create new object with GC.
+template<typename T> int ToluaNewObjectGC(lua_State* tolua_S)
+{
+    T* object = Mtolua_new(T(GetContext(tolua_S)));
+    tolua_pushusertype(tolua_S, (void*)object,T::GetTypeNameStatic().CString());
+    tolua_register_gc(tolua_S, lua_gettop(tolua_S));
+    return 1;
+}
+
+/// Check Lua table is Vector<T>.
+template<typename T> int ToluaIsVector(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
+/// Check Lua table is Vector<String>.
+template<> int ToluaIsVector<String>(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
+
+/// Convert Lua table to Vector<T>.
+template<typename T> void* ToluaToVector(lua_State* L, int narg, void* def);
+/// Convert Lua table to Vector<String>.
+template<> void* ToluaToVector<String>(lua_State* L, int narg, void* def);
+
+/// Push Vector<T> to Lua as a table.
+template<typename T> int ToluaPushVector(lua_State*L, void* data, const char* type);
+/// Push Vector<String> to Lua as a table.
+template<> int ToluaPushVector<String>(lua_State* L, void* data, const char* type);
+
+/// Check Lua table is Vector<T>.
+template<typename T> int ToluaIsPODVector(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
+/// Check Lua table is Vector<unsigned>.
+template<> int ToluaIsPODVector<unsigned>(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
+
+/// Convert Lua table to PODVector<T>.
+template<typename T> void* ToluaToPODVector(lua_State* L, int narg, void* def);
+/// Convert Lua table to PODVector<unsigned>.
+template<> void* ToluaToPODVector<unsigned>(lua_State* L, int narg, void* def);
+
+/// Push PODVector<T> to Lua as a table.
+template<typename T> int ToluaPushPODVector(lua_State* L, void* data, const char* type);
+/// Push PODVector<int> to Lua as a table.
+template<> int ToluaPushPODVector<int>(lua_State* L, void* data, const char* type);
+/// Push PODVector<unsigned> to Lua as a table.
+template<> int ToluaPushPODVector<unsigned>(lua_State* L, void* data, const char* type);
+/// Push PODVector<SoundSource*> to Lua as a table.
+template<> int ToluaPushPODVector<SoundSource*>(lua_State* L, void* data, const char* type);
+/// Push PODVector<UIElement*> to Lua as a table.
+template<> int ToluaPushPODVector<UIElement*>(lua_State* L, void* data, const char* type);
+
+/// Push PODVector<Vector3> to Lua as a table.
+template<> int ToluaPushPODVector<Vector3>(lua_State* L, void* data, const char* type);
+/// Push PODVector<IntVector2> to Lua as a table.
+template<> int ToluaPushPODVector<IntVector2>(lua_State* L, void* data, const char* type);
+/// Push PODVector<OctreeQueryResult> to Lua as a table.
+template<> int ToluaPushPODVector<OctreeQueryResult>(lua_State* L, void* data, const char* type);
+/// Push PODVector<PhysicsRaycastResult> to Lua as a table.
+template<> int ToluaPushPODVector<PhysicsRaycastResult>(lua_State* L, void* data, const char* type);
+/// Push PODVector<RayQueryResult> to Lua as a table.
+template<> int ToluaPushPODVector<RayQueryResult>(lua_State* L, void* data, const char* type);

+ 15 - 1
Source/Engine/LuaScript/pkgs/Audio/Sound.pkg

@@ -2,7 +2,7 @@ $#include "Sound.h"
 
 
 class Sound : public Resource
 class Sound : public Resource
 {
 {
-    Sound(Context* context);
+    Sound();
     ~Sound();
     ~Sound();
     bool LoadRaw(Deserializer& source);
     bool LoadRaw(Deserializer& source);
     bool LoadWav(Deserializer& source);
     bool LoadWav(Deserializer& source);
@@ -33,3 +33,17 @@ class Sound : public Resource
     tolua_readonly tolua_property__is_set bool stereo;
     tolua_readonly tolua_property__is_set bool stereo;
     tolua_readonly tolua_property__is_set bool compressed;
     tolua_readonly tolua_property__is_set bool compressed;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_AudioLuaAPI_Sound_new00
+static int tolua_AudioLuaAPI_Sound_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Sound>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_AudioLuaAPI_Sound_new00_local
+static int tolua_AudioLuaAPI_Sound_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Sound>(tolua_S);
+}
+$}

+ 14 - 1
Source/Engine/LuaScript/pkgs/Graphics/Material.pkg

@@ -4,7 +4,7 @@ enum CullMode{};
 
 
 class Material : public Resource
 class Material : public Resource
 {
 {
-    Material(Context* context);
+    Material();
     ~Material();
     ~Material();
     
     
     void SetNumTechniques(unsigned num);
     void SetNumTechniques(unsigned num);
@@ -45,3 +45,16 @@ class Material : public Resource
     tolua_readonly tolua_property__get_set bool specular;
     tolua_readonly tolua_property__get_set bool specular;
 };
 };
 
 
+${
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Material_new00
+static int tolua_GraphicsLuaAPI_Material_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Material>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Material_new00_local
+static int tolua_GraphicsLuaAPI_Material_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Material>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/Graphics/Texture2D.pkg

@@ -4,7 +4,7 @@ enum TextureUsage{};
 
 
 class Texture2D : public Texture
 class Texture2D : public Texture
 {
 {
-    Texture2D(Context* context);
+    Texture2D();
     ~Texture2D();
     ~Texture2D();
     
     
     bool SetSize(int width, int height, unsigned format, TextureUsage usage = TEXTURE_STATIC);
     bool SetSize(int width, int height, unsigned format, TextureUsage usage = TEXTURE_STATIC);
@@ -13,3 +13,17 @@ class Texture2D : public Texture
     
     
     tolua_readonly tolua_property__get_set RenderSurface* renderSurface;
     tolua_readonly tolua_property__get_set RenderSurface* renderSurface;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Texture2D_new00
+static int tolua_GraphicsLuaAPI_Texture2D_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Texture2D>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Texture2D_new00_local
+static int tolua_GraphicsLuaAPI_Texture2D_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Texture2D>(tolua_S);
+}
+$}

+ 135 - 3
Source/Engine/LuaScript/pkgs/Graphics/Viewport.pkg

@@ -2,9 +2,9 @@ $#include "Viewport.h"
 
 
 class Viewport
 class Viewport
 {
 {
-    Viewport(Context* context);
-    Viewport(Context* context, Scene* scene, Camera* camera, RenderPath* renderPath = 0);
-    Viewport(Context* context, Scene* scene, Camera* camera, const IntRect& rect, RenderPath* renderPath = 0);
+    Viewport();
+    Viewport(Scene* scene, Camera* camera, RenderPath* renderPath = 0);
+    Viewport(Scene* scene, Camera* camera, const IntRect& rect, RenderPath* renderPath = 0);
     ~Viewport();
     ~Viewport();
     
     
     void SetScene(Scene* scene);
     void SetScene(Scene* scene);
@@ -23,3 +23,135 @@ class Viewport
     tolua_property__get_set IntRect& rect;
     tolua_property__get_set IntRect& rect;
     tolua_property__get_set RenderPath* renderPath;
     tolua_property__get_set RenderPath* renderPath;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new00
+static int tolua_GraphicsLuaAPI_Viewport_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Viewport>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new00_local
+static int tolua_GraphicsLuaAPI_Viewport_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Viewport>(tolua_S);
+}
+
+/* method: new of class  Viewport */
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new01
+static int tolua_GraphicsLuaAPI_Viewport_new01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"RenderPath",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  Scene* scene = ((Scene*)  tolua_tousertype(tolua_S,2,0));
+  Camera* camera = ((Camera*)  tolua_tousertype(tolua_S,3,0));
+  RenderPath* renderPath = ((RenderPath*)  tolua_tousertype(tolua_S,4,0));
+ {
+  Viewport* tolua_ret = (Viewport*)  Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,renderPath));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_GraphicsLuaAPI_Viewport_new00(tolua_S);
+}
+
+/* method: new_local of class  Viewport */
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new01_local
+static int tolua_GraphicsLuaAPI_Viewport_new01_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"RenderPath",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  Scene* scene = ((Scene*)  tolua_tousertype(tolua_S,2,0));
+  Camera* camera = ((Camera*)  tolua_tousertype(tolua_S,3,0));
+  RenderPath* renderPath = ((RenderPath*)  tolua_tousertype(tolua_S,4,0));
+ {
+  Viewport* tolua_ret = (Viewport*)  Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,renderPath));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_GraphicsLuaAPI_Viewport_new00_local(tolua_S);
+}
+
+/* method: new of class  Viewport */
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new02
+static int tolua_GraphicsLuaAPI_Viewport_new02(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const IntRect",0,&tolua_err)) ||
+ !tolua_isusertype(tolua_S,5,"RenderPath",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  Scene* scene = ((Scene*)  tolua_tousertype(tolua_S,2,0));
+  Camera* camera = ((Camera*)  tolua_tousertype(tolua_S,3,0));
+  const IntRect* rect = ((const IntRect*)  tolua_tousertype(tolua_S,4,0));
+  RenderPath* renderPath = ((RenderPath*)  tolua_tousertype(tolua_S,5,0));
+ {
+  Viewport* tolua_ret = (Viewport*)  Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,*rect,renderPath));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_GraphicsLuaAPI_Viewport_new01(tolua_S);
+}
+
+/* method: new_local of class  Viewport */
+#define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Viewport_new02_local
+static int tolua_GraphicsLuaAPI_Viewport_new02_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"Viewport",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"Scene",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"Camera",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const IntRect",0,&tolua_err)) ||
+ !tolua_isusertype(tolua_S,5,"RenderPath",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  Scene* scene = ((Scene*)  tolua_tousertype(tolua_S,2,0));
+  Camera* camera = ((Camera*)  tolua_tousertype(tolua_S,3,0));
+  const IntRect* rect = ((const IntRect*)  tolua_tousertype(tolua_S,4,0));
+  RenderPath* renderPath = ((RenderPath*)  tolua_tousertype(tolua_S,5,0));
+ {
+  Viewport* tolua_ret = (Viewport*)  Mtolua_new((Viewport)(GetContext(tolua_S),scene,camera,*rect,renderPath));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Viewport");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_GraphicsLuaAPI_Viewport_new01_local(tolua_S);
+}
+$}

+ 123 - 3
Source/Engine/LuaScript/pkgs/IO/File.pkg

@@ -9,9 +9,9 @@ enum FileMode
 
 
 class File : public Object
 class File : public Object
 {
 {
-    File(Context* context);
-    File(Context* context, const String fileName, FileMode mode = FILE_READ);
-    File(Context* context, PackageFile* package, const String fileName);
+    File();
+    File(const String fileName, FileMode mode = FILE_READ);
+    File(PackageFile* package, const String fileName);
     ~File();
     ~File();
     
     
     bool Open(const String fileName, FileMode mode = FILE_READ);
     bool Open(const String fileName, FileMode mode = FILE_READ);
@@ -124,3 +124,123 @@ class File : public Object
     tolua_readonly tolua_property__get_set unsigned size;
     tolua_readonly tolua_property__get_set unsigned size;
     tolua_readonly tolua_property__is_set bool eof;
     tolua_readonly tolua_property__is_set bool eof;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_IOLuaAPI_File_new00
+static int tolua_IOLuaAPI_File_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<File>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_IOLuaAPI_File_new00_local
+static int tolua_IOLuaAPI_File_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<File>(tolua_S);
+}
+
+/* method: new of class  File */
+#define TOLUA_DISABLE_tolua_IOLuaAPI_File_new01
+static int tolua_IOLuaAPI_File_new01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"File",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String fileName = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+  FileMode mode = ((FileMode) (int)  tolua_tonumber(tolua_S,3,FILE_READ));
+ {
+  File* tolua_ret = (File*)  Mtolua_new((File)(GetContext(tolua_S),fileName,mode));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"File");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_IOLuaAPI_File_new00(tolua_S);
+}
+
+/* method: new_local of class  File */
+#define TOLUA_DISABLE_tolua_IOLuaAPI_File_new01_local
+static int tolua_IOLuaAPI_File_new01_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"File",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String fileName = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+  FileMode mode = ((FileMode) (int)  tolua_tonumber(tolua_S,3,FILE_READ));
+ {
+  File* tolua_ret = (File*)  Mtolua_new((File)(GetContext(tolua_S),fileName,mode));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"File");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_IOLuaAPI_File_new00_local(tolua_S);
+}
+
+/* method: new of class  File */
+#define TOLUA_DISABLE_tolua_IOLuaAPI_File_new02
+static int tolua_IOLuaAPI_File_new02(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"File",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"PackageFile",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  PackageFile* package = ((PackageFile*)  tolua_tousertype(tolua_S,2,0));
+  const String fileName = ((const String)  tolua_tourho3dstring(tolua_S,3,0));
+ {
+  File* tolua_ret = (File*)  Mtolua_new((File)(GetContext(tolua_S),package,fileName));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"File");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_IOLuaAPI_File_new01(tolua_S);
+}
+
+/* method: new_local of class  File */
+#define TOLUA_DISABLE_tolua_IOLuaAPI_File_new02_local
+static int tolua_IOLuaAPI_File_new02_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"File",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"PackageFile",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  PackageFile* package = ((PackageFile*)  tolua_tousertype(tolua_S,2,0));
+  const String fileName = ((const String)  tolua_tourho3dstring(tolua_S,3,0));
+ {
+  File* tolua_ret = (File*)  Mtolua_new((File)(GetContext(tolua_S),package,fileName));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"File");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_IOLuaAPI_File_new01_local(tolua_S);
+}
+$}

+ 69 - 2
Source/Engine/LuaScript/pkgs/IO/PackageFile.pkg

@@ -9,8 +9,8 @@ struct PackageEntry
 
 
 class PackageFile : public Object
 class PackageFile : public Object
 {
 {
-    PackageFile(Context* context);
-    PackageFile(Context* context, const String fileName, unsigned startOffset = 0);
+    PackageFile();
+    PackageFile(const String fileName, unsigned startOffset = 0);
     ~PackageFile();
     ~PackageFile();
     
     
     bool Open(const String fileName, unsigned startOffset = 0);
     bool Open(const String fileName, unsigned startOffset = 0);
@@ -32,3 +32,70 @@ class PackageFile : public Object
     tolua_readonly tolua_property__get_set unsigned checksum;
     tolua_readonly tolua_property__get_set unsigned checksum;
     tolua_readonly tolua_property__is_set bool compressed;
     tolua_readonly tolua_property__is_set bool compressed;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new00
+static int tolua_IOLuaAPI_PackageFile_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<PackageFile>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new00_local
+static int tolua_IOLuaAPI_PackageFile_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<PackageFile>(tolua_S);
+}
+
+/* method: new of class  PackageFile */
+#define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new01
+static int tolua_IOLuaAPI_PackageFile_new01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"PackageFile",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String fileName = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+  unsigned startOffset = ((unsigned)  tolua_tonumber(tolua_S,3,0));
+ {
+  PackageFile* tolua_ret = (PackageFile*)  Mtolua_new((PackageFile)(GetContext(tolua_S),fileName,startOffset));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"PackageFile");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_IOLuaAPI_PackageFile_new00(tolua_S);
+}
+
+/* method: new_local of class  PackageFile */
+#define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new01_local
+static int tolua_IOLuaAPI_PackageFile_new01_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"PackageFile",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String fileName = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+  unsigned startOffset = ((unsigned)  tolua_tonumber(tolua_S,3,0));
+ {
+  PackageFile* tolua_ret = (PackageFile*)  Mtolua_new((PackageFile)(GetContext(tolua_S),fileName,startOffset));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"PackageFile");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_IOLuaAPI_PackageFile_new00_local(tolua_S);
+}
+$}

+ 13 - 1
Source/Engine/LuaScript/pkgs/Scene/Node.pkg

@@ -10,7 +10,7 @@ enum CreateMode
 
 
 class Node : public Serializable
 class Node : public Serializable
 {
 {
-    Node(Context* context);
+    Node();
     virtual ~Node();
     virtual ~Node();
 
 
     tolua_outside bool NodeSaveXML @ SaveXML(File* dest) const;
     tolua_outside bool NodeSaveXML @ SaveXML(File* dest) const;
@@ -214,6 +214,18 @@ class Node : public Serializable
 };
 };
 
 
 ${
 ${
+#define TOLUA_DISABLE_tolua_SceneLuaAPI_Node_new00
+static int tolua_SceneLuaAPI_Node_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Node>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_SceneLuaAPI_Node_new00_local
+static int tolua_SceneLuaAPI_Node_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Node>(tolua_S);
+}
+
 static bool NodeSaveXML(const Node* node, File* file)
 static bool NodeSaveXML(const Node* node, File* file)
 {
 {
     return file ? node->SaveXML(*file) : false;
     return file ? node->SaveXML(*file) : false;

+ 13 - 1
Source/Engine/LuaScript/pkgs/Scene/Scene.pkg

@@ -7,7 +7,7 @@ static const unsigned LAST_LOCAL_ID;
 
 
 class Scene : public Node
 class Scene : public Node
 {
 {
-    Scene(Context* context);
+    Scene();
     virtual ~Scene();
     virtual ~Scene();
     
     
     tolua_outside bool SceneLoad @ Load(File* source);
     tolua_outside bool SceneLoad @ Load(File* source);
@@ -80,6 +80,18 @@ class Scene : public Node
 };
 };
 
 
 ${
 ${
+#define TOLUA_DISABLE_tolua_SceneLuaAPI_Scene_new00
+static int tolua_SceneLuaAPI_Scene_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Scene>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_SceneLuaAPI_Scene_new00_local
+static int tolua_SceneLuaAPI_Scene_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Scene>(tolua_S);
+}
+
 static bool SceneLoad(Scene* scene, File* file)
 static bool SceneLoad(Scene* scene, File* file)
 {
 {
     return file ? scene->Load(*file) : false;
     return file ? scene->Load(*file) : false;

+ 16 - 1
Source/Engine/LuaScript/pkgs/UI/BorderImage.pkg

@@ -4,7 +4,7 @@ enum BlendMode{};
 
 
 class BorderImage : public UIElement
 class BorderImage : public UIElement
 {
 {
-    BorderImage(Context* context);
+    BorderImage();
     virtual ~BorderImage();
     virtual ~BorderImage();
     
     
     void SetTexture(Texture* texture);
     void SetTexture(Texture* texture);
@@ -34,3 +34,18 @@ class BorderImage : public UIElement
     tolua_property__is_set bool tiled;
     tolua_property__is_set bool tiled;
     tolua_property__get_set ResourceRef textureAttr;
     tolua_property__get_set ResourceRef textureAttr;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_BorderImage_new00
+static int tolua_UILuaAPI_BorderImage_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<BorderImage>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_BorderImage_new00_local
+static int tolua_UILuaAPI_BorderImage_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<BorderImage>(tolua_S);
+}
+$}
+

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/Button.pkg

@@ -2,7 +2,7 @@ $#include "Button.h"
 
 
 class Button : public BorderImage
 class Button : public BorderImage
 {
 {
-    Button(Context* context);
+    Button();
     virtual ~Button();
     virtual ~Button();
     
     
     void SetPressedOffset(const IntVector2& offset);
     void SetPressedOffset(const IntVector2& offset);
@@ -25,3 +25,17 @@ class Button : public BorderImage
     tolua_property__get_set float repeatRate;
     tolua_property__get_set float repeatRate;
     tolua_readonly tolua_property__is_set bool pressed;
     tolua_readonly tolua_property__is_set bool pressed;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Button_new00
+static int tolua_UILuaAPI_Button_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Button>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Button_new00_local
+static int tolua_UILuaAPI_Button_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Button>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/CheckBox.pkg

@@ -2,7 +2,7 @@ $#include "CheckBox.h"
 
 
 class CheckBox : public BorderImage
 class CheckBox : public BorderImage
 {
 {
-    CheckBox(Context* context);
+    CheckBox();
     virtual ~CheckBox();
     virtual ~CheckBox();
     
     
     void SetChecked(bool enable);
     void SetChecked(bool enable);
@@ -15,3 +15,17 @@ class CheckBox : public BorderImage
     tolua_property__is_set bool checked;
     tolua_property__is_set bool checked;
     tolua_property__get_set IntVector2& checkedOffset;
     tolua_property__get_set IntVector2& checkedOffset;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_CheckBox_new00
+static int tolua_UILuaAPI_CheckBox_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<CheckBox>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_CheckBox_new00_local
+static int tolua_UILuaAPI_CheckBox_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<CheckBox>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/Cursor.pkg

@@ -15,7 +15,7 @@ enum CursorShape
 
 
 class Cursor : public BorderImage
 class Cursor : public BorderImage
 {
 {
-    Cursor(Context* context);
+    Cursor();
     virtual ~Cursor();
     virtual ~Cursor();
     
     
     void DefineShape(CursorShape shape, Image* image, const IntRect& imageRect, const IntVector2& hotSpot);
     void DefineShape(CursorShape shape, Image* image, const IntRect& imageRect, const IntVector2& hotSpot);
@@ -28,3 +28,17 @@ class Cursor : public BorderImage
     tolua_property__get_set CursorShape shape;
     tolua_property__get_set CursorShape shape;
     tolua_property__get_set bool useSystemShapes;
     tolua_property__get_set bool useSystemShapes;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Cursor_new00
+static int tolua_UILuaAPI_Cursor_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Cursor>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Cursor_new00_local
+static int tolua_UILuaAPI_Cursor_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Cursor>(tolua_S);
+}
+$}

+ 13 - 1
Source/Engine/LuaScript/pkgs/UI/DropDownList.pkg

@@ -2,7 +2,7 @@ $#include "DropDownList.h"
 
 
 class DropDownList : public Menu
 class DropDownList : public Menu
 {
 {
-    DropDownList(Context* context);
+    DropDownList();
     ~DropDownList();
     ~DropDownList();
     
     
     void AddItem(UIElement* item);
     void AddItem(UIElement* item);
@@ -39,6 +39,18 @@ class DropDownList : public Menu
 };
 };
 
 
 ${
 ${
+#define TOLUA_DISABLE_tolua_UILuaAPI_DropDownList_new00
+static int tolua_UILuaAPI_DropDownList_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<DropDownList>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_DropDownList_new00_local
+static int tolua_UILuaAPI_DropDownList_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<DropDownList>(tolua_S);
+}
+
 static const PODVector<UIElement*>& DropDownListGetItems(const DropDownList* list)
 static const PODVector<UIElement*>& DropDownListGetItems(const DropDownList* list)
 {
 {
     static PODVector<UIElement*> items;
     static PODVector<UIElement*> items;

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/FileSelector.pkg

@@ -8,7 +8,7 @@ struct FileSelectorEntry
 
 
 class FileSelector : public Object
 class FileSelector : public Object
 {
 {
-    FileSelector(Context* context);
+    FileSelector();
     virtual ~FileSelector();
     virtual ~FileSelector();
 
 
     void SetDefaultStyle(XMLFile* style);
     void SetDefaultStyle(XMLFile* style);
@@ -55,3 +55,17 @@ class FileSelector : public Object
     tolua_readonly tolua_property__get_set unsigned filterIndex;
     tolua_readonly tolua_property__get_set unsigned filterIndex;
     tolua_property__get_set bool directoryMode;
     tolua_property__get_set bool directoryMode;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_FileSelector_new00
+static int tolua_UILuaAPI_FileSelector_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<FileSelector>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_FileSelector_new00_local
+static int tolua_UILuaAPI_FileSelector_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<FileSelector>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/LineEdit.pkg

@@ -2,7 +2,7 @@ $#include "LineEdit.h"
 
 
 class LineEdit : public BorderImage
 class LineEdit : public BorderImage
 {
 {
-    LineEdit(Context* context);
+    LineEdit();
     virtual ~LineEdit();
     virtual ~LineEdit();
     
     
     void SetText(const String text);
     void SetText(const String text);
@@ -37,3 +37,17 @@ class LineEdit : public BorderImage
     tolua_readonly tolua_property__get_set Text* textElement;
     tolua_readonly tolua_property__get_set Text* textElement;
     tolua_readonly tolua_property__get_set BorderImage* cursor;
     tolua_readonly tolua_property__get_set BorderImage* cursor;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_LineEdit_new00
+static int tolua_UILuaAPI_LineEdit_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<LineEdit>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_LineEdit_new00_local
+static int tolua_UILuaAPI_LineEdit_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<LineEdit>(tolua_S);
+}
+$}

+ 13 - 1
Source/Engine/LuaScript/pkgs/UI/ListView.pkg

@@ -9,7 +9,7 @@ enum HighlightMode
 
 
 class ListView : public ScrollView
 class ListView : public ScrollView
 {
 {
-    ListView(Context* context);
+    ListView();
     virtual ~ListView();
     virtual ~ListView();
     
     
     void AddItem(UIElement* item);
     void AddItem(UIElement* item);
@@ -65,6 +65,18 @@ class ListView : public ScrollView
 };
 };
 
 
 ${
 ${
+#define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00
+static int tolua_UILuaAPI_ListView_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<ListView>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_ListView_new00_local
+static int tolua_UILuaAPI_ListView_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<ListView>(tolua_S);
+}
+
 static const PODVector<UIElement*>& ListViewGetItems(const ListView* listView)
 static const PODVector<UIElement*>& ListViewGetItems(const ListView* listView)
 {
 {
     static PODVector<UIElement*> items;
     static PODVector<UIElement*> items;

+ 16 - 2
Source/Engine/LuaScript/pkgs/UI/Menu.pkg

@@ -2,7 +2,7 @@ $#include "Menu.h"
 
 
 class Menu : public Button
 class Menu : public Button
 {
 {
-    Menu(Context* context);
+    Menu();
     virtual ~Menu();
     virtual ~Menu();
     
     
     void SetPopup(UIElement* element);
     void SetPopup(UIElement* element);
@@ -24,4 +24,18 @@ class Menu : public Button
     tolua_readonly tolua_property__get_set int acceleratorQualifiers;
     tolua_readonly tolua_property__get_set int acceleratorQualifiers;
 };
 };
 
 
-$#define SetShowPopup ShowPopup
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Menu_new00
+static int tolua_UILuaAPI_Menu_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Menu>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Menu_new00_local
+static int tolua_UILuaAPI_Menu_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Menu>(tolua_S);
+}
+
+#define SetShowPopup ShowPopup
+$}

+ 174 - 1
Source/Engine/LuaScript/pkgs/UI/MessageBox.pkg

@@ -2,7 +2,7 @@ $#include "MessageBox.h"
 
 
 class MessageBox : public Object
 class MessageBox : public Object
 {
 {
-    MessageBox(Context* context, const String& messageString = String::EMPTY, const String& titleString = String::EMPTY, XMLFile* layoutFile = 0, XMLFile* styleFile = 0);
+    MessageBox(const String& messageString = String::EMPTY, const String& titleString = String::EMPTY, XMLFile* layoutFile = 0, XMLFile* styleFile = 0);
     virtual ~MessageBox();
     virtual ~MessageBox();
 
 
     void SetTitle(const String& text);
     void SetTitle(const String& text);
@@ -16,3 +16,176 @@ class MessageBox : public Object
     tolua_property__get_set String& message;
     tolua_property__get_set String& message;
     tolua_readonly tolua_property__get_set UIElement* window;
     tolua_readonly tolua_property__get_set UIElement* window;
 };
 };
+
+${
+/* method: new of class  MessageBox */
+#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new00
+static int tolua_UILuaAPI_MessageBox_new00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ {
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S)));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+
+/* method: new_local of class  MessageBox */
+#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new00_local
+static int tolua_UILuaAPI_MessageBox_new00_local(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ {
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S)));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+
+/* method: new of class  MessageBox */
+#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new01
+static int tolua_UILuaAPI_MessageBox_new01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+ {
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
+ tolua_pushurho3dstring(tolua_S,(const char*)messageString);
+ }
+ }
+ return 2;
+tolua_lerror:
+ return tolua_UILuaAPI_MessageBox_new00(tolua_S);
+}
+
+/* method: new_local of class  MessageBox */
+#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new01_local
+static int tolua_UILuaAPI_MessageBox_new01_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+ {
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ tolua_pushurho3dstring(tolua_S,(const char*)messageString);
+ }
+ }
+ return 2;
+tolua_lerror:
+ return tolua_UILuaAPI_MessageBox_new00_local(tolua_S);
+}
+
+/* method: new of class  MessageBox */
+#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new02
+static int tolua_UILuaAPI_MessageBox_new02(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,3,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"XMLFile",1,&tolua_err) ||
+ !tolua_isusertype(tolua_S,5,"XMLFile",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+  const String titleString = ((const String)  tolua_tourho3dstring(tolua_S,3,0));
+  XMLFile* layoutFile = ((XMLFile*)  tolua_tousertype(tolua_S,4,0));
+  XMLFile* styleFile = ((XMLFile*)  tolua_tousertype(tolua_S,5,0));
+ {
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString,titleString,layoutFile,styleFile));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
+ tolua_pushurho3dstring(tolua_S,(const char*)messageString);
+ tolua_pushurho3dstring(tolua_S,(const char*)titleString);
+ }
+ }
+ return 3;
+tolua_lerror:
+ return tolua_UILuaAPI_MessageBox_new01(tolua_S);
+}
+
+/* method: new_local of class  MessageBox */
+#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new02_local
+static int tolua_UILuaAPI_MessageBox_new02_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,3,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"XMLFile",1,&tolua_err) ||
+ !tolua_isusertype(tolua_S,5,"XMLFile",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
+  const String titleString = ((const String)  tolua_tourho3dstring(tolua_S,3,0));
+  XMLFile* layoutFile = ((XMLFile*)  tolua_tousertype(tolua_S,4,0));
+  XMLFile* styleFile = ((XMLFile*)  tolua_tousertype(tolua_S,5,0));
+ {
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString,titleString,layoutFile,styleFile));
+  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ tolua_pushurho3dstring(tolua_S,(const char*)messageString);
+ tolua_pushurho3dstring(tolua_S,(const char*)titleString);
+ }
+ }
+ return 3;
+tolua_lerror:
+ return tolua_UILuaAPI_MessageBox_new01_local(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/ScrollBar.pkg

@@ -2,7 +2,7 @@ $#include "ScrollBar.h"
 
 
 class ScrollBar : public UIElement
 class ScrollBar : public UIElement
 {
 {
-    ScrollBar(Context* context);
+    ScrollBar();
     virtual ~ScrollBar();
     virtual ~ScrollBar();
     
     
     void SetOrientation(Orientation orientation);
     void SetOrientation(Orientation orientation);
@@ -34,3 +34,17 @@ class ScrollBar : public UIElement
     tolua_readonly tolua_property__get_set Button* forwardButton;
     tolua_readonly tolua_property__get_set Button* forwardButton;
     tolua_readonly tolua_property__get_set Slider* slider;
     tolua_readonly tolua_property__get_set Slider* slider;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_ScrollBar_new00
+static int tolua_UILuaAPI_ScrollBar_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<ScrollBar>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_ScrollBar_new00_local
+static int tolua_UILuaAPI_ScrollBar_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<ScrollBar>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/ScrollView.pkg

@@ -2,7 +2,7 @@ $#include "ScrollView.h"
 
 
 class ScrollView : public UIElement
 class ScrollView : public UIElement
 {
 {
-    ScrollView(Context* context);
+    ScrollView();
     virtual ~ScrollView();
     virtual ~ScrollView();
     
     
     void SetContentElement(UIElement* element);
     void SetContentElement(UIElement* element);
@@ -33,3 +33,17 @@ class ScrollView : public UIElement
     tolua_property__get_set float scrollStep;
     tolua_property__get_set float scrollStep;
     tolua_property__get_set float pageStep;
     tolua_property__get_set float pageStep;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_ScrollView_new00
+static int tolua_UILuaAPI_ScrollView_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<ScrollView>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_ScrollView_new00_local
+static int tolua_UILuaAPI_ScrollView_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<ScrollView>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/Slider.pkg

@@ -2,7 +2,7 @@ $#include "Slider.h"
 
 
 class Slider : public BorderImage
 class Slider : public BorderImage
 {
 {
-    Slider(Context* context);
+    Slider();
     virtual ~Slider();
     virtual ~Slider();
     
     
     void SetOrientation(Orientation orientation);
     void SetOrientation(Orientation orientation);
@@ -23,3 +23,17 @@ class Slider : public BorderImage
     tolua_readonly tolua_property__get_set BorderImage* knob;
     tolua_readonly tolua_property__get_set BorderImage* knob;
     tolua_property__get_set float repeatRate;
     tolua_property__get_set float repeatRate;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Slider_new00
+static int tolua_UILuaAPI_Slider_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Slider>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Slider_new00_local
+static int tolua_UILuaAPI_Slider_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Slider>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/Sprite.pkg

@@ -4,7 +4,7 @@ enum BlendMode{};
 
 
 class Sprite : public UIElement
 class Sprite : public UIElement
 {
 {
-    Sprite(Context* context);
+    Sprite();
     virtual ~Sprite();
     virtual ~Sprite();
     
     
     void SetPosition(const Vector2& position);
     void SetPosition(const Vector2& position);
@@ -41,3 +41,17 @@ class Sprite : public UIElement
     tolua_property__get_set ResourceRef textureAttr;
     tolua_property__get_set ResourceRef textureAttr;
     tolua_readonly tolua_property__get_set Matrix3x4& transform;
     tolua_readonly tolua_property__get_set Matrix3x4& transform;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Sprite_new00
+static int tolua_UILuaAPI_Sprite_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Sprite>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Sprite_new00_local
+static int tolua_UILuaAPI_Sprite_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Sprite>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/Text.pkg

@@ -9,7 +9,7 @@ enum TextEffect
 
 
 class Text : public UIElement
 class Text : public UIElement
 {
 {
-    Text(Context* context);
+    Text();
     virtual ~Text();
     virtual ~Text();
 
 
     bool SetFont(const String fontName, int size = DEFAULT_FONT_SIZE);
     bool SetFont(const String fontName, int size = DEFAULT_FONT_SIZE);
@@ -66,3 +66,17 @@ class Text : public UIElement
     tolua_readonly tolua_property__get_set unsigned numRows;
     tolua_readonly tolua_property__get_set unsigned numRows;
     tolua_property__get_set ResourceRef fontAttr;
     tolua_property__get_set ResourceRef fontAttr;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00
+static int tolua_UILuaAPI_Text_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Text>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00_local
+static int tolua_UILuaAPI_Text_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Text>(tolua_S);
+}
+$}

+ 13 - 1
Source/Engine/LuaScript/pkgs/UI/Text3D.pkg

@@ -2,7 +2,7 @@ $#include "Text3D.h"
 
 
 class Text3D : public Drawable
 class Text3D : public Drawable
 {
 {
-    Text3D(Context* context);
+    Text3D();
     ~Text3D();
     ~Text3D();
     
     
     bool SetFont(const String fontName, int size = DEFAULT_FONT_SIZE);
     bool SetFont(const String fontName, int size = DEFAULT_FONT_SIZE);
@@ -78,6 +78,18 @@ class Text3D : public Drawable
 };
 };
 
 
 ${
 ${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Text3D_new00
+static int tolua_UILuaAPI_Text3D_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Text3D>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Text3D_new00_local
+static int tolua_UILuaAPI_Text3D_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Text3D>(tolua_S);
+}
+
 #define SetColorAttr SetColor
 #define SetColorAttr SetColor
 #define TOLUA_DISABLE_tolua_get_Text3D_color_ref
 #define TOLUA_DISABLE_tolua_get_Text3D_color_ref
 #define tolua_get_Text3D_color_ref NULL
 #define tolua_get_Text3D_color_ref NULL

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/ToolTip.pkg

@@ -2,7 +2,7 @@ $#include "ToolTip.h"
 
 
 class ToolTip : public UIElement
 class ToolTip : public UIElement
 {
 {
-    ToolTip(Context* context);
+    ToolTip();
     virtual ~ToolTip();
     virtual ~ToolTip();
 
 
     void SetDelay(float delay);
     void SetDelay(float delay);
@@ -11,3 +11,17 @@ class ToolTip : public UIElement
     
     
     tolua_property__get_set float delay;
     tolua_property__get_set float delay;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_ToolTip_new00
+static int tolua_UILuaAPI_ToolTip_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<ToolTip>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_ToolTip_new00_local
+static int tolua_UILuaAPI_ToolTip_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<ToolTip>(tolua_S);
+}
+$}

+ 13 - 1
Source/Engine/LuaScript/pkgs/UI/UIElement.pkg

@@ -57,7 +57,7 @@ static const unsigned DD_SOURCE_AND_TARGET;
 
 
 class UIElement : public Serializable
 class UIElement : public Serializable
 {
 {
-    UIElement(Context* context);
+    UIElement();
     virtual ~UIElement();
     virtual ~UIElement();
 
 
     virtual const IntVector2& GetScreenPosition() const;
     virtual const IntVector2& GetScreenPosition() const;
@@ -268,6 +268,18 @@ class UIElement : public Serializable
 };
 };
 
 
 ${
 ${
+#define TOLUA_DISABLE_tolua_UILuaAPI_UIElement_new00
+static int tolua_UILuaAPI_UIElement_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<UIElement>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_UIElement_new00_local
+static int tolua_UILuaAPI_UIElement_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<UIElement>(tolua_S);
+}
+
 // Disable generated CreateChild function.
 // Disable generated CreateChild function.
 #define TOLUA_DISABLE_tolua_UILuaAPI_UIElement_CreateChild00
 #define TOLUA_DISABLE_tolua_UILuaAPI_UIElement_CreateChild00
 
 

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/View3D.pkg

@@ -2,7 +2,7 @@ $#include "View3D.h"
 
 
 class View3D : public Window
 class View3D : public Window
 {
 {
-    View3D(Context* context);
+    View3D();
     ~View3D();
     ~View3D();
 
 
     void SetView(Scene* scene, Camera* camera);
     void SetView(Scene* scene, Camera* camera);
@@ -21,3 +21,17 @@ class View3D : public Window
     tolua_property__get_set unsigned format;
     tolua_property__get_set unsigned format;
     tolua_property__get_set bool autoUpdate;
     tolua_property__get_set bool autoUpdate;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_View3D_new00
+static int tolua_UILuaAPI_View3D_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<View3D>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_View3D_new00_local
+static int tolua_UILuaAPI_View3D_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<View3D>(tolua_S);
+}
+$}

+ 15 - 1
Source/Engine/LuaScript/pkgs/UI/Window.pkg

@@ -16,7 +16,7 @@ enum WindowDragMode
 
 
 class Window : public BorderImage
 class Window : public BorderImage
 {
 {
-    Window(Context* context);
+    Window();
     virtual ~Window();
     virtual ~Window();
     
     
     void SetMovable(bool enable);
     void SetMovable(bool enable);
@@ -49,3 +49,17 @@ class Window : public BorderImage
     tolua_property__get_set Color& modalFrameColor;
     tolua_property__get_set Color& modalFrameColor;
     tolua_property__get_set IntVector2& modalFrameSize;
     tolua_property__get_set IntVector2& modalFrameSize;
 };
 };
+
+${
+#define TOLUA_DISABLE_tolua_UILuaAPI_Window_new00
+static int tolua_UILuaAPI_Window_new00(lua_State* tolua_S)
+{
+    return ToluaNewObject<Window>(tolua_S);
+}
+
+#define TOLUA_DISABLE_tolua_UILuaAPI_Window_new00_local
+static int tolua_UILuaAPI_Window_new00_local(lua_State* tolua_S)
+{
+    return ToluaNewObjectGC<Window>(tolua_S);
+}
+$}

+ 7 - 7
Source/Engine/LuaScript/pkgs/basic.lua

@@ -69,7 +69,7 @@ function post_output_hook(package)
 
 
 #include "Precompiled.h"
 #include "Precompiled.h"
 #include "tolua++.h"
 #include "tolua++.h"
-#include "tolua++urho3d.h"]]
+#include "ToluaUtils.h"]]
     )
     )
 
 
     WRITE(result)
     WRITE(result)
@@ -95,9 +95,9 @@ function get_push_function(t)
     end
     end
     
     
     if not urho3d_is_podvector(t) then
     if not urho3d_is_podvector(t) then
-        return "tolua_pushurho3dvector" .. t:match("<.*>")
+        return "ToluaPushVector" .. t:match("<.*>")
     else
     else
-        return "tolua_pushurho3dpodvector" .. t:match("<.*>")
+        return "ToluaPushPODVector" .. t:match("<.*>")
     end
     end
 end
 end
 
 
@@ -107,9 +107,9 @@ function get_to_function(t)
     end
     end
     
     
     if not urho3d_is_podvector(t) then
     if not urho3d_is_podvector(t) then
-        return "tolua_tourho3dvector" .. t:match("<.*>")
+        return "ToluaToVector" .. t:match("<.*>")
     else
     else
-        return "tolua_tourho3dpodvector" .. t:match("<.*>")
+        return "ToluaToPODVector" .. t:match("<.*>")
     end
     end
 end
 end
 
 
@@ -119,9 +119,9 @@ function get_is_function(t)
     end
     end
     
     
     if not urho3d_is_podvector(t) then
     if not urho3d_is_podvector(t) then
-        return "tolua_isurho3dvector" .. t:match("<.*>")
+        return "ToluaIsVector" .. t:match("<.*>")
     else
     else
-        return "tolua_isurho3dpodvector" .. t:match("<.*>")
+        return "ToluaIsPODVector" .. t:match("<.*>")
     end
     end
 end
 end
 
 

+ 0 - 94
Source/Engine/LuaScript/tolua++urho3d.h

@@ -1,94 +0,0 @@
-//
-// Copyright (c) 2008-2013 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "OctreeQuery.h"
-#include "PhysicsWorld.h"
-#include "Vector2.h"
-#include "Vector3.h"
-
-struct lua_State;
-
-namespace Urho3D
-{
-    class SoundSource;
-    class UIElement;
-}
-
-using namespace Urho3D;
-
-/// Check is String.
-#define tolua_isurho3dstring tolua_isstring
-/// Push String.
-#define tolua_pushurho3dstring(x, y) tolua_pushstring(x, y.CString())
-/// Convert to String.
-const char* tolua_tourho3dstring(lua_State* L, int narg, const char* str);
-/// Convert to String.
-const char* tolua_tourho3dstring(lua_State* L, int narg, const String& str);
-
-/// Check Lua table is Vector<T>.
-template<typename T> int tolua_isurho3dvector(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
-/// Check Lua table is Vector<String>.
-template<> int tolua_isurho3dvector<String>(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
-
-/// Convert Lua  table to Vector<T>.
-template<typename T> void* tolua_tourho3dvector(lua_State* L, int narg, void* def);
-/// Convert Lua  table to Vector<String>.
-template<> void* tolua_tourho3dvector<String>(lua_State* L, int narg, void* def);
-
-/// Push Vector<T> to Lua as a table.
-template<typename T> int tolua_pushurho3dvector(lua_State*L, void* data, const char* type);
-/// Push Vector<String> to Lua as a table.
-template<> int tolua_pushurho3dvector<String>(lua_State* L, void* data, const char* type);
-
-/// Check Lua table is Vector<T>.
-template<typename T> int tolua_isurho3dpodvector(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
-/// Check Lua table is Vector<unsigned>.
-template<> int tolua_isurho3dpodvector<unsigned>(lua_State* L, int lo, const char* type, int def, tolua_Error* err);
-
-/// Convert Lua  table to PODVector<T>.
-template<typename T> void* tolua_tourho3dpodvector(lua_State* L, int narg, void* def);
-/// Convert Lua  table to PODVector<unsigned>.
-template<> void* tolua_tourho3dpodvector<unsigned>(lua_State* L, int narg, void* def);
-
-/// Push PODVector<T> to Lua as a table.
-template<typename T> int tolua_pushurho3dpodvector(lua_State* L, void* data, const char* type);
-/// Push PODVector<int> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<int>(lua_State* L, void* data, const char* type);
-/// Push PODVector<unsigned> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<unsigned>(lua_State* L, void* data, const char* type);
-/// Push PODVector<SoundSource*> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<SoundSource*>(lua_State* L, void* data, const char* type);
-/// Push PODVector<UIElement*> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<UIElement*>(lua_State* L, void* data, const char* type);
-
-/// Push PODVector<Vector3> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<Vector3>(lua_State* L, void* data, const char* type);
-/// Push PODVector<IntVector2> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<IntVector2>(lua_State* L, void* data, const char* type);
-/// Push PODVector<OctreeQueryResult> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<OctreeQueryResult>(lua_State* L, void* data, const char* type);
-/// Push PODVector<PhysicsRaycastResult> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<PhysicsRaycastResult>(lua_State* L, void* data, const char* type);
-/// Push PODVector<RayQueryResult> to Lua as a table.
-template<> int tolua_pushurho3dpodvector<RayQueryResult>(lua_State* L, void* data, const char* type);