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 11 additions and 6 deletions
Showing only changes of commit 839813768d - Show all commits

View file

@ -46,7 +46,7 @@ function ElementList:elementExists(name)
end end
function ElementList:haveFocus() function ElementList:haveFocus()
return self:elementExists(self.focusedElement) return self:elementIsVisible(self.focusedElement)
end end
function ElementList:getFocusedElement() function ElementList:getFocusedElement()
@ -81,4 +81,11 @@ function ElementList:getVisibleElement(topLayer)
return visibleList return visibleList
end end
function ElementList:elementIsVisible(name)
if (self:elementExists(name)) then
return self.elements[name]:getVisibility()
end
return false
end
return ElementList return ElementList

View file

@ -80,18 +80,16 @@ function GuiScreen:registerElements()
local elemData = utils.table.parse(rawElement, elementDataStruct, 3) local elemData = utils.table.parse(rawElement, elementDataStruct, 3)
local element = elemData.element local element = elemData.element
self:addElement(element.name, element) self:addElement(element.name, element)
if (elemData.focus == true) then
element:getFocus()
end
if (elemData.delay > 0) then if (elemData.delay > 0) then
element.isVisible = false element.isVisible = false
element:newSwitch(elemData.delay, {"isVisible"}) element:newSwitch(elemData.delay, {"isVisible"})
print(elemData.delay)
end end
if (elemData.depth ~= nil) then if (elemData.depth ~= nil) then
element.depth = elemData.depth element.depth = elemData.depth
end end
print(element, element.name, elemData.depth, elemData.focus)
if (elemData.focus == true) then
element:getFocus()
end
if (elemData.keypress ~= nil) then if (elemData.keypress ~= nil) then
element:setKeyPressAction(elemData.keypress) element:setKeyPressAction(elemData.keypress)
end end