aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-12-07 11:22:59 +0800
committerchai <chaifix@163.com>2018-12-07 11:22:59 +0800
commit150944ee9e41df2ae5ee25c7845c3f5b2bd74af0 (patch)
treeea399aeb2172132855ffa2a8c9533b9870a0e9a9 /src/lua/modules
parentfe16b453e093d721e60be0a12219d40635b96a3a (diff)
*私有化shared object template retain和release
Diffstat (limited to 'src/lua/modules')
-rw-r--r--src/lua/modules/graphics/je_lua_bitmap.cpp4
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp12
-rw-r--r--src/lua/modules/graphics/je_lua_particle_system.cpp6
3 files changed, 10 insertions, 12 deletions
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<ParticleSystem>(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;
}