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 26 additions and 8 deletions
Showing only changes of commit da9dbb30b8 - Show all commits

View file

@ -6,6 +6,9 @@ GuiScreen:implement(ElementList)
local TweenManager = require "birb.classes.time" local TweenManager = require "birb.classes.time"
local elementDataStruct = require "birb.structures.elementData"
function GuiScreen:new(name, controller) function GuiScreen:new(name, controller)
self.controller = controller or self:getGui() self.controller = controller or self:getGui()
self.name = name self.name = name
@ -69,16 +72,30 @@ end
function GuiScreen:registerElements() function GuiScreen:registerElements()
local elementList = self:createElements() local elementList = self:createElements()
for _, element in ipairs(elementList) do for _, rawElement in ipairs(elementList) do
if (element.is ~= nil) then if (rawElement.is ~= nil) then
self:addElement(element.name, element) self:addElement(rawElement.name, rawElement)
element.screen = self rawElement.screen = self
else else
self:addElement(element[1].name, element[1]) local elemData = utils.table.parse(rawElement, elementDataStruct, 3)
if (element[2] == false) then local element = elemData.element
element[1].isVisible = false self:addElement(element.name, element)
if (elemData.delay > 0) then
element.isVisible = false
element:newSwitch(elemData.delay, {"isVisible"})
print(elemData.delay)
end end
element[1].screen = self if (elemData.depth ~= nil) then
element.depth = elemData.depth
end
print(element, element.name, elemData.depth, elemData.focus)
if (elemData.focus == true) then
element:getFocus()
end
if (elemData.keypress ~= nil) then
element:setKeyPressAction(elemData.keypress)
end
element.screen = self
end end
end end
end end

View file

@ -0,0 +1 @@
return {"element", "delay", "depth", "focus", "keypress"}