feat: add assets access to gui elements
This commit is contained in:
parent
6f6b4e6d74
commit
d972fccb13
1 changed files with 6 additions and 0 deletions
|
@ -13,6 +13,7 @@ function GuiElement:new(name, x, y, w, h)
|
|||
self.depth = 0
|
||||
|
||||
self.tweens = TweenManager(self)
|
||||
self.assets = self:getAssets()
|
||||
|
||||
self:register()
|
||||
end
|
||||
|
@ -22,6 +23,11 @@ function GuiElement:getGui()
|
|||
return scene.gui
|
||||
end
|
||||
|
||||
function GuiElement:getAssets()
|
||||
local scene = core.scenemanager.nextScene or core.scenemanager.currentScene
|
||||
return scene.assets
|
||||
end
|
||||
|
||||
function GuiElement:register()
|
||||
local gui = self:getGui()
|
||||
self.creationId = gui:addElement(self.name, self)
|
||||
|
|
Loading…
Reference in a new issue