diff options
author | chai <chaifix@163.com> | 2018-05-19 09:15:28 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-05-19 09:15:28 +0800 |
commit | 8ad6a7f955182955aec1fff0ed367f564f31e46a (patch) | |
tree | 44224262d2b19d68d04137bb50e2a11490b6c8a8 /src/script/embed/boot.lua.h | |
parent | bda9d88e84a1dccd4df978205a6ba1f141178b0c (diff) |
修改窗口配置
Diffstat (limited to 'src/script/embed/boot.lua.h')
-rw-r--r-- | src/script/embed/boot.lua.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/script/embed/boot.lua.h b/src/script/embed/boot.lua.h index 822e1cf..ee1cbd3 100644 --- a/src/script/embed/boot.lua.h +++ b/src/script/embed/boot.lua.h @@ -26,14 +26,15 @@ jin.filesystem.mount(jin._argv[2]) local conf = {} if jin.filesystem.exist("config.lua") then conf = require "config" -end -conf.width = conf.width or 600 +end +conf.width = conf.width or 600 conf.height = conf.height or 500 -conf.fps = conf.fps or 60 -conf.title = conf.title or ("jin v" .. jin.version()) +conf.fps = conf.fps or 60 +conf.vsync = conf.vsync or false +conf.title = conf.title or ("jin v" .. jin.version()) --- init video subsystem -jin.graphics.init(conf.width,conf.height,conf.title) +-- init video subsystem +jin.graphics.init(conf) -- open debug mode, must after jin.graphics.init if jin._argv[3] == '-d' then @@ -54,13 +55,18 @@ function jin.core.run() local onUpdate = jin.core.onUpdate local present = jin.graphics.present + local dstatus = jin.debug.status + local drender = jin.debug.render + + local fps = conf.fps + if load then load() end local now = second() local last = now - local fsec = 1/conf.fps + local fsec = 1/fps local dt = 0 while(running()) do @@ -71,7 +77,7 @@ function jin.core.run() sleep(fsec - now + last) end - -- handle events + -- handle events for _, e in pairs(poll()) do if _onEvent then _onEvent(e) @@ -99,8 +105,8 @@ function jin.core.run() end -- render debug window - if jin.debug.status() then - jin.debug.render() + if dstatus() then + drender() end -- swap window buffer |