diff options
Diffstat (limited to 'bin')
32 files changed, 1 insertions, 358 deletions
diff --git a/bin/BeatEm/init.lua b/bin/BeatEm/init.lua deleted file mode 100644 index b9cab27..0000000 --- a/bin/BeatEm/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -local BeatEm = { - _NAME = "BeatEm" - _AUTHOR = "Chai", - _DESCRIPTION = [[ -A Fighting game utility for Jin game framework. - ]], - _JIN_REVISION = 101, - _REVISION = 100 - _LISENCE = [[ - - ]] -} - -return BeatEm
\ No newline at end of file diff --git a/bin/BehaviorTree/init.lua b/bin/BehaviorTree/init.lua deleted file mode 100644 index 79863bc..0000000 --- a/bin/BehaviorTree/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -local BehaviorTree = {} - -return BehaviorTrees
\ No newline at end of file diff --git a/bin/EventMsgCenter/EventMsgCenter.lua b/bin/EventMsgCenter/EventMsgCenter.lua deleted file mode 100644 index 7b944c2..0000000 --- a/bin/EventMsgCenter/EventMsgCenter.lua +++ /dev/null @@ -1,55 +0,0 @@ -local EventMsgCenter = {} - --- <event, {callbacks}> -local _broadcast = {} - -EventMsgCenter.registerMsg = function(e, callback, first) - if _broadcast[e] == nil then - _broadcast[e] = {} - end - first = first or false - EventMsgCenter.unregisterMsg(e, callback) - if not first then - table.insert(_broadcast[e], callback) - else - table.insert(_broadcast[e], 1, callback) - end -end - -local removeElement = function(t, e) - for i, v in ipairs(t) do - if v == e then - table.remove(t, i) - break - end - end -end - -EventMsgCenter.unregisterMsg = function(e, callback) - if _broadcast[e] == nil or callback == nil then - return - end - removeElement(_broadcast[e], callback) -end - -EventMsgCenter.unregisterAllMsgByEvent = function(e) - _broadcast[e] = nil -end - -EventMsgCenter.unregisterAllMsg = function() - _broadcast = {} -end - -EventMsgCenter.sendMsg = function(e, ...) - local callbacks = _broadcast[e] - if callbacks == nil then - return - end - for _, f in ipairs(callbacks) do - if f ~= nil then - f(...) - end - end -end - -return EventMsgCenter
\ No newline at end of file diff --git a/bin/EventMsgCenter/Events.lua b/bin/EventMsgCenter/Events.lua deleted file mode 100644 index 3803fd4..0000000 --- a/bin/EventMsgCenter/Events.lua +++ /dev/null @@ -1,21 +0,0 @@ -local events = { - - "Player_Move", - "Player_Change", - "Player_Spawn", - "Player_Kick", - - "" - -} - -function CreatEnumTable(tbl, index) - local enumtbl = {} - local enumindex = index or 0 - for i, v in ipairs(tbl) do - enumtbl[v] = enumindex + i - end - return enumtbl -end - -return CreatEnumTable(events)
\ No newline at end of file diff --git a/bin/EventMsgCenter/README.md b/bin/EventMsgCenter/README.md deleted file mode 100644 index ef3bd92..0000000 --- a/bin/EventMsgCenter/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Event Massage Center - diff --git a/bin/StateMachine/init.lua b/bin/StateMachine/init.lua deleted file mode 100644 index 83daeb7..0000000 --- a/bin/StateMachine/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -local StateMachine = {} - -return StateMachine
\ No newline at end of file diff --git a/bin/Tilemap/init.lua b/bin/Tilemap/init.lua deleted file mode 100644 index e69de29..0000000 --- a/bin/Tilemap/init.lua +++ /dev/null diff --git a/bin/UI/Button.lua b/bin/UI/Button.lua deleted file mode 100644 index 69950b7..0000000 --- a/bin/UI/Button.lua +++ /dev/null @@ -1,5 +0,0 @@ -local Button = {} - - - -return Button
\ No newline at end of file diff --git a/bin/a.ogg b/bin/a.ogg Binary files differdeleted file mode 100644 index 9ba4905..0000000 --- a/bin/a.ogg +++ /dev/null diff --git a/bin/a.png b/bin/a.png Binary files differdeleted file mode 100644 index e3712e5..0000000 --- a/bin/a.png +++ /dev/null diff --git a/bin/a.wav b/bin/a.wav Binary files differdeleted file mode 100644 index 74b2e31..0000000 --- a/bin/a.wav +++ /dev/null diff --git a/bin/anim/README.md b/bin/anim/README.md deleted file mode 100644 index e69de29..0000000 --- a/bin/anim/README.md +++ /dev/null diff --git a/bin/anim/anim.lua b/bin/anim/anim.lua deleted file mode 100644 index a1529c3..0000000 --- a/bin/anim/anim.lua +++ /dev/null @@ -1,11 +0,0 @@ -local anim = { - _DESCRIPTION = [[ - - ]], - _AUTHOR = "Chai", - _JIN_REVISION = 101, - -} - - -return anim
\ No newline at end of file diff --git a/bin/class/class.lua b/bin/class/class.lua deleted file mode 100644 index 6cff4d7..0000000 --- a/bin/class/class.lua +++ /dev/null @@ -1,15 +0,0 @@ -local class = {} - -class.new = function(self, ...) - local c = {} - setmetatable(c, self) - self.__index = self - if self.init then - self.init(...) - end - return c -end - -class.static = {} - -return class
\ No newline at end of file diff --git a/bin/component/component.lua b/bin/component/component.lua deleted file mode 100644 index 2432054..0000000 --- a/bin/component/component.lua +++ /dev/null @@ -1,20 +0,0 @@ -local Component = { - object = nil -} - -Component.new = function(obj) - local component = {} - setmetatable(component, Component) - Component.__index = Component - component:_init(obj) -end - -Component._init = function(self, obj) - self.object = obj -end - -Component.update = function(dt) - -end - -return Component
\ No newline at end of file diff --git a/bin/enum/enum.lua b/bin/enum/enum.lua deleted file mode 100644 index 20a653d..0000000 --- a/bin/enum/enum.lua +++ /dev/null @@ -1,11 +0,0 @@ -local createEnumTable = function(tbl, index) - assert(IsTable(tbl)) - local enumtbl = {} - local enumindex = index or 0 - for i, v in ipairs(tbl) do - enumtbl[v] = enumindex + i - end - return enumtbl -end - -return createEnumTable
\ No newline at end of file diff --git a/bin/jin.exe b/bin/jin.exe Binary files differindex 0d065ea..0f2215c 100644 --- a/bin/jin.exe +++ b/bin/jin.exe diff --git a/bin/jin3d/init.lua b/bin/jin3d/init.lua deleted file mode 100644 index e69de29..0000000 --- a/bin/jin3d/init.lua +++ /dev/null diff --git a/bin/json/README.md b/bin/json/README.md deleted file mode 100644 index e69de29..0000000 --- a/bin/json/README.md +++ /dev/null diff --git a/bin/lightning.png b/bin/lightning.png Binary files differdeleted file mode 100644 index 89d0549..0000000 --- a/bin/lightning.png +++ /dev/null diff --git a/bin/loghelper/init.lua b/bin/loghelper/init.lua deleted file mode 100644 index fc07943..0000000 --- a/bin/loghelper/init.lua +++ /dev/null @@ -1,33 +0,0 @@ --- 不能使用 debug 命名模块,会冲突, --- 要使用其余名字比如 loghelper -local loghelper = {} -io.stdout:setvbuf("no") - -loghelper.LEVEL = { - INFO = 4, - DEBUG = 3, - WARN = 2, - ERROR = 1, - NONE = 0 -} - -local logTag = { - [loghelper.LEVEL.INFO] = "[Info]", - [loghelper.LEVEL.DEBUG] = "[Debug]", - [loghelper.LEVEL.WARN] = "[Warn]", - [loghelper.LEVEL.ERROR] = "[Error]", -} - -loghelper.level = loghelper.LEVEL.INFO - -loghelper.strict = function(level) - loghelper.level = level -end - -loghelper.log = function(level, msg) - if level <= loghelper.level then - print(logTag[level] .. ":" .. msg) - end -end - -return loghelper
\ No newline at end of file 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 diff --git a/bin/newton/README.md b/bin/newton/README.md deleted file mode 100644 index e69de29..0000000 --- a/bin/newton/README.md +++ /dev/null diff --git a/bin/newton/init.lua b/bin/newton/init.lua deleted file mode 100644 index 41f9f9a..0000000 --- a/bin/newton/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -local newton = {} - -newton.world = {} - -newton.update = function(dt) - -end - -return newton
\ No newline at end of file diff --git a/bin/particle/particle.lua b/bin/particle/particle.lua deleted file mode 100644 index e430da9..0000000 --- a/bin/particle/particle.lua +++ /dev/null @@ -1,5 +0,0 @@ -local particle = {} - - - -return particle
\ No newline at end of file diff --git a/bin/pool/pool.lua b/bin/pool/pool.lua deleted file mode 100644 index 39eb3a6..0000000 --- a/bin/pool/pool.lua +++ /dev/null @@ -1,3 +0,0 @@ -local pool = {} - -return pool
\ No newline at end of file diff --git a/bin/shader/README.md b/bin/shader/README.md deleted file mode 100644 index e69de29..0000000 --- a/bin/shader/README.md +++ /dev/null diff --git a/bin/timer/timer.lua b/bin/timer/timer.lua deleted file mode 100644 index 398f47f..0000000 --- a/bin/timer/timer.lua +++ /dev/null @@ -1,78 +0,0 @@ -local Timer = {} -local MODE = { - NONE = 0, - EVERY = 1, - REPEATS = 2, - AFTER = 3, -} -Timer.timers = {} -local timer = { - new = function(self, _mod, _duration, _count, _callback) - local t = {} - setmetatable(t, self) - self.__index = self - t:_init(_mod, _duration, _count, _callback) - return t - end, - _init = function(self, _mod, _duration, _count, _callback) - self.tick = 0 - self.duration = _duration - self.mode = _mod - self.count = _count - self.callback = _callback - end, - update = function(self, dt) - self.tick = self.tick + dt - if self.tick >= self.duration then - if self.mode == MODE.EVERY then - self.tick = 0 - elseif self.mode == MODE.REPEATS then - self.tick = 0 - self.count = self.count - 1 - if self.count <= 0 then - -- remove this - for i, v in ipairs(Timer.timers) do - if v == self then - table.remove(Timer.timers, i) - break - end - end - end - elseif self.mode == MODE.AFTER then - -- remove this - for i, v in ipairs(Timer.timers) do - if v == self then - table.remove(Timer.timers, i) - break - end - end - end - if self.callback then - self.callback() - end - end - end -} - -Timer.update = function(sec) - for _, t in ipairs(Timer.timers) do - t:update(sec) - end -end - -Timer.every = function(sec, callback) - local t = timer:new(MODE.EVERY, sec, nil, callback) - table.insert(Timer.timers, t) -end - -Timer.repeats = function(sec, rpt, callback) - local t = timer:new(MODE.REPEATS, sec, rpt, callback) - table.insert(Timer.timers, t) -end - -Timer.after = function(sec, callback) - local t = timer:new(MODE.AFTER, sec, nil, callback) - table.insert(Timer.timers, t) -end - -return Timer
\ No newline at end of file diff --git a/bin/treestump.png b/bin/treestump.png Binary files differdeleted file mode 100644 index 45d8d28..0000000 --- a/bin/treestump.png +++ /dev/null diff --git a/bin/treestump_diffuse.png b/bin/treestump_diffuse.png Binary files differdeleted file mode 100644 index 272e6a2..0000000 --- a/bin/treestump_diffuse.png +++ /dev/null diff --git a/bin/treestump_lines.png b/bin/treestump_lines.png Binary files differdeleted file mode 100644 index 293a757..0000000 --- a/bin/treestump_lines.png +++ /dev/null diff --git a/bin/xml/README.md b/bin/xml/README.md deleted file mode 100644 index e69de29..0000000 --- a/bin/xml/README.md +++ /dev/null |