Love2d support is updated to 11.1

May be bugs in supporting libraries, but the multitasking library is fully updated.

The guimanager may have a bug or 2, but I haven't found any ground breaking bugs that haven't been fixed
This commit is contained in:
2018-06-08 22:14:21 -04:00
parent a07fe49880
commit 89b4901e06
33 changed files with 515 additions and 470 deletions
+2 -87
View File
@@ -23,64 +23,10 @@ SOFTWARE.
]]
require("multi")
os.sleep=love.timer.sleep
function love.run()
if love.math then
love.math.setRandomSeed(os.time())
end
if love.event then
love.event.pump()
end
if love.load then love.load(arg) end
if love.timer then love.timer.step() end
local dt = 0
local breakme=false
multi:newThread("MAIN-RUN",function()
while true do
-- Process events.
if love.event then
love.event.pump()
for name, a,b,c,d,e,f in love.event.poll() do
if name == "quit" then
if not love.quit or not love.quit() then
breakme=true
thread.kill()
break
end
end
love.handlers[name](a,b,c,d,e,f)
end
end
if love.timer then
love.timer.step()
dt = love.timer.getDelta()
end
if love.update then love.update(dt) end
if love.window and love.graphics and love.window.isCreated() then
love.graphics.clear()
love.graphics.origin()
if love.draw then love.draw() end
multi.dManager()
love.graphics.setColor(255,255,255,255)
if multi.draw then multi.draw() end
love.graphics.present()
end
thread.sleep()
end
end)
while not breakme do
love.timer.sleep(.005)
multi:uManager(dt)
if multi.boost then
for i=1,multi.boost-1 do
multi:uManager(dt)
end
end
end
return
end
multi.drawF={}
function multi:dManager()
function multi.dManager()
for ii=1,#multi.drawF do
love.graphics.setColor(255,255,255,255)
multi.drawF[ii]()
end
end
@@ -88,34 +34,3 @@ function multi:onDraw(func,i)
i=i or 1
table.insert(self.drawF,i,func)
end
--~ function multi:lManager()
--~ if love.event then
--~ love.event.pump()
--~ for e,a,b,c,d in love.event.poll() do
--~ if e == "quit" then
--~ if not love.quit or not love.quit() then
--~ if love.audio then
--~ love.audio.stop()
--~ end
--~ return nil
--~ end
--~ end
--~ love.handlers[e](a,b,c,d)
--~ end
--~ end
--~ if love.timer then
--~ love.timer.step()
--~ dt = love.timer.getDelta()
--~ end
--~ if love.update then love.update(dt) end
--~ multi:uManager(dt)
--~ if love.window and love.graphics and love.window.isCreated() then
--~ love.graphics.clear()
--~ love.graphics.origin()
--~ if love.draw then love.draw() end
--~ multi.dManager()
--~ love.graphics.setColor(255,255,255,255)
--~ if multi.draw then multi.draw() end
--~ love.graphics.present()
--~ end
--~ end
+2 -2
View File
@@ -23,8 +23,8 @@ SOFTWARE.
]]
require("bin")
multi = {}
multi.Version = "1.10.0"
multi._VERSION = "1.10.0"
multi.Version = "1.11.0"
multi._VERSION = "1.11.0"
multi.stage = "stable"
multi.__index = multi
multi.Mainloop = {}
+50
View File
@@ -249,6 +249,56 @@ function multi:systemThreadedBenchmark(n,p)
end)
return c
end
function multi:newSystemThreadedConsole(name)
local c={}
c.name = name
local sThread=multi.integration.THREAD
local GLOBAL=multi.integration.GLOBAL
function c:init()
require("multi")
if multi:getPlatform()=="love2d" then
GLOBAL=_G.GLOBAL
sThread=_G.sThread
end
local cc={}
if isMainThread then
if GLOBAL["__SYSTEM_CONSLOE__"] then
cc.stream = sThread.waitFor("__SYSTEM_CONSLOE__"):init()
else
cc.stream = multi:newSystemThreadedQueue("__SYSTEM_CONSLOE__"):init()
multi:newThread("Threaded_Console",function()
while true do
thread.sleep(.001)
local data = cc.stream:pop()
if data then
local dat = table.remove(data,1)
if dat=="w" then
io.write(unpack(data))
elseif dat=="p" then
print(unpack(data))
end
end
end
end)
end
else
cc.stream = sThread.waitFor("__SYSTEM_CONSLOE__"):init()
end
function cc:write(msg)
self.stream:push({"w",tostring(msg)})
end
function cc:print(...)
local tab = {...}
for i=1,#tab do
tab[i]=tostring(tab[i])
end
self.stream:push({"p",unpack(tab)})
end
return cc
end
GLOBAL[c.name]=c
return c
end
function multi:newSystemThreadedTable(name)
local c={}
c.name=name -- set the name this is important for identifying what is what