aboutsummaryrefslogtreecommitdiff
path: root/bin/main.lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-12 19:52:54 +0800
committerchai <chaifix@163.com>2018-08-12 19:52:54 +0800
commit7b34bd98bb00796febd5351b9d2e75fd2c247432 (patch)
treedd2da6fa01094f864d8deb358d7f9a8fe1b32b1c /bin/main.lua
parent5fe41eca99adf4bf0fb5832033a96f98b530d4f1 (diff)
*update
Diffstat (limited to 'bin/main.lua')
-rw-r--r--bin/main.lua71
1 files changed, 1 insertions, 70 deletions
diff --git a/bin/main.lua b/bin/main.lua
index 48bdd9a..3480016 100644
--- a/bin/main.lua
+++ b/bin/main.lua
@@ -1,72 +1,3 @@
-local loghelper = require("loghelper")
-loghelper.strict(loghelper.LEVEL.INFO)
-local EventMsgCenter = require("EventMsgCenter.EventMsgCenter")
-local Events = require("EventMsgCenter.Events")
-local timer = require("timer.timer")
-_G["frame"] = 0
+require "jin-modules.main"
-local thread = nil
-jin.core.onLoad = function()
- thread = jin.thread.Thread("Test", [[
- local t = jin.thread.getThread()
- local str = t:demand(2)
- print(str)
- t:send(3, "back data")
- while true do
- jin.time.sleep(1)
- end
- ]])
- thread:start()
- EventMsgCenter.registerMsg(Events.Player_Move, function(msg)
- print(msg)
- end)
- timer.every(1.0, function()
- loghelper.log(loghelper.LEVEL.INFO, _G["frame"] .. "fps")
- EventMsgCenter.sendMsg(Events.Player_Move, _G["frame"])
- _G["frame"] = 0
- if thread:receive(3) then
- print(thread:fetch(3))
- end
- end)
- timer.after(4.0, function()
- thread:send(2, "test thread data")
- EventMsgCenter.unregisterAllMsgByEvent(Events.Player_Move)
- end)
-
-----------------------------------------------------
--- jin.bit测试
-local size = 0
-local buff = ""
--- buff, size = jin.bit.write(buff, size, "test")
--- buff, size = jin.bit.write(buff, size, "hello")
-buff, size = jin.bit.write(buff, size, "hello,world!")
-buff, size = jin.bit.write(buff, size, true)
-buff, size = jin.bit.write(buff, size, 250)
-local str, len = jin.bit.grabstring(buff, size)
-print(str)
-buff, size = jin.bit.shift(buff, size, len + 1)
-local a = jin.bit.grabboolean(buff, size)
-print(a)
-end
-
-jin.core.onEvent = function(e)
- if e.type == "quit" then
- jin.core.stop()
- elseif e.type == "keydown" then
- if e.key == "Escape" then
- jin.core.stop()
- end
- end
-end
-
-jin.core.onUpdate = function(dt)
- _G["frame"] = _G["frame"] + 1
- timer.update(dt)
-
- -- loghelper.log(loghelper.LEVEL.WARN, "版本" .. jin.revision())
-end
-
-jin.core.onDraw = function()
-
-end \ No newline at end of file