From ea9769944a2db3abe15f537dab67e16fdfc20bef Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 2 Aug 2018 20:29:33 +0800 Subject: *game loop op --- src/lua/embed/boot.lua.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lua/embed/boot.lua.h') 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) -- cgit v1.1-26-g67d0