diff options
author | chai <chaifix@163.com> | 2018-12-08 22:05:31 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-08 22:05:31 +0800 |
commit | a16ce94158c9cf22a19c0e73dfe2e992a8302af1 (patch) | |
tree | 52d80d950cd410ba82af909e18f77e3b11cd6eda /src/lua/modules/audio/je_lua_source.cpp | |
parent | d34e5c9d7c6135e805f2cc231411cdcc9910190c (diff) |
*去除shared template
Diffstat (limited to 'src/lua/modules/audio/je_lua_source.cpp')
-rw-r--r-- | src/lua/modules/audio/je_lua_source.cpp | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/src/lua/modules/audio/je_lua_source.cpp b/src/lua/modules/audio/je_lua_source.cpp index f115721..7bb28d9 100644 --- a/src/lua/modules/audio/je_lua_source.cpp +++ b/src/lua/modules/audio/je_lua_source.cpp @@ -10,79 +10,78 @@ namespace JinEngine { const char* Jin_Lua_Source = "Source"; - - typedef Shared<Source>& SharedSource; - - LUA_IMPLEMENT inline SharedSource checkSource(lua_State* L) + + LUA_IMPLEMENT inline Source* checkSource(lua_State* L) { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Source); - return luaObj->getShared<Source>(); + LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Source); + Source* source = luaObj->getObject<Source>(); + return source; } LUA_IMPLEMENT int l_play(lua_State* L) { - SharedSource shared = checkSource(L); - shared->play(); + Source* source = checkSource(L); + source->play(); return 0; } LUA_IMPLEMENT int l_stop(lua_State* L) { - SharedSource shared = checkSource(L); - shared->stop(); + Source* source = checkSource(L); + source->stop(); return 0; } LUA_IMPLEMENT int l_pause(lua_State* L) { - SharedSource shared = checkSource(L); - shared->pause(); + Source* source = checkSource(L); + source->pause(); return 0; } LUA_IMPLEMENT int l_rewind(lua_State* L) { - SharedSource shared = checkSource(L); - shared->rewind(); + Source* source = checkSource(L); + source->rewind(); return 0; } LUA_IMPLEMENT int l_resume(lua_State* L) { - SharedSource shared = checkSource(L); - shared->resume(); + Source* source = checkSource(L); + source->resume(); return 0; } LUA_IMPLEMENT int l_isStop(lua_State* L) { - SharedSource shared = checkSource(L); - bool isStop = shared->isStopped(); + Source* source = checkSource(L); + bool isStop = source->isStopped(); luax_pushboolean(L, isStop); return 1; } LUA_IMPLEMENT int l_isPaused(lua_State* L) { - SharedSource shared = checkSource(L); - bool isPaused = shared->isPaused(); + Source* source = checkSource(L); + bool isPaused = source->isPaused(); luax_pushboolean(L, isPaused); return 1; } LUA_IMPLEMENT int l_setVolume(lua_State* L) { - SharedSource shared = checkSource(L); + Source* source = checkSource(L); float volume = luax_checknumber(L, 2); - shared->setVolume(volume); + source->setVolume(volume); return 0; } LUA_IMPLEMENT int l_setLoop(lua_State* L) { - SharedSource shared = checkSource(L); + Source* source = checkSource(L); bool loop = luax_checkbool(L, 2); - shared->setLoop(loop); + source->setLoop(loop); return 0; } @@ -108,7 +107,6 @@ namespace JinEngine { "setLoop", l_setLoop }, { 0, 0 } }; - luax_newtype(L, Jin_Lua_Source, methods); } |