diff options
author | chai <chaifix@163.com> | 2018-08-02 20:29:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-02 20:29:33 +0800 |
commit | ea9769944a2db3abe15f537dab67e16fdfc20bef (patch) | |
tree | 977d7bac7e2741724208a31d8d4d24522129d5c2 /src/lua/embed/boot.lua.h | |
parent | 2f595dccbf1657ad7e2a502bf72b15dcfe74b8c7 (diff) |
*game loop op
Diffstat (limited to 'src/lua/embed/boot.lua.h')
-rw-r--r-- | src/lua/embed/boot.lua.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lua/embed/boot.lua.h b/src/lua/embed/boot.lua.h index e0c43ee..fc201d1 100644 --- a/src/lua/embed/boot.lua.h +++ b/src/lua/embed/boot.lua.h @@ -37,6 +37,7 @@ function jin.core.run() 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 @@ -45,10 +46,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) |