Refonte pour utiliser le systeme de GUI #112

Merged
kazhnuz merged 102 commits from feat/gui into master 2022-01-06 19:15:16 +01:00
2 changed files with 13 additions and 1 deletions
Showing only changes of commit c658f68e14 - Show all commits

View file

@ -20,7 +20,7 @@ end
function GuiElement:register()
local gui = self:getGui()
gui:addElement(self.name, self)
self.creationId = gui:addElement(self.name, self)
end
function GuiElement:destroy()

View file

@ -3,10 +3,13 @@ local ElementList = Object:extend()
function ElementList:initElements()
self.elements = {}
self.focusedElem = nil
self.nbrElement = 0
end
function ElementList:addElement(name, element)
self.nbrElement = self.nbrElement + 1
self.elements[name] = element
return self.nbrElement
end
function ElementList:deleteElement(name)
@ -22,6 +25,15 @@ function ElementList:getVisibleElement(topLayer)
end
end
end
table.sort(visibleList, function (a, b)
if (a.depth == b.depth) then
return (a.creationId < b.creationId)
else
return (a.depth > b.depth)
end
end)
return visibleList
end