aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-12-08 11:53:02 +0800
committerchai <chaifix@163.com>2018-12-08 11:53:02 +0800
commitd34e5c9d7c6135e805f2cc231411cdcc9910190c (patch)
tree4ebb6e0b438269f8fe557de5ef85e82487febfc7 /src
parent39f653eb882dffa2f69209d192093f23588ff176 (diff)
*misc
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/buildvm.libbin33996 -> 33996 bytes
-rw-r--r--src/3rdparty/LuaJIT-2.0.5/src/minilua.libbin33996 -> 33996 bytes
-rw-r--r--src/lua/common/je_lua_object.cpp2
-rw-r--r--src/lua/common/je_lua_object.h2
-rw-r--r--src/lua/common/je_lua_runtime.cpp2
-rw-r--r--src/lua/common/je_lua_shared.hpp10
-rw-r--r--src/lua/embed/embed.h12
-rw-r--r--src/lua/je_lua_jin.cpp3
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp8
-rw-r--r--src/lua/modules/graphics/je_lua_particle_system.cpp4
-rw-r--r--src/lua/modules/thread/je_lua_thread.cpp2
11 files changed, 19 insertions, 26 deletions
diff --git a/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib b/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib
index c7be727..be22bd4 100644
--- a/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib
+++ b/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib
Binary files differ
diff --git a/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib b/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib
index e2b3ac3..1a4ed3f 100644
--- a/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib
+++ b/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib
Binary files differ
diff --git a/src/lua/common/je_lua_object.cpp b/src/lua/common/je_lua_object.cpp
index d98099e..de3270a 100644
--- a/src/lua/common/je_lua_object.cpp
+++ b/src/lua/common/je_lua_object.cpp
@@ -38,7 +38,7 @@ namespace JinEngine
return object->getType();
}
- SharedBase* LuaObject::getSharedBase()
+ SharedBase* LuaObject::getShared()
{
return object;
}
diff --git a/src/lua/common/je_lua_object.h b/src/lua/common/je_lua_object.h
index 15fa6e4..296ee03 100644
--- a/src/lua/common/je_lua_object.h
+++ b/src/lua/common/je_lua_object.h
@@ -23,7 +23,7 @@ namespace JinEngine
const char* getObjectType();
- SharedBase* getSharedBase();
+ SharedBase* getShared();
template<class T>
Shared<T>& getShared()
diff --git a/src/lua/common/je_lua_runtime.cpp b/src/lua/common/je_lua_runtime.cpp
index 73f671c..055073d 100644
--- a/src/lua/common/je_lua_runtime.cpp
+++ b/src/lua/common/je_lua_runtime.cpp
@@ -54,7 +54,7 @@ namespace JinEngine
luax_copyinstance(to, luaObj);
luax_pop(to, 1); // Pop reference object.
}
- SharedBase * shr = src->getSharedBase();
+ SharedBase * shr = src->getShared();
LuaObject* obj = luax_newinstance(to, src->getObjectType(), shr);
(*obj->dependencies) = (*src->dependencies);
// Add to objects_table.
diff --git a/src/lua/common/je_lua_shared.hpp b/src/lua/common/je_lua_shared.hpp
index f89783d..86ee9be 100644
--- a/src/lua/common/je_lua_shared.hpp
+++ b/src/lua/common/je_lua_shared.hpp
@@ -29,10 +29,12 @@ namespace JinEngine
SharedBase(const SharedBase&);
- // ͬһ̵߳lua_StateУLuaObjectEngineObjectӦһһӦLuaObject(lua runtime)ü
- // աEngine-sideüΪά̵ͬ߳lua_StateͬһEngineObjectÿLuaObjectһ
- // Sharedʱһüͬһ߳УһEngineObjectֻһLuaObject󶨣new
- // instanceУômCountͱEngineObjectĹ߳
+ ///
+ /// ͬһ̵߳lua_StateУLuaObjectEngineObjectӦһһӦLuaObject(lua runtime)ü
+ /// ͻաEngine-sideüΪά̵ͬ߳lua_StateͬһEngineObjectÿLuaObjectһ
+ /// Sharedʱһüͬһ߳УһEngineObjectֻһLuaObject󶨣new
+ /// instanceУômCountͱEngineObjectĹ߳
+ ///
void retain();
void release();
diff --git a/src/lua/embed/embed.h b/src/lua/embed/embed.h
index 4b1c6d9..b5e1334 100644
--- a/src/lua/embed/embed.h
+++ b/src/lua/embed/embed.h
@@ -24,12 +24,11 @@ namespace JinEngine
{ "graphics.lua", graphics_lua },
{ "keyboard.lua", keyboard_lua },
{ "mouse.lua", mouse_lua },
+ { "boot.lua", boot_lua },
{ 0, 0 }
};
- static const jin_Embed boot_script = { "boot", boot_lua };
-
- static void load(lua_State* L)
+ static void run(lua_State* L)
{
for (int i = 0; modules[i].file; ++i)
{
@@ -39,13 +38,6 @@ namespace JinEngine
}
}
- static void run(lua_State* L)
- {
- const char* file = boot_script.file, *source = boot_script.source;
- if (luax_loadbuffer(L, source, strlen(source), file) == 0)
- lua_call(L, 0, 0);
- }
-
} // namespace Embed
} // namespace JinEngine
diff --git a/src/lua/je_lua_jin.cpp b/src/lua/je_lua_jin.cpp
index 3e80015..e3af169 100644
--- a/src/lua/je_lua_jin.cpp
+++ b/src/lua/je_lua_jin.cpp
@@ -31,7 +31,7 @@ namespace JinEngine
luax_pushstring(L, "macos");
#endif
return 1;
- }
+ }
LUA_IMPLEMENT int l_revision(lua_State* L)
{
@@ -95,7 +95,6 @@ namespace JinEngine
luax_newtable(L);
luax_setfieldstring(L, "cwd", cwd);
luax_setfield(L, -2, "args");
- Embed::load(L);
luax_clearstack(L);
Embed::run(L);
}
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
index c6e6e13..40bb4fa 100644
--- a/src/lua/modules/graphics/je_lua_graphics.cpp
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -737,7 +737,7 @@ namespace JinEngine
int o = luax_checkinteger(L, 3);
Origin origin = static_cast<Origin>(o);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, origin), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
}
else if (n == 4)
{
@@ -749,21 +749,21 @@ namespace JinEngine
int ox = luax_checkinteger(L, 3);
int oy = luax_checkinteger(L, 4);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, ox, oy), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
}
else if (n == 2)
{
int o = luax_checkinteger(L, 2);
Origin origin = static_cast<Origin>(o);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, origin), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
}
else if (n == 3)
{
int ox = luax_checkinteger(L, 2);
int oy = luax_checkinteger(L, 3);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, ox, oy), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
}
else
{
diff --git a/src/lua/modules/graphics/je_lua_particle_system.cpp b/src/lua/modules/graphics/je_lua_particle_system.cpp
index 8c2e4c7..05be4b7 100644
--- a/src/lua/modules/graphics/je_lua_particle_system.cpp
+++ b/src/lua/modules/graphics/je_lua_particle_system.cpp
@@ -244,7 +244,7 @@ namespace JinEngine
Sprite* spr = objSpr->getObject<Sprite>();
ps->addParticleSprite(spr);
int depn = (*obj).getDependenciesCount();
- (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn, objSpr->getSharedBase());
+ (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn, objSpr->getShared());
return 0;
}
@@ -266,7 +266,7 @@ namespace JinEngine
luax_pop(L, 1);
Sprite* spr = objSpr->getObject<Sprite>();
ps->addParticleSprite(spr);
- (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn + i - 1, objSpr->getSharedBase());
+ (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn + i - 1, objSpr->getShared());
}
return 0;
}
diff --git a/src/lua/modules/thread/je_lua_thread.cpp b/src/lua/modules/thread/je_lua_thread.cpp
index dc6a27a..566d0ff 100644
--- a/src/lua/modules/thread/je_lua_thread.cpp
+++ b/src/lua/modules/thread/je_lua_thread.cpp
@@ -1,7 +1,7 @@
#include "common/je_lua_object.h"
#include "libjin/jin.h"
-#include "lua/jin.h"
+#include "lua/je_lua_jin.h"
#include "common/je_lua_common.h"
#include "je_lua_thread.h"