aboutsummaryrefslogtreecommitdiff
path: root/src/script/embed/boot.lua.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/embed/boot.lua.h')
-rw-r--r--src/script/embed/boot.lua.h26
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