diff options
author | chai <chaifix@163.com> | 2018-08-15 18:27:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-15 18:27:30 +0800 |
commit | be9b27dbf550093b555ab3087c11b38c89ab9fd0 (patch) | |
tree | ddd96bb71b3ad3a32ae844a38bb95525bd0b0666 /src/lua/embed/boot.lua | |
parent | ac9079ff1449e2638cbf7339edcc6e4b186e5eaa (diff) |
*update
Diffstat (limited to 'src/lua/embed/boot.lua')
-rw-r--r-- | src/lua/embed/boot.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lua/embed/boot.lua b/src/lua/embed/boot.lua index 6869ac8..e649737 100644 --- a/src/lua/embed/boot.lua +++ b/src/lua/embed/boot.lua @@ -1,4 +1,3 @@ - jin._argv[2] = jin._argv[2] or '.' jin.filesystem.init() jin.filesystem.mount(jin._argv[2]) @@ -28,13 +27,14 @@ local function safecall(func, ...) if func then func(...) end -end +end function jin.core.run() - safecall(jin.core.load) + safecall(jin.core.onLoad) local previous = jin.time.second() local SEC_PER_UPDATE = 1 / conf.fps local dt = SEC_PER_UPDATE + local running = true while(jin.core.running()) do for _, e in pairs(jin.event.poll()) do if e.type == "keydown" then @@ -43,10 +43,10 @@ function jin.core.run() jin.keyboard.set(e.key, false) end safecall(jin.core.onEvent, e) + running = jin.core.running() + if not running then break end end - if not jin.core.running() then - break - end + if not running then break end safecall(jin.core.onUpdate, dt) @@ -88,7 +88,7 @@ local function onError(msg) end end -local function main() +local function boot() if jin.filesystem.exist("main.lua") then -- require main game script xpcall(function() require"main" end, onError) @@ -115,4 +115,4 @@ local function main() jin.core.quit() end -main() +boot() |