aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-02 20:29:33 +0800
committerchai <chaifix@163.com>2018-08-02 20:29:33 +0800
commitea9769944a2db3abe15f537dab67e16fdfc20bef (patch)
tree977d7bac7e2741724208a31d8d4d24522129d5c2 /src
parent2f595dccbf1657ad7e2a502bf72b15dcfe74b8c7 (diff)
*game loop op
Diffstat (limited to 'src')
-rw-r--r--src/lua/embed/boot.lua.h7
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)