diff options
author | chai <chaifix@163.com> | 2018-11-22 08:42:31 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-22 08:42:31 +0800 |
commit | 1b25709b10cf92007096949f002b4941517eb749 (patch) | |
tree | 1f7a99938e17104d332e2547b99be95f853e2914 | |
parent | 07022c42a925d4d0c23ab31f0e75883766ce773a (diff) |
*注册lua对象
-rw-r--r-- | bin/Jin.exe | bin | 2312192 -> 2560512 bytes | |||
-rw-r--r-- | bin/game/main.lua | 5 | ||||
-rw-r--r-- | src/3rdparty/buildvm/buildvm.exe | bin | 121856 -> 123392 bytes | |||
-rw-r--r-- | src/3rdparty/minilua/minilua.exe | bin | 209920 -> 219136 bytes | |||
-rw-r--r-- | src/lua/common/je_lua_proxy.h | 15 |
5 files changed, 8 insertions, 12 deletions
diff --git a/bin/Jin.exe b/bin/Jin.exe Binary files differindex 9b923a4..4321360 100644 --- a/bin/Jin.exe +++ b/bin/Jin.exe diff --git a/bin/game/main.lua b/bin/game/main.lua index b8aa2cd..d268e23 100644 --- a/bin/game/main.lua +++ b/bin/game/main.lua @@ -59,7 +59,7 @@ local function createAnimation(path, count, r, c, w, h, loop, speed) local sprs = ssheet:newSprites(count, r, c, w, h, jin.graphics.SpriteOrigin.BOTTOMCENTER) return jin.graphics.newAnimation(sprs, loop, speed) end - +asd function jin.core.onLoad() bitmap = jin.graphics.newBitmap(200, 200, function(w, h, x, y) return {255*math.sin(x/w),255 - 255,255*math.cos(y/w),255} @@ -70,8 +70,7 @@ function jin.core.onLoad() tex = jin.graphics.newTexture(bitmap) local tex2 = jin.graphics.newTexture("anim.png") local ssheet2 = jin.graphics.newSpriteSheet(tex2) - sprs = ssheet2:newSprites(1, 19, 246, 238, jin.graphics.SpriteOrigin.BOTTOMCENTER) - local animation = createAnimation("anim2.png", 27, 3, 10, 200, 200, true, 20) + local animation = createAnimation("anim2.png", 27, 3, 10, 200, 200, true, 100) animator = jin.graphics.newAnimator(animation) animation = nil local ssheet = jin.graphics.newSpriteSheet(tex) diff --git a/src/3rdparty/buildvm/buildvm.exe b/src/3rdparty/buildvm/buildvm.exe Binary files differindex 3d72985..32a8f53 100644 --- a/src/3rdparty/buildvm/buildvm.exe +++ b/src/3rdparty/buildvm/buildvm.exe diff --git a/src/3rdparty/minilua/minilua.exe b/src/3rdparty/minilua/minilua.exe Binary files differindex 33e9227..a245b88 100644 --- a/src/3rdparty/minilua/minilua.exe +++ b/src/3rdparty/minilua/minilua.exe diff --git a/src/lua/common/je_lua_proxy.h b/src/lua/common/je_lua_proxy.h index 2914533..5541a5a 100644 --- a/src/lua/common/je_lua_proxy.h +++ b/src/lua/common/je_lua_proxy.h @@ -29,13 +29,7 @@ namespace JinEngine shared = nullptr; } } -/* - void retain() - { - if (shared != nullptr) - shared->retain(); - } -*/ + template<class T> Shared<T>& getShared() { @@ -62,9 +56,12 @@ namespace JinEngine }; - inline Proxy* luax_newinstance(lua_State* L, const char* type) + inline Proxy* luax_newinstance(lua_State* L, const char* type, SharedBase* shared = nullptr) { - return static_cast<Proxy*>(luax_newinstance(L, type, sizeof(Proxy))); + Proxy* proxy = static_cast<Proxy*>(luax_newinstance(L, type, sizeof(Proxy))); + if(shared) + proxy->bind(shared); + return proxy; } } // namespace Lua |