aboutsummaryrefslogtreecommitdiff
path: root/bin/game/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bin/game/main.lua')
-rw-r--r--bin/game/main.lua36
1 files changed, 23 insertions, 13 deletions
diff --git a/bin/game/main.lua b/bin/game/main.lua
index 224da77..a1794aa 100644
--- a/bin/game/main.lua
+++ b/bin/game/main.lua
@@ -81,10 +81,11 @@ function jin.core.onLoad()
{ name = 'panic', from = 'green', to = 'red' },
{ name = 'calm', from = 'red', to = 'green' },
}})
- print(fsm.current) -- "none"
+ jin.log.info(fsm.current) -- "none"
fsm:startup()
- print(fsm.current) -- "green"
-
+ jin.log.info(fsm.current) -- "green"
+ jin.log.info(jin.utils.json.encode({ 1, 2, 3, { x = 10 } }))
+ jin.log.info(jin.utils.json.decode('[1,2,3,{"x":10}]'))
sinShader = jin.graphics.newShader[[
#VERTEX_SHADER
Vertex vert(Vertex v)
@@ -95,19 +96,29 @@ function jin.core.onLoad()
#FRAGMENT_SHADER
Color frag(Color col, Texture tex, Vertex v)
{
- col.r = 0;
- col.g = 0;
- col.b = 0;
- float t = jin_Time.y * 60;
- if(t < 0.9)
- col.b = 1;
- else
- col.r = t;
-
+ col.r = sin(jin_Time.x);
+ col.g = cos(jin_Time.x);
+ col.b = sin(jin_Time.x);
return col;
}
#END_FRAGMENT_SHADER
]]
+
+ jin.log.info("test")
+
+ timer:every(1, function()
+ jin.log.info(jin.time.getFPS() .. " fps")
+ end)
+
+ local xmlParser = jin.utils.xml.newParser()
+ local xml = xmlParser:ParseXmlText[[
+ <test one="two">
+ <three four="five" four="six"/>
+ <three>eight</three>
+ <nine ten="eleven">twelve</nine>
+ </test>
+ ]]
+ jin.log.info(xml.test["@one"])
end
function jin.core.onEvent(e)
@@ -120,7 +131,6 @@ local t = 0
function jin.core.onUpdate(dt)
tb.x = t
t = t + jin.time.getDelta()
- print(jin.time.getFPS())
animator:update(jin.time.getDelta())
timer:update(jin.time.getDelta())
ps:update(dt)