aboutsummaryrefslogtreecommitdiff
path: root/src/script/embed/boot.lua.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-05-19 09:35:35 +0800
committerchai <chaifix@163.com>2018-05-19 09:35:35 +0800
commit6ed3819f1a859ffc350c4aaad132f164478f5d79 (patch)
tree438fb44f879f816d3293264ebea66ea64a3c5339 /src/script/embed/boot.lua.h
parent8ad6a7f955182955aec1fff0ed367f564f31e46a (diff)
修改主循环
Diffstat (limited to 'src/script/embed/boot.lua.h')
-rw-r--r--src/script/embed/boot.lua.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/script/embed/boot.lua.h b/src/script/embed/boot.lua.h
index ee1cbd3..afe352a 100644
--- a/src/script/embed/boot.lua.h
+++ b/src/script/embed/boot.lua.h
@@ -33,8 +33,9 @@ conf.fps = conf.fps or 60
conf.vsync = conf.vsync or false
conf.title = conf.title or ("jin v" .. jin.version())
--- init video subsystem
+-- initialize subsystems
jin.graphics.init(conf)
+--jin.audio.init(conf)
-- open debug mode, must after jin.graphics.init
if jin._argv[3] == '-d' then
@@ -73,8 +74,10 @@ function jin.core.run()
-- frame controle
last = now
now = second()
- if (now - last) < fsec then
- sleep(fsec - now + last)
+ dt = now - last
+ if dt < fsec then
+ sleep(fsec - dt)
+ dt = fsec
end
-- handle events
@@ -85,10 +88,6 @@ function jin.core.run()
end
-- update
- dt = now - last
- if dt < fsec then
- dt = fsec
- end
if onUpdate then
onUpdate(dt)
end
@@ -101,7 +100,7 @@ function jin.core.run()
-- custom drawing
if onDraw then
- onDraw()
+ onDraw()
end
-- render debug window