aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/embed/boot.lua.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-20 12:18:19 +0800
committerchai <chaifix@163.com>2018-08-20 12:18:19 +0800
commit79b35943dc3f5dbb0028b29e4745390204daf125 (patch)
tree7693a668d55cb75c645bf23c83db4ee539603afd /src/lua/modules/embed/boot.lua.h
parentafb6ec91cac7ebdb3696e9e450d819e897ca17cb (diff)
*update
Diffstat (limited to 'src/lua/modules/embed/boot.lua.h')
-rw-r--r--src/lua/modules/embed/boot.lua.h32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/lua/modules/embed/boot.lua.h b/src/lua/modules/embed/boot.lua.h
index 32d3e1d..42f38d8 100644
--- a/src/lua/modules/embed/boot.lua.h
+++ b/src/lua/modules/embed/boot.lua.h
@@ -4,6 +4,10 @@ jin._argv[2] = jin._argv[2] or '.'
jin.filesystem.init()
jin.filesystem.mount(jin._argv[2])
+-------------------------------------------------------------------------
+-- Config game
+-------------------------------------------------------------------------
+
local conf = {}
if jin.filesystem.exist("config.lua") then
conf = require "config"
@@ -16,7 +20,10 @@ conf.title = conf.title or ("jin v" .. jin.version())
conf.resizable = conf.resizable or false
conf.fullscreen = conf.fullscreen or false
--- initialize subsystems
+-------------------------------------------------------------------------
+-- Initialize sub systems
+-------------------------------------------------------------------------
+
jin.graphics.init(conf)
jin.audio.init()
@@ -57,10 +64,10 @@ function jin.core.run()
call(jin.core.onUpdate, dt)
- jin.graphics.unbind()
+ jin.graphics.unbindCanvas()
jin.graphics.clear()
- jin.graphics.color()
- jin.graphics.study()
+ jin.graphics.setColor()
+ jin.graphics.setFont()
call(jin.core.onDraw)
jin.graphics.present()
@@ -85,16 +92,16 @@ local function onError(msg)
jin.core.stop()
end
end
- local ww, wh = jin.graphics.size()
+ local ww, wh = jin.graphics.getSize()
function jin.core.onDraw()
jin.graphics.write("Error: ", 10, 10, 30, 3, 30)
jin.graphics.write(msg, 10, 50)
end
end
--------------------------------------------------------------------------------
+-------------------------------------------------------------------------
-- No game handler
--------------------------------------------------------------------------------
+-------------------------------------------------------------------------
jin.nogame = {
cs = 64,
@@ -131,7 +138,12 @@ jin.nogame = {
end
r = math.sin((r/nogame.ww)*math.pi)*nogame.cs/2
local fact = (x + y) / nogame.ch * nogame.cw
- jin.graphics.color(155 + 100 * math.sin(fact), 155 + 100 * math.cos(fact), 155 + 100 * math.sin(fact * fact), 255)
+ jin.graphics.setColor(
+ 155 + 100 * math.sin(fact),
+ 155 + 100 * math.cos(fact),
+ 155 + 100 * math.sin(fact * fact),
+ 255
+ )
jin.graphics.circle("fill", x*nogame.cs + nogame.cs/2, y*nogame.cs + nogame.cs/2, r)
end,
onDraw = function()
@@ -144,9 +156,9 @@ jin.nogame = {
end
}
--------------------------------------------------------------------------------
+-------------------------------------------------------------------------
-- Boot jin
--------------------------------------------------------------------------------
+-------------------------------------------------------------------------
local function boot()
if jin.filesystem.exist("main.lua") then