diff options
author | chai <chaifix@163.com> | 2018-12-04 14:10:29 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-04 14:10:29 +0800 |
commit | e1bc01ce6948283930f7f29a640a91a27a29c997 (patch) | |
tree | 10620e2107f5e3df96a61516090347b950c58a74 /src/lua/modules/graphics/je_lua_animation.cpp | |
parent | f439c73308774d39cc9647ebfeedcf52b2111fed (diff) |
*格式化代码
Diffstat (limited to 'src/lua/modules/graphics/je_lua_animation.cpp')
-rw-r--r-- | src/lua/modules/graphics/je_lua_animation.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lua/modules/graphics/je_lua_animation.cpp b/src/lua/modules/graphics/je_lua_animation.cpp index 32e2c9c..4cb513c 100644 --- a/src/lua/modules/graphics/je_lua_animation.cpp +++ b/src/lua/modules/graphics/je_lua_animation.cpp @@ -38,19 +38,21 @@ namespace JinEngine // addFrame(frame) LUA_IMPLEMENT int l_addFrame(lua_State* L) { - SharedAnimation shrAnimation = checkAnimation(L); + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + SharedAnimation shrAnimation = luaObj->getShared<Animation>(); LuaObject* pxySprite = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Sprite); Shared<Sprite>& shrSprite = pxySprite->getShared<Sprite>(); shrAnimation->addFrame(shrSprite.getObject()); int i = shrAnimation->getFrameCount() - 1; - shrAnimation.setDependency((int)AnimationDependency::DEP_SPRITES + i, &shrSprite); + luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + i, &shrSprite); return 0; } // addFrames(frames table) LUA_IMPLEMENT int l_addFrames(lua_State* L) { - SharedAnimation shrAnimation = checkAnimation(L); + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + SharedAnimation shrAnimation = luaObj->getShared<Animation>(); if (!luax_istable(L, 2)) { luax_typerror(L, 2, "sprites table"); @@ -64,7 +66,7 @@ namespace JinEngine Shared<Sprite>& shrSprite = pxySprite->getShared<Sprite>(); shrAnimation->addFrame(shrSprite.getObject()); int index = shrAnimation->getFrameCount() - 1; - shrAnimation.setDependency((int)AnimationDependency::DEP_SPRITES + index, &shrSprite); + luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + index, &shrSprite); } return 0; } @@ -87,9 +89,10 @@ namespace JinEngine LUA_IMPLEMENT int l_getFrame(lua_State* L) { - SharedAnimation shrAnimation = checkAnimation(L); + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + SharedAnimation shrAnimation = luaObj->getShared<Animation>(); int i = luax_checkinteger(L, 2); - SharedBase* shrFrame = shrAnimation.getDependency((int)AnimationDependency::DEP_SPRITES + i); + SharedBase* shrFrame = luaObj->getDependency((int)AnimationDependency::DEP_SPRITES + i); luax_getobject(L, shrFrame); return 1; } |