diff options
author | chai <chaifix@163.com> | 2018-12-23 14:24:49 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-23 14:24:49 +0800 |
commit | d5bd4d53dfcda03558be24e8c353fc042802c085 (patch) | |
tree | a9109b68e529a49314154f5511fe53bb0e74fc0f /bin/game/main.lua | |
parent | 5b8b5c95589e615afda3f0d67db612b64297c2a0 (diff) |
* json\xml扩展
Diffstat (limited to 'bin/game/main.lua')
-rw-r--r-- | bin/game/main.lua | 36 |
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) |