aboutsummaryrefslogtreecommitdiff
path: root/src/libjin-lua/modules/audio/l_source.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-09-13 15:08:43 +0800
committerchai <chaifix@163.com>2019-09-13 15:08:43 +0800
commit20535cb86266d7a4828009f3ddca42e35269b9e2 (patch)
tree796e77e4a34ed52b6c92fb58ec432c69ed4232e1 /src/libjin-lua/modules/audio/l_source.cpp
parent695eadc9d2a6d2f499b24ee6858325f6e22da077 (diff)
*格式化代码
Diffstat (limited to 'src/libjin-lua/modules/audio/l_source.cpp')
-rw-r--r--src/libjin-lua/modules/audio/l_source.cpp186
1 files changed, 93 insertions, 93 deletions
diff --git a/src/libjin-lua/modules/audio/l_source.cpp b/src/libjin-lua/modules/audio/l_source.cpp
index 72af871..29b928b 100644
--- a/src/libjin-lua/modules/audio/l_source.cpp
+++ b/src/libjin-lua/modules/audio/l_source.cpp
@@ -6,109 +6,109 @@ using namespace JinEngine::Audio;
namespace JinEngine
{
- namespace Lua
- {
+ namespace Lua
+ {
- const char* Jin_Lua_Source = "Source";
-
- LUA_IMPLEMENT inline Source* checkSource(lua_State* L)
- {
- LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Source);
- Source* source = luaObj->getObject<Source>();
- return source;
- }
+ const char* Jin_Lua_Source = "Source";
+
+ LUA_IMPLEMENT inline Source* checkSource(lua_State* L)
+ {
+ LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Source);
+ Source* source = luaObj->getObject<Source>();
+ return source;
+ }
- LUA_IMPLEMENT int l_play(lua_State* L)
- {
- Source* source = checkSource(L);
- source->play();
- return 0;
- }
+ LUA_IMPLEMENT int l_play(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ source->play();
+ return 0;
+ }
- LUA_IMPLEMENT int l_stop(lua_State* L)
- {
- Source* source = checkSource(L);
- source->stop();
- return 0;
- }
+ LUA_IMPLEMENT int l_stop(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ source->stop();
+ return 0;
+ }
- LUA_IMPLEMENT int l_pause(lua_State* L)
- {
- Source* source = checkSource(L);
- source->pause();
- return 0;
- }
+ LUA_IMPLEMENT int l_pause(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ source->pause();
+ return 0;
+ }
- LUA_IMPLEMENT int l_rewind(lua_State* L)
- {
- Source* source = checkSource(L);
- source->rewind();
- return 0;
- }
+ LUA_IMPLEMENT int l_rewind(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ source->rewind();
+ return 0;
+ }
- LUA_IMPLEMENT int l_resume(lua_State* L)
- {
- Source* source = checkSource(L);
- source->resume();
- return 0;
- }
+ LUA_IMPLEMENT int l_resume(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ source->resume();
+ return 0;
+ }
- LUA_IMPLEMENT int l_isStop(lua_State* L)
- {
- Source* source = checkSource(L);
- bool isStop = source->isStopped();
- luax_pushboolean(L, isStop);
- return 1;
- }
+ LUA_IMPLEMENT int l_isStop(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ bool isStop = source->isStopped();
+ luax_pushboolean(L, isStop);
+ return 1;
+ }
- LUA_IMPLEMENT int l_isPaused(lua_State* L)
- {
- Source* source = checkSource(L);
- bool isPaused = source->isPaused();
- luax_pushboolean(L, isPaused);
- return 1;
- }
+ LUA_IMPLEMENT int l_isPaused(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ bool isPaused = source->isPaused();
+ luax_pushboolean(L, isPaused);
+ return 1;
+ }
- LUA_IMPLEMENT int l_setVolume(lua_State* L)
- {
- Source* source = checkSource(L);
- float volume = luax_checknumber(L, 2);
- source->setVolume(volume);
- return 0;
- }
+ LUA_IMPLEMENT int l_setVolume(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ float volume = luax_checknumber(L, 2);
+ source->setVolume(volume);
+ return 0;
+ }
- LUA_IMPLEMENT int l_setLoop(lua_State* L)
- {
- Source* source = checkSource(L);
- bool loop = luax_checkbool(L, 2);
- source->setLoop(loop);
- return 0;
- }
+ LUA_IMPLEMENT int l_setLoop(lua_State* L)
+ {
+ Source* source = checkSource(L);
+ bool loop = luax_checkbool(L, 2);
+ source->setLoop(loop);
+ return 0;
+ }
- LUA_IMPLEMENT int l_gc(lua_State* L)
- {
- LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Source);
- luaObj->release();
- return 0;
- }
-
- LUA_EXPORT void luaopen_Source(lua_State* L)
- {
- luaL_Reg methods[] = {
- { "__gc", l_gc },
- { "play", l_play },
- { "stop", l_stop },
- { "pause", l_pause },
- { "resume", l_resume },
- { "rewind", l_rewind },
- { "isStop", l_isStop },
- { "isPaused", l_isPaused },
- { "setVolume", l_setVolume },
- { "setLoop", l_setLoop },
- { 0, 0 }
- };
- luax_newtype(L, Jin_Lua_Source, methods);
- }
+ LUA_IMPLEMENT int l_gc(lua_State* L)
+ {
+ LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Source);
+ luaObj->release();
+ return 0;
+ }
+
+ LUA_EXPORT void luaopen_Source(lua_State* L)
+ {
+ luaL_Reg methods[] = {
+ { "__gc", l_gc },
+ { "play", l_play },
+ { "stop", l_stop },
+ { "pause", l_pause },
+ { "resume", l_resume },
+ { "rewind", l_rewind },
+ { "isStop", l_isStop },
+ { "isPaused", l_isPaused },
+ { "setVolume", l_setVolume },
+ { "setLoop", l_setLoop },
+ { 0, 0 }
+ };
+ luax_newtype(L, Jin_Lua_Source, methods);
+ }
- } // namespace Lua
+ } // namespace Lua
} // namespace JinEngine \ No newline at end of file