From fa234f9663b992cf50bcf865a1cde6845b42193c Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 21 May 2018 16:02:00 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=94=B9audio=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/script/luaopen_jin.cpp | 97 ---------------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 src/script/luaopen_jin.cpp (limited to 'src/script/luaopen_jin.cpp') diff --git a/src/script/luaopen_jin.cpp b/src/script/luaopen_jin.cpp deleted file mode 100644 index dcf8830..0000000 --- a/src/script/luaopen_jin.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "luaopen_jin.h" -#include "3rdparty/luax/luax.h" - -// embed all lua scripts -#include "embed/embed.h" - -namespace jin -{ -namespace lua -{ - - extern int luaopen_core(lua_State* L); - extern int luaopen_graphics(lua_State* L); - extern int luaopen_audio(lua_State* L); - extern int luaopen_net(lua_State* L); - extern int luaopen_event(lua_State* L); - extern int luaopen_time(lua_State* L); - extern int luaopen_mouse(lua_State* L); - extern int luaopen_keyboard(lua_State* L); - extern int luaopen_filesystem(lua_State* L); - extern int luaopen_joypad(lua_State* L); - - static int l_getversion(lua_State* L) - { - luax_pushstring(L, VERSION); - return 1; - } - - static int l_getAuthor(lua_State* L) - { - luax_pushstring(L, AUTHOR); - return 1; - } - - static int l_getOS(lua_State* L) - { - #ifdef _WIN32 - luax_pushstring(L, "windows"); - #elif defined __unix__ - luax_pushstring(L, "unix"); - #elif defined __APPLE__ - luax_pushstring(L, "macos"); - #endif - return 1; - } - - static const luaL_Reg f[] = { - {"version", l_getversion}, - {"author", l_getAuthor}, - {"os", l_getOS}, - {0, 0} - }; - - // submodules - static const luaL_Reg mods[] = { - {"core", luaopen_core}, - {"event", luaopen_event}, - {"graphics", luaopen_graphics}, - {"time", luaopen_time}, - {"mouse", luaopen_mouse}, - {"keyboard", luaopen_keyboard}, - {"filesystem", luaopen_filesystem}, - {"net", luaopen_net}, - {"audio", luaopen_audio}, - {"joypad", luaopen_joypad}, - {0, 0} - }; - - int luaopen_jin(lua_State* L) - { - // jin module is on top of the stack - luax_newlib(L, f); - - // set to global field - luax_justglobal(L, -1, MODULE_NAME); - - // register submodules - for (int i = 0; mods[i].name; ++i) - { - // open submodules - mods[i].func(L); - luax_setfield(L, -2, mods[i].name); - } - - return 1; - } - - /** - * boot jin - */ - void boot(lua_State* L) - { - jin::embed::boot(L); - } - -} -} \ No newline at end of file -- cgit v1.1-26-g67d0