diff options
author | chai <chaifix@163.com> | 2018-07-29 21:30:03 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-07-29 21:30:03 +0800 |
commit | 7ac86950d3a89a996974e8406ee88e8f5f44187d (patch) | |
tree | a173ac2e585fa99863ef74fc7d2f7b38f9db7164 | |
parent | f94264fa4ba347fc362b4ae2deea5a12ff95f5af (diff) |
*update
-rw-r--r-- | bin/jin.exe | bin | 793088 -> 0 bytes | |||
-rw-r--r-- | bin/main.lua | 4 | ||||
-rw-r--r-- | src/lua/audio/luaopen_audio.cpp | 4 | ||||
-rw-r--r-- | src/lua/embed/boot.lua.h | 4 | ||||
-rw-r--r-- | src/lua/filesystem/luaopen_filesystem.cpp | 5 | ||||
-rw-r--r-- | src/lua/graphics/luaopen_JSL.cpp | 4 | ||||
-rw-r--r-- | src/lua/luaopen_jin.cpp | 7 | ||||
-rw-r--r-- | src/lua/luaopen_jin.h | 3 |
8 files changed, 16 insertions, 15 deletions
diff --git a/bin/jin.exe b/bin/jin.exe Binary files differdeleted file mode 100644 index 14c0d44..0000000 --- a/bin/jin.exe +++ /dev/null diff --git a/bin/main.lua b/bin/main.lua index 6235c5f..d29d66b 100644 --- a/bin/main.lua +++ b/bin/main.lua @@ -110,13 +110,13 @@ local diffuse = jg.Image("treestump_diffuse.png") local img = jg.Image("treestump.png") local img2 = jg.Image("lightning.png") local ww, wh = jg.size() -local src = jin.audio.Sound("a.ogg") +local src = jin.audio.Source("a.wav") local scale = 2 ww = ww / scale wh = wh / scale src:play() src:setLoop(true) -jin.audio.setVolume(0.5) +src:setVolume(0.4) jin.core.onLoad = function() jg.use(lightning) lightning:send("vec2", "iResolution", ww, wh) diff --git a/src/lua/audio/luaopen_audio.cpp b/src/lua/audio/luaopen_audio.cpp index 4f4f955..20a6bf4 100644 --- a/src/lua/audio/luaopen_audio.cpp +++ b/src/lua/audio/luaopen_audio.cpp @@ -55,7 +55,7 @@ namespace lua return 0; } - static int l_newSound(lua_State* L) + static int l_newSource(lua_State* L) { Filesystem* fs = Filesystem::get(); const char* f = luax_checkstring(L, 1); @@ -87,7 +87,7 @@ namespace lua {"pause", l_pause}, {"resume", l_resume}, {"setVolume",l_setVolume}, - {"Sound", l_newSound}, + {"Source", l_newSource}, // {"destroy",l_destroy}, {0, 0} diff --git a/src/lua/embed/boot.lua.h b/src/lua/embed/boot.lua.h index 0b04fc1..1ba613b 100644 --- a/src/lua/embed/boot.lua.h +++ b/src/lua/embed/boot.lua.h @@ -1,12 +1,10 @@ /* boot.lua */ static const char* boot_lua = R"( --- init filesystem jin._argv[2] = jin._argv[2] or '.' jin.filesystem.init() jin.filesystem.mount(jin._argv[2]) --- config local conf = {} if jin.filesystem.exist("config.lua") then conf = require "config" @@ -118,7 +116,7 @@ local function main() -- no game function jin.core.onEvent(e) if e.type == 'quit' then - jin.core.quit() + jin.core.stop() end end function jin.core.onDraw() diff --git a/src/lua/filesystem/luaopen_filesystem.cpp b/src/lua/filesystem/luaopen_filesystem.cpp index 3a19f12..f4138fc 100644 --- a/src/lua/filesystem/luaopen_filesystem.cpp +++ b/src/lua/filesystem/luaopen_filesystem.cpp @@ -88,12 +88,10 @@ namespace lua } } - // Check whether file exists. if (context.fs->exists(tmp.c_str())) { lua_pop(L, 1); lua_pushstring(L, tmp.c_str()); - // Ok, load it. return loadf(L); } @@ -102,9 +100,7 @@ namespace lua for (int i = 0; i<size; ++i) { if (tmp[i] == '.') - { tmp[i] = '/'; - } } if (context.fs->isDir(tmp.c_str())) @@ -114,7 +110,6 @@ namespace lua { lua_pop(L, 1); lua_pushstring(L, tmp.c_str()); - // Ok, load it. return loadf(L); } } diff --git a/src/lua/graphics/luaopen_JSL.cpp b/src/lua/graphics/luaopen_JSL.cpp index 9b9071c..7c59937 100644 --- a/src/lua/graphics/luaopen_JSL.cpp +++ b/src/lua/graphics/luaopen_JSL.cpp @@ -30,7 +30,7 @@ namespace lua COLOR, }; - static VARIABLE_TYPE strtotype(const char* str) + static VARIABLE_TYPE strToType(const char* str) { std::string s = std::string(str); if (s == "number") return NUMBER; @@ -55,7 +55,7 @@ namespace lua const char* variable = luax_checkstring(L, 3); if (typestr != nullptr) { - int type = strtotype(typestr); + int type = strToType(typestr); switch (type) { case NUMBER: diff --git a/src/lua/luaopen_jin.cpp b/src/lua/luaopen_jin.cpp index 6fbac77..1d95ebf 100644 --- a/src/lua/luaopen_jin.cpp +++ b/src/lua/luaopen_jin.cpp @@ -40,10 +40,17 @@ namespace lua luax_pushstring(L, "macos"); #endif return 1; + } + + static int l_revision(lua_State* L) + { + luax_pushnumber(L, REVISION); + return 1; } static const luaL_Reg f[] = { {"version", l_getversion}, + {"revision", l_revision}, {"author", l_getAuthor}, {"os", l_getOS}, {0, 0} diff --git a/src/lua/luaopen_jin.h b/src/lua/luaopen_jin.h index 3d446a5..f4253b6 100644 --- a/src/lua/luaopen_jin.h +++ b/src/lua/luaopen_jin.h @@ -24,7 +24,8 @@ #include "lua/luax.h" #define MODULE_NAME "jin" -#define VERSION "0.1.0" +#define VERSION "0.1.1" +#define REVISION 101 #define AUTHOR "chai" namespace jin |