diff --git a/birb/core/scenemanager.lua b/birb/core/scenemanager.lua index 6344b02..eafdb92 100644 --- a/birb/core/scenemanager.lua +++ b/birb/core/scenemanager.lua @@ -41,6 +41,10 @@ function SceneManager:setScene(scene) self.nextScene = scene end +function SceneManager:getScene() + return self.nextScene or self.currentScene +end + function SceneManager:haveStoredScene(name) return (self.storage[name] ~= nil) end diff --git a/birb/modules/gui/elements/parent.lua b/birb/modules/gui/elements/parent.lua index cb369a6..a82244c 100644 --- a/birb/modules/gui/elements/parent.lua +++ b/birb/modules/gui/elements/parent.lua @@ -19,7 +19,7 @@ function GuiElement:new(name, x, y, w, h) end function GuiElement:initWrapper() - self.scene = core.scenemanager.nextScene or core.scenemanager.currentScene + self.scene = core.scenemanager:getScene() self.gui = self.scene.gui self.assets = self.scene.assets end diff --git a/birb/modules/gui/menus/widgets/base.lua b/birb/modules/gui/menus/widgets/base.lua index ca106f6..b373d52 100644 --- a/birb/modules/gui/menus/widgets/base.lua +++ b/birb/modules/gui/menus/widgets/base.lua @@ -45,7 +45,7 @@ function BaseWidget:new(menuName) end function BaseWidget:initWrapper() - self.scene = core.scenemanager.nextScene or core.scenemanager.currentScene + self.scene = core.scenemanager:getScene() self.gui = self.scene.gui self.assets = self.scene.assets end @@ -60,11 +60,11 @@ function BaseWidget:getMenuByName(name) end function BaseWidget:getScene() - return core.scenemanager.nextScene or core.scenemanager.currentScene + return core.scenemanager:getScene() end function BaseWidget:getAssets() - local scene = core.scenemanager.nextScene or core.scenemanager.currentScene + local scene = core.scenemanager:getScene() return scene.assets end diff --git a/birb/modules/gui/screen.lua b/birb/modules/gui/screen.lua index 4a6eb49..52b130c 100644 --- a/birb/modules/gui/screen.lua +++ b/birb/modules/gui/screen.lua @@ -23,7 +23,7 @@ function GuiScreen:new(name, controller) end function GuiScreen:initWrapper() - local scene = core.scenemanager.nextScene or core.scenemanager.currentScene + local scene = core.scenemanager:getScene() self.scene = scene self.gui = scene.gui self.assets = scene.assets diff --git a/birb/modules/gui/textmenu/init.lua b/birb/modules/gui/textmenu/init.lua index 6370ea0..cbd5a68 100644 --- a/birb/modules/gui/textmenu/init.lua +++ b/birb/modules/gui/textmenu/init.lua @@ -63,7 +63,7 @@ function TextMenu:generateSubmenu(pageName, label, parent, list, func, backWidge end function TextMenu:setFont(fontName) - local scene = core.scenemanager.currentScene + local scene = core.scenemanager:getScene() self.font = scene.assets:getFont(fontName) end