aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/je_lua_animation.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-11-22 12:23:12 +0800
committerchai <chaifix@163.com>2018-11-22 12:23:12 +0800
commit7a20483f06624e82feb129c9e4c8fa13881a6a9f (patch)
tree82707e7546fe14d1b781a2e15f65f6ef976ac322 /src/lua/modules/graphics/je_lua_animation.cpp
parent7256d216ecf154d6418c1f3b36dd58a2b69b7827 (diff)
*修改lua bind
Diffstat (limited to 'src/lua/modules/graphics/je_lua_animation.cpp')
-rw-r--r--src/lua/modules/graphics/je_lua_animation.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/lua/modules/graphics/je_lua_animation.cpp b/src/lua/modules/graphics/je_lua_animation.cpp
index 9c4eaeb..d054761 100644
--- a/src/lua/modules/graphics/je_lua_animation.cpp
+++ b/src/lua/modules/graphics/je_lua_animation.cpp
@@ -85,17 +85,34 @@ namespace JinEngine
return 1;
}
+ LUA_IMPLEMENT int l_getFrame(lua_State* L)
+ {
+ SharedAnimation shrAnimation = checkAnimation(L);
+ int i = luax_checkinteger(L, 2);
+ SharedBase* shrFrame = shrAnimation.getDependency((int)AnimationDependency::DEP_SPRITES + i);
+ luax_getobject(L, shrFrame);
+ return 1;
+ }
+
+ LUA_IMPLEMENT int getFrameCount(lua_State* L)
+ {
+ SharedAnimation shrAnimation = checkAnimation(L);
+ int n = shrAnimation->getFrameCount();
+ luax_pushinteger(L, n);
+ return 1;
+ }
+
LUA_EXPORT void luaopen_Animation(lua_State* L)
{
luaL_Reg methods[] = {
- { "__gc", l_gc },
- { "addFrame", l_addFrame },
- { "addFrames", l_addFrames },
- { "isLoop", l_isLoop },
- { "getSpeed", l_getSpeed },
- { "getFrameCount", l_getSpeed },
- //{ "getFrame", l_getFrame },
- { 0, 0 }
+ { "__gc", l_gc },
+ { "addFrame", l_addFrame },
+ { "addFrames", l_addFrames },
+ { "isLoop", l_isLoop },
+ { "getSpeed", l_getSpeed },
+ { "getFrameCount", getFrameCount },
+ { "getFrame", l_getFrame },
+ { 0, 0 }
};
luax_newtype(L, Jin_Lua_Animation, methods);
}