Working on the new version

This commit is contained in:
Ryan Ward 2022-02-09 22:18:36 -05:00
parent ba0ae5059f
commit 50c8ff250f

View File

@ -1,20 +1,57 @@
local multi,thread = require("multi"):init()
local GLOBAL, THREAD = require("multi.integration.loveManager"):init()
local gui = {}
gui.updater = multi:newProcessor("UpdateManager",true)
gui.drawer = multi:newProcessor("DrawManager",true)
local updater = multi:newProcessor("UpdateManager",true)
local drawer = multi:newProcessor("DrawManager",true)
local bit = require("bit")
local band, bor = bit.band, bit.bor
gui.__index = gui
gui.MOUSE_PRIMARY = 1
gui.MOUSE_SECONDARY = 2
gui.MOUSE_MIDDLE = 3
local frame, label ,button, image, text, box = 0, 1, 2, 4, 8, 16
local children = {}
function gui:getChildren()
return self.Children
end
function gui:getAllChildren()
for i=0, #children do children[i]=nil end
function Seek(Items)
for i=1,#Items do
if Items[i].Visible==true then
table.insert(Stuff,Items[i])
local NItems = Items[i]:getChildren()
if NItems ~= nil then
Seek(NItems)
end
end
end
end
local Objs = self:getChildren()
for i=1,#Objs do
if Objs[i].Visible==true then
table.insert(Stuff,Objs[i])
local Items = Objs[i]:getChildren()
if Items ~= nil then
Seek(Items)
end
end
end
return Stuff
end
-- Base Library
function gui:newBase(typ,dualDim)
function gui:newBase(typ,x, y, w, h, sx, sy, sw, sh)
local c = {}
c.parent = self
c.dualDim = dualDim
c.Type = typ
c.dualDim = self:newDualDim(x, y, w, h, sx, sy, sw, sh)
c.Children = {}
c.Visible = true
c.Visibility = 1
setmetatable(c, gui)
end
function gui:newDualDim(x,y,w,h,sx,sy,sw,sh)
function gui:newDualDim(x, y, w, h, sx, sy, sw, sh)
local dd = {}
dd.offset={}
dd.scale={}
@ -38,37 +75,46 @@ function gui:newDualDim(x,y,w,h,sx,sy,sw,sh)
end
-- Objects
-- Frames
function gui:newFrame()
--
function gui:newFrame(x, y, w, h, sx, sy, sw, sh)
local c = self:newBase(frame, x, y, w, h, sx, sy, sw, sh)
end
-- Texts
function gui:newTextBase(x,y,w,h,sx,sy,sw,sh)
--
function gui:newTextBase(typ, txt, x, y, w, h, sx, sy, sw, sh)
local c = self:newBase(text + typ,x, y, w, h, sx, sy, sw, sh)
c.text = txt
end
function gui:newTextLabel()
--
function gui:newTextButton(txt, x, y, w, h, sx, sy, sw, sh)
local c = self:newTextBase(button, txt, x, y, w, h, sx, sy, sw, sh)
end
function gui:newTextButton()
--
function gui:newTextLabel(txt, x, y, w, h, sx, sy, sw, sh)
local c = self:newTextBase(label, txt, x, y, w, h, sx, sy, sw, sh)
end
function gui:newTextLabel()
--
end
function gui:newTextBox()
--
function gui:newTextBox(txt, x, y, w, h, sx, sy, sw, sh)
local c = self:newTextBase(box, txt, x, y, w, h, sx, sy, sw, sh)
end
-- Images
function gui:newImageBase(typ,x, y, w, h, sx, sy, sw, sh)
local c = self:newBase(image + typ,x, y, w, h, sx, sy, sw, sh)
end
function gui:newImageLabel(x, y, w, h, sx, sy, sw, sh)
local c = self:newImageBase(label, x, y, w, h, sx, sy, sw, sh)
end
function gui:newImageButton(x, y, w, h, sx, sy, sw, sh)
local c = self:newImageBase(button, x, y, w, h, sx, sy, sw, sh)
end
-- Draw Function
drawer:newLoop(function()
end)
-- Drawing and Updating
gui.draw = drawer.run
gui.update = updater.run
-- Drawing
function gui:draw()
gui.drawer.run()
end
-- Updating
function gui:update()
gui.updater.run()
end
-- Root gui
gui.Type = "root"
gui.Children = {}
gui.dualDim = gui:newDualDim()
gui.updater:newLoop(function() gui.dualDim.offset.width,gui.dualDim.offset.height = love.graphics.getDimensions() end)
updater:newLoop(function() gui.dualDim.offset.width, gui.dualDim.offset.height = love.graphics.getDimensions() end)
return gui