sonic-radiance/sonic-radiance.love/birb/modules/gui/mixins/elements.lua
2021-08-21 12:45:49 +02:00

28 lines
No EOL
663 B
Lua

local ElementList = Object:extend()
function ElementList:initElements()
self.elements = {}
self.focusedElem = nil
end
function ElementList:addElement(name, element)
self.elements[name] = element
end
function ElementList:deleteElement(name)
self.elements[name] = nil
end
function ElementList:getVisibleElement(topLayer)
local visibleList = {}
for _, element in ipairs(self.elements) do
if (element ~= nil) then
if (element:getVisibility() and ((element.depth) < 0 == topLayer)) then
table.insert(visibleList, element)
end
end
end
return visibleList
end
return ElementList