Changed how hooks work, fixed parent on root gui object

This commit is contained in:
Ryan Ward 2023-10-17 23:30:39 -04:00
parent 2bb4b8e25d
commit ae5bea943d

View File

@ -82,8 +82,6 @@ local function Hook(funcname, func)
end
end
-- This will run the hooks after everything has loaded
updater:newLoop(function(loop)
Hook("quit", gui.Events.OnQuit.Fire)
Hook("directorydropped", gui.Events.OnDirectoryDropped.Fire)
Hook("displayrotated", gui.Events.OnDisplayRotated.Fire)
@ -103,8 +101,6 @@ updater:newLoop(function(loop)
Hook("touchmoved", gui.Events.OnTouchMoved.Fire)
Hook("touchpressed", gui.Events.OnTouchPressed.Fire)
Hook("touchreleased", gui.Events.OnTouchReleased.Fire)
loop:Destroy()
end)
-- Hotkeys
@ -264,8 +260,7 @@ function gui:getAllChildren(vis)
end
function gui:newThread(func)
return updater:newThread("ThreadHandler<" .. self.type .. ">", func, self,
thread)
return updater:newThread("ThreadHandler<" .. self.type .. ">", func, self, thread)
end
function gui:setDualDim(x, y, w, h, sx, sy, sw, sh)
@ -472,11 +467,12 @@ function gui:newBase(typ, x, y, w, h, sx, sy, sw, sh, virtual)
end
local function defaultCheck(...)
if not c:isActive() then return end
if not c:isActive() then return false end
local x, y = love.mouse.getPosition()
if c:canPress(x, y) then
return c, ...
end
return false
end
setmetatable(c, gui)
@ -1388,6 +1384,7 @@ gui.virtual.w = w
gui.virtual.h = h
-- Root gui
gui.parent = gui
gui.type = frame
gui.children = {}
gui.dualDim = gui:newDualDim()