From 150944ee9e41df2ae5ee25c7845c3f5b2bd74af0 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 7 Dec 2018 11:22:59 +0800 Subject: =?UTF-8?q?*=E7=A7=81=E6=9C=89=E5=8C=96shared=20object=20template?= =?UTF-8?q?=20retain=E5=92=8Crelease?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/modules/graphics/je_lua_bitmap.cpp | 4 ++-- src/lua/modules/graphics/je_lua_graphics.cpp | 12 +++++------- src/lua/modules/graphics/je_lua_particle_system.cpp | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src/lua/modules') diff --git a/src/lua/modules/graphics/je_lua_bitmap.cpp b/src/lua/modules/graphics/je_lua_bitmap.cpp index 1733529..8d8b76e 100644 --- a/src/lua/modules/graphics/je_lua_bitmap.cpp +++ b/src/lua/modules/graphics/je_lua_bitmap.cpp @@ -23,8 +23,8 @@ namespace JinEngine LUA_IMPLEMENT int l_gc(lua_State* L) { - SharedBitmap shared = checkBitmap(L); - shared.release(); + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Bitmap); + luaObj->release(); return 0; } diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp index 981e30f..2fc8ecf 100644 --- a/src/lua/modules/graphics/je_lua_graphics.cpp +++ b/src/lua/modules/graphics/je_lua_graphics.cpp @@ -19,6 +19,7 @@ #include "je_lua_sprite.h" #include "je_lua_animation.h" #include "je_lua_animator.h" +#include "je_lua_particle_system.h" using namespace std; using namespace JinEngine; @@ -27,6 +28,7 @@ using namespace JinEngine::Graphics; using namespace JinEngine::Graphics::Fonts; using namespace JinEngine::Graphics::Shaders; using namespace JinEngine::Graphics::Animations; +using namespace JinEngine::Graphics::Particles; using namespace JinEngine::Filesystem; namespace JinEngine @@ -892,13 +894,8 @@ namespace JinEngine LUA_IMPLEMENT int l_newParticleSystem(lua_State* L) { - // Definition table. - if (!luax_istable(L, 1)) - { - luax_typerror(L, 1, "particle system definition table"); - return 1; - } - + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_ParticleSystem, new Shared(new ParticleSystem(), Jin_Lua_ParticleSystem)); + return 1; } /* setFont(font) */ @@ -981,6 +978,7 @@ namespace JinEngine luaopen_SpriteSheet(L); luaopen_Animation(L); luaopen_Animator(L); + luaopen_ParticleSystem(L); luaL_Reg methods[] = { /* window */ diff --git a/src/lua/modules/graphics/je_lua_particle_system.cpp b/src/lua/modules/graphics/je_lua_particle_system.cpp index a6c4eed..8c2e4c7 100644 --- a/src/lua/modules/graphics/je_lua_particle_system.cpp +++ b/src/lua/modules/graphics/je_lua_particle_system.cpp @@ -63,7 +63,7 @@ namespace JinEngine SharedParticleSystem ps = checkPS(L); float sx = luax_checknumber(L, 2); float sy = luax_checknumber(L, 3); - ps->setScale(sx, sy); + //ps->setScale(sx, sy); return 0; } @@ -71,14 +71,14 @@ namespace JinEngine { SharedParticleSystem ps = checkPS(L); bool b = luax_checkbool(L, 2); - ps->pause(b); + //ps->pause(b); return 0; } LUA_IMPLEMENT int l_clear(lua_State* L) { SharedParticleSystem ps = checkPS(L); - ps->clear(); + //ps->clear(); return 0; } -- cgit v1.1-26-g67d0