aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/je_lua_graphics.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-12-10 11:46:29 +0800
committerchai <chaifix@163.com>2018-12-10 11:46:29 +0800
commitce8e259441410aba3f2345333003032ed9c45d65 (patch)
treeb28b8a30e2b30081a2f9bdbf0a142099f7a8cd6f /src/lua/modules/graphics/je_lua_graphics.cpp
parentb1dfdae7a071407ef5e2d56f2203f96e6ba6068d (diff)
*删除shared的lua类型信息
Diffstat (limited to 'src/lua/modules/graphics/je_lua_graphics.cpp')
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
index accd209..2eeb1d6 100644
--- a/src/lua/modules/graphics/je_lua_graphics.cpp
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -208,7 +208,7 @@ namespace JinEngine
return 1;
}
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared(bitmap, Jin_Lua_Bitmap));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared(bitmap));
return 1;
}
@@ -227,7 +227,7 @@ namespace JinEngine
const char* path = luax_checkstring(L, 1);
texture = new Texture(path);
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Texture, new Shared(texture, Jin_Lua_Texture));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Texture, new Shared(texture));
return 1;
}
@@ -241,7 +241,7 @@ namespace JinEngine
luax_pushnil(L);
return 1;
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared(jsl, Jin_Lua_Shader));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared(jsl));
return 1;
}
@@ -264,7 +264,7 @@ namespace JinEngine
luax_pushnil(L);
return 1;
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared(jsl, Jin_Lua_Shader));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Shader, new Shared(jsl));
return 1;
}
@@ -273,7 +273,7 @@ namespace JinEngine
int w = luax_checknumber(L, 1);
int h = luax_checknumber(L, 2);
Canvas* cvs = new Canvas(w, h);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Canvas, new Shared(cvs, Jin_Lua_Canvas));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Canvas, new Shared(cvs));
return 1;
}
@@ -684,7 +684,7 @@ namespace JinEngine
fs->read(path, b);
fd = new TTFData(&b, b.size());
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TTFData, new Shared(fd, Jin_Lua_TTFData));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TTFData, new Shared(fd));
return 1;
}
@@ -707,7 +707,7 @@ namespace JinEngine
unsigned length;
const char* data = luax_checklstring(L, 1, &length);
Text* text = new Text(encode, data, length);
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Text, new Shared(text, Jin_Lua_Text));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Text, new Shared(text));
return 1;
}
@@ -735,8 +735,8 @@ namespace JinEngine
quad.h = luax_rawgetnumberthenpop(L, 2, 4);
int o = luax_checkinteger(L, 3);
Origin origin = static_cast<Origin>(o);
- LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared(new Sprite(graphic, quad, origin), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared(new Sprite(graphic, quad, origin)));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic);
}
else if (n == 4)
{
@@ -747,22 +747,22 @@ namespace JinEngine
quad.h = luax_rawgetnumberthenpop(L, 2, 4);
int ox = luax_checkinteger(L, 3);
int oy = luax_checkinteger(L, 4);
- LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared(new Sprite(graphic, quad, ox, oy), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared(new Sprite(graphic, quad, ox, oy)));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic);
}
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(new Sprite(graphic, origin), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared(new Sprite(graphic, origin)));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic);
}
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(new Sprite(graphic, ox, oy), Jin_Lua_Sprite));
- p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getShared());
+ LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared(new Sprite(graphic, ox, oy)));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic);
}
else
{
@@ -784,10 +784,9 @@ namespace JinEngine
if (objGraphic != nullptr)
{
Graphic* graphic = objGraphic->getObject<Graphic>();
- Shared* shrSSheet = new Shared(new SpriteSheet(graphic), Jin_Lua_SpriteSheet);
- Shared* shrGraphic = objGraphic->getShared();
+ Shared* shrSSheet = new Shared(new SpriteSheet(graphic));
LuaObject* luaSSheet = luax_newinstance(L, Jin_Lua_SpriteSheet, shrSSheet);
- luaSSheet->setDependency((int)SpriteSheetDependency::DEP_GRAPHIC, shrGraphic);
+ luaSSheet->setDependency((int)SpriteSheetDependency::DEP_GRAPHIC, objGraphic);
return 1;
}
else
@@ -799,7 +798,7 @@ namespace JinEngine
{
int argc = luax_gettop(L);
Animation* animation = new Animation();
- Shared* shrAnimation = new Shared(animation, Jin_Lua_Animation);
+ Shared* shrAnimation = new Shared(animation);
LuaObject* luaAnimation = luax_newinstance(L, Jin_Lua_Animation, shrAnimation);
if (argc >= 3)
{
@@ -817,7 +816,7 @@ namespace JinEngine
LuaObject* luaSprite = (LuaObject*)luax_checktype(L, -1, Jin_Lua_Sprite);
animation->addFrame(luaSprite->getObject<Sprite>());
int index = animation->getFrameCount() - 1;
- luaAnimation->setDependency((int)AnimationDependency::DEP_SPRITES + index, luaSprite->getShared());
+ luaAnimation->setDependency((int)AnimationDependency::DEP_SPRITES + index, luaSprite);
}
animation->setLoop(loop);
animation->setSpeed(speed);
@@ -831,14 +830,13 @@ namespace JinEngine
{
int argc = luax_gettop(L);
Animator* animator = new Animator();
- Shared* shrAniamtor = new Shared(animator, Jin_Lua_Animator);
+ Shared* shrAniamtor = new Shared(animator);
if (argc >= 1)
{
- LuaObject* luaAnimation = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
- Shared* shrAnimtion = luaAnimation->getShared();
- animator->setAnimation(shrAnimtion->getObject<Animation>());
+ LuaObject* animation = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
+ animator->setAnimation(animation->getObject<Animation>());
LuaObject* luaAnimator = luax_newinstance(L, Jin_Lua_Animator, shrAniamtor);
- luaAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, shrAnimtion);
+ luaAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, animation);
return 1;
}
LuaObject* luaAnimator = luax_newinstance(L, Jin_Lua_Animator, shrAniamtor);
@@ -892,13 +890,13 @@ namespace JinEngine
// Delete temporary text.
delete text;
}
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TextureFont, new Shared(textureFont, Jin_Lua_TextureFont));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_TextureFont, new Shared(textureFont));
return 1;
}
LUA_IMPLEMENT int l_newParticleSystem(lua_State* L)
{
- LuaObject* luaObj = luax_newinstance(L, Jin_Lua_ParticleSystem, new Shared(new ParticleSystem(), Jin_Lua_ParticleSystem));
+ LuaObject* luaObj = luax_newinstance(L, Jin_Lua_ParticleSystem, new Shared(new ParticleSystem()));
return 1;
}