summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/main.lua b/main.lua
index 4f1e82d..f6d3441 100644
--- a/main.lua
+++ b/main.lua
@@ -1,14 +1,22 @@
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
jin.core.onLoad = function()
+ 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
end)
+ timer.after(4.0, function()
+ EventMsgCenter.unregisterAllMsgByEvent(Events.Player_Move)
+ end)
end
jin.core.onEvent = function(e)
@@ -24,9 +32,10 @@ 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
+
+end \ No newline at end of file