chore: add a screen package

This commit is contained in:
Kazhnuz 2021-12-08 11:26:27 +01:00
parent c4db0f7d14
commit 7ca60da3fd

View file

@ -7,9 +7,8 @@ local TweenManager = require "birb.classes.time"
local elementDataStruct = require "birb.structures.elementData"
function GuiScreen:new(name, controller)
function GuiScreen:new(name)
self:initWrapper()
self.controller = controller or self.gui
self.name = name
self.isVisible = false
self.transforms = {}
@ -17,13 +16,15 @@ function GuiScreen:new(name, controller)
self:reset()
self:registerElements()
self.controller:addScreen(name, self)
self.gui:addScreen(name, self)
end
function GuiScreen:initWrapper()
local scene = core.scenemanager.nextScene or core.scenemanager.currentScene
self.scene = scene
self.gui = scene.gui
-- Présent pour la compatibilité
self.controller = self.gui
self.assets = scene.assets
end