diff options
-rw-r--r-- | Tilemap/init.lua | 0 | ||||
-rw-r--r-- | global/global.lua | 13 | ||||
-rw-r--r-- | main.lua | 12 | ||||
-rw-r--r-- | newton/init.lua | 7 |
4 files changed, 28 insertions, 4 deletions
diff --git a/Tilemap/init.lua b/Tilemap/init.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tilemap/init.lua diff --git a/global/global.lua b/global/global.lua new file mode 100644 index 0000000..7cce50c --- /dev/null +++ b/global/global.lua @@ -0,0 +1,13 @@ +local global = {} +_G = _G or {} +global._G = _G + +global.get = function(var) + return _G[var] +end + +global.set = function(var, value) + _G[var] = value +end + +return global
\ No newline at end of file @@ -1,11 +1,14 @@ local loghelper = require("loghelper") loghelper.strict(loghelper.LEVEL.INFO) +local global = require("global.global") local timer = require("timer.timer") +global.set("frame", 0) -jin.core.load = function() +jin.core.onLoad = function() timer.every(1.0, function() - loghelper.log(loghelper.LEVEL.INFO, "test") + loghelper.log(loghelper.LEVEL.INFO, global.get("frame") .. "fps") + global.set("frame", 0) end) end @@ -19,11 +22,12 @@ jin.core.onEvent = function(e) end end -jin.core.onUpdate = function(dt) +jin.core.onUpdate = function(dt) + global.set("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 +end diff --git a/newton/init.lua b/newton/init.lua new file mode 100644 index 0000000..47781ff --- /dev/null +++ b/newton/init.lua @@ -0,0 +1,7 @@ +local newton = {} + +newton.update = function(dt) + +end + +return newton
\ No newline at end of file |