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

42 lines
No EOL
1 KiB
Lua

local GuiScreen = Object:extend()
local ElementList = require "birb.modules.gui.mixins.elements"
local ScreenList = require "birb.modules.gui.mixins.screens"
GuiScreen:implement(ScreenList)
GuiScreen:implement(ElementList)
function GuiScreen:new(controller, name)
self.controller = controller
self.name = name
self.isVisible = false
self:reset()
end
function GuiScreen:getGui()
local scene = core.scenemanager.currentScene
return scene.gui
end
function GuiScreen:reset()
self:initElements()
self:initScreens()
end
function GuiScreen:registerElements()
local elementList = self:createElements()
for _, element in ipairs(elementList) do
if (element.is ~= nil) then
self:addElement(element.name, element)
else
self:addElement(element[1].name, element[1])
if (element[2] == false) then
element[1].isVisible = false
end
end
end
end
function GuiScreen:createElements()
-- Empty function
end
return GuiScreen