aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-07-29 21:30:03 +0800
committerchai <chaifix@163.com>2018-07-29 21:30:03 +0800
commit7ac86950d3a89a996974e8406ee88e8f5f44187d (patch)
treea173ac2e585fa99863ef74fc7d2f7b38f9db7164 /src
parentf94264fa4ba347fc362b4ae2deea5a12ff95f5af (diff)
*update
Diffstat (limited to 'src')
-rw-r--r--src/lua/audio/luaopen_audio.cpp4
-rw-r--r--src/lua/embed/boot.lua.h4
-rw-r--r--src/lua/filesystem/luaopen_filesystem.cpp5
-rw-r--r--src/lua/graphics/luaopen_JSL.cpp4
-rw-r--r--src/lua/luaopen_jin.cpp7
-rw-r--r--src/lua/luaopen_jin.h3
6 files changed, 14 insertions, 13 deletions
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