mirror of
https://github.com/rayaman/multi.git
synced 2026-09-05 07:27:35 -04:00
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:
@@ -1,5 +1,19 @@
|
||||
local function HSL(h, s, l, a)
|
||||
if s<=0 then return l,l,l,a end
|
||||
h, s, l = h/256*6, s/255, l/255
|
||||
local c = (1-math.abs(2*l-1))*s
|
||||
local x = (1-math.abs(h%2-1))*c
|
||||
local m,r,b,g = (l-.5*c), 0,0,0
|
||||
if h < 1 then r,b,g = c,x,0
|
||||
elseif h < 2 then r,b,g = x,c,0
|
||||
elseif h < 3 then r,b,g = 0,c,x
|
||||
elseif h < 4 then r,b,g = 0,x,c
|
||||
elseif h < 5 then r,b,g = x,0,c
|
||||
else r,b,g = c,0,x
|
||||
end return (r+m)*255,(g+m)*255,(b+m)*255,a
|
||||
end
|
||||
Color={
|
||||
new=function(r,g,b)
|
||||
new=function(r,b,g)
|
||||
mt = {
|
||||
__add = function (c1,c2)
|
||||
return Color.new(c1[1]+c2[1],c1[2]+c2[2],c1[2]+c2[2])
|
||||
@@ -29,7 +43,7 @@ new=function(r,g,b)
|
||||
__lt = Color.LT,
|
||||
__le = Color.LE,
|
||||
}
|
||||
local temp = {r,g,b,255}
|
||||
local temp = {r/255,b/255,g/255,1}
|
||||
setmetatable(temp, mt)
|
||||
return temp
|
||||
end,
|
||||
@@ -57,14 +71,13 @@ Darken=function(color,v)
|
||||
currentR=color[1]
|
||||
currentG=color[2]
|
||||
currentB=color[3]
|
||||
return Color.new(currentR * (1 - v),currentG * (1 - v),currentB * (1 - v))
|
||||
return Color.new((currentR*255) * (1 - v),(currentG*255) * (1 - v),(currentB*255) * (1 - v))
|
||||
end,
|
||||
Lighten=function(color,v)
|
||||
currentR=color[1]
|
||||
currentG=color[2]
|
||||
currentB=color[3]
|
||||
|
||||
return Color.new(currentR + (255 - currentR) * v,currentG + (255 - currentG) * v,currentB + (255 - currentB) * v)
|
||||
return Color.new(currentR*255 + (255 - (currentR*255)) * v,currentG*255 + (255 - (currentG*255)) * v,currentB*255 + (255 - (currentB*255)) * v)
|
||||
end
|
||||
}
|
||||
Color.IndexColor("Black",20,20,20)
|
||||
|
||||
@@ -24,15 +24,15 @@ function gui:newBase(tp,name, x, y, w, h, sx ,sy ,sw ,sh)
|
||||
else
|
||||
c.Parent=self
|
||||
end
|
||||
c.segments=nil
|
||||
c.ry=nil
|
||||
c.rx=nil
|
||||
c.DPI=1
|
||||
if _GuiPro.DPI_ENABLED then
|
||||
c.DPI=love.window.getPixelScale()
|
||||
x, y, w, h=c.DPI*x,c.DPI*y,c.DPI*w,c.DPI*h
|
||||
end
|
||||
c.centerFontY=true
|
||||
c.segments=nil
|
||||
c.ry=nil
|
||||
c.rx=nil
|
||||
c.DPI=1
|
||||
if _GuiPro.DPI_ENABLED then
|
||||
c.DPI=love.window.getPixelScale()
|
||||
x, y, w, h=c.DPI*x,c.DPI*y,c.DPI*w,c.DPI*h
|
||||
end
|
||||
c.centerFontY=true
|
||||
c.FormFactor="rectangle"
|
||||
c.Type=tp
|
||||
c.Active=true
|
||||
@@ -42,7 +42,6 @@ function gui:newBase(tp,name, x, y, w, h, sx ,sy ,sw ,sh)
|
||||
c:SetName(name)
|
||||
c.BorderSize=1
|
||||
c.BorderColor={0,0,0}
|
||||
c.BorderVisibility=1
|
||||
c.VIS=true
|
||||
c.Visible=true
|
||||
c.oV=true
|
||||
@@ -178,6 +177,13 @@ function gui:newBase(tp,name, x, y, w, h, sx ,sy ,sw ,sh)
|
||||
_GuiPro.self=self
|
||||
if type(i)=="number" then
|
||||
loadstring("_GuiPro.self:"..v)()
|
||||
elseif i:match"__self__" then
|
||||
local ind=i:match"__self__(.+)"
|
||||
if not self[ind] then self[ind]={} end
|
||||
loadstring("_GuiPro.self."..ind.."=_GuiPro.self:"..v)()
|
||||
elseif i:match"__child__" then
|
||||
local ind,child = i:match"__child__(%S-)_(.+)"
|
||||
self[ind][child]=v
|
||||
else
|
||||
self[i]=v
|
||||
end
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
function gui:toString() -- oh boy this is gonna be painful lol
|
||||
multi:newThread("saving data: ",function()
|
||||
local dat=bin.stream("test.dat",false)
|
||||
function GetAllChildren2(Object)
|
||||
local Stuff = {}
|
||||
function Seek(Items)
|
||||
for i=1,#Items do
|
||||
--table.insert(Stuff,Items[i])
|
||||
for a,v in pairs(Items[i]) do
|
||||
-- dat:tackE(a.."|"..tostring(v))
|
||||
print(a.."|"..tostring(v))
|
||||
-- dat.workingfile:flush()
|
||||
end
|
||||
thread.skip()
|
||||
local NItems = Items[i]:getChildren()
|
||||
if NItems ~= nil then
|
||||
Seek(NItems)
|
||||
end
|
||||
end
|
||||
end
|
||||
local Objs = Object:getChildren()
|
||||
for i=1,#Objs do
|
||||
-- table.insert(Stuff,Objs[i])
|
||||
for a,v in pairs(Objs[i]) do
|
||||
-- dat:tackE(a.."|"..tostring(v))
|
||||
print(Objs[i].Type..":"..a.."|"..tostring(v))
|
||||
-- dat.workingfile:flush()
|
||||
end
|
||||
thread.skip()
|
||||
local Items = Objs[i]:getChildren()
|
||||
if Items ~= nil then
|
||||
Seek(Items)
|
||||
end
|
||||
end
|
||||
-- dat:tofile("test.dat")
|
||||
return Stuff
|
||||
end
|
||||
GetAllChildren2(self)
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user