aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/je_lua_animator.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-12-08 22:05:31 +0800
committerchai <chaifix@163.com>2018-12-08 22:05:31 +0800
commita16ce94158c9cf22a19c0e73dfe2e992a8302af1 (patch)
tree52d80d950cd410ba82af909e18f77e3b11cd6eda /src/lua/modules/graphics/je_lua_animator.cpp
parentd34e5c9d7c6135e805f2cc231411cdcc9910190c (diff)
*去除shared template
Diffstat (limited to 'src/lua/modules/graphics/je_lua_animator.cpp')
-rw-r--r--src/lua/modules/graphics/je_lua_animator.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/lua/modules/graphics/je_lua_animator.cpp b/src/lua/modules/graphics/je_lua_animator.cpp
index 360a276..b264c17 100644
--- a/src/lua/modules/graphics/je_lua_animator.cpp
+++ b/src/lua/modules/graphics/je_lua_animator.cpp
@@ -20,12 +20,10 @@ namespace JinEngine
{
const char* Jin_Lua_Animator = "Animator";
- typedef Shared<Animator>& SharedAnimator;
-
- LUA_IMPLEMENT inline SharedAnimator checkAnimator(lua_State* L)
+ LUA_IMPLEMENT inline Animator* checkAnimator(lua_State* L)
{
LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animator);
- return luaObj->getShared<Animator>();
+ return luaObj->getObject<Animator>();
}
LUA_IMPLEMENT int l_gc(lua_State* L)
@@ -37,7 +35,7 @@ namespace JinEngine
LUA_IMPLEMENT int l_update(lua_State* L)
{
- SharedAnimator animator = checkAnimator(L);
+ Animator* animator = checkAnimator(L);
float dt = luax_checknumber(L, 2);
animator->update(dt);
return 0;
@@ -45,35 +43,35 @@ namespace JinEngine
LUA_IMPLEMENT int l_play(lua_State* L)
{
- SharedAnimator animator = checkAnimator(L);
+ Animator* animator = checkAnimator(L);
animator->play();
return 0;
}
LUA_IMPLEMENT int l_pause(lua_State* L)
{
- SharedAnimator animator = checkAnimator(L);
+ Animator* animator = checkAnimator(L);
animator->pause();
return 0;
}
LUA_IMPLEMENT int l_resume(lua_State* L)
{
- SharedAnimator animator = checkAnimator(L);
+ Animator* animator = checkAnimator(L);
animator->resume();
return 0;
}
LUA_IMPLEMENT int l_rewind(lua_State* L)
{
- SharedAnimator animator = checkAnimator(L);
+ Animator* animator = checkAnimator(L);
animator->rewind();
return 0;
}
LUA_IMPLEMENT int l_render(lua_State* L)
{
- SharedAnimator animator = checkAnimator(L);
+ Animator* animator = checkAnimator(L);
float x = luax_checknumber(L, 2);
float y = luax_checknumber(L, 3);
float sx = luax_checknumber(L, 4);
@@ -86,17 +84,16 @@ namespace JinEngine
LUA_IMPLEMENT int l_setAnimation(lua_State* L)
{
LuaObject* luaAnimator = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animator);
- SharedAnimator shrAnimator = luaAnimator->getShared<Animator>();
+ Animator* animator = luaAnimator->getObject<Animator>();
LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation);
- Shared<Animation>& shrAnimation = luaObj->getShared<Animation>();
- luaAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, &shrAnimation);
- shrAnimator->setAnimation(shrAnimation.getObject());
+ luaAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, luaObj->getShared());
+ animator->setAnimation(luaObj->getObject<Animation>());
return 0;
}
LUA_IMPLEMENT int l_forceToFrame(lua_State* L)
{
- SharedAnimator shrAnimator = checkAnimator(L);
+ Animator* shrAnimator = checkAnimator(L);
int index = luax_checkinteger(L, 2);
shrAnimator->forceToFrame(index);
return 0;
@@ -104,7 +101,7 @@ namespace JinEngine
LUA_IMPLEMENT int l_setSpeed(lua_State* L)
{
- SharedAnimator shrAnimator = checkAnimator(L);
+ Animator* shrAnimator = checkAnimator(L);
float fps = luax_checknumber(L, 2);
shrAnimator->setSpeed(fps);
return 0;
@@ -112,14 +109,14 @@ namespace JinEngine
LUA_IMPLEMENT int l_setDefaultSpeed(lua_State* L)
{
- SharedAnimator shrAnimator = checkAnimator(L);
+ Animator* shrAnimator = checkAnimator(L);
shrAnimator->setDefaultSpeed();
return 0;
}
LUA_IMPLEMENT int l_setLoop(lua_State* L)
{
- SharedAnimator shrAnimator = checkAnimator(L);
+ Animator* shrAnimator = checkAnimator(L);
bool loop = luax_checkbool(L, 2);
shrAnimator->setLoop(loop);
return 0;
@@ -127,14 +124,14 @@ namespace JinEngine
LUA_IMPLEMENT int l_setDefaultLoop(lua_State* L)
{
- SharedAnimator shrAnimator = checkAnimator(L);
+ Animator* shrAnimator = checkAnimator(L);
shrAnimator->setDefaultLoop();
return 0;
}
LUA_IMPLEMENT int l_getSpeed(lua_State* L)
{
- SharedAnimator shrAnimator = checkAnimator(L);
+ Animator* shrAnimator = checkAnimator(L);
float speed = shrAnimator->getSpeed();
luax_pushnumber(L, speed);
return 1;