diff --git a/sonic-radiance.love/core/modules/menusystem/init.lua b/sonic-radiance.love/core/modules/menusystem/init.lua index 780796d..02e7587 100644 --- a/sonic-radiance.love/core/modules/menusystem/init.lua +++ b/sonic-radiance.love/core/modules/menusystem/init.lua @@ -201,7 +201,11 @@ function MenuSystem:update(dt) v:update(dt) v:updateWidgets(dt) end + end +end +function MenuSystem:keycheck() + if (self.isActive) then if self.menus[self.focusedMenu] ~= nil then -- Only check buttons if the current focused menu is actually active if self.menus[self.focusedMenu].isActive then @@ -213,6 +217,7 @@ function MenuSystem:update(dt) end end end + end -- MOUSE FUNCTIONS diff --git a/sonic-radiance.love/core/modules/scenes.lua b/sonic-radiance.love/core/modules/scenes.lua index 848ab4d..fc7c1f4 100644 --- a/sonic-radiance.love/core/modules/scenes.lua +++ b/sonic-radiance.love/core/modules/scenes.lua @@ -89,6 +89,15 @@ function Scene:updateDialog(dt) end end +function Scene:updateMenus(dt) + if (self.menusystem ~= nil) then + self.menusystem:update(dt) + if (core.screen:isActive()) then + self.menusystem:keycheck() + end + end +end + -- MOUSE FUNCTIONS -- Make the scene support the pointer @@ -153,6 +162,12 @@ function Scene:drawDialog(dt) end end +function Scene:drawMenus() + if (self.menusystem ~= nil) then + self.menusystem:draw() + end +end + -- INPUT FUNCTIONS -- Handle inputs from keyboard/controllers diff --git a/sonic-radiance.love/core/scenemanager.lua b/sonic-radiance.love/core/scenemanager.lua index 70ddb0c..c73b75d 100644 --- a/sonic-radiance.love/core/scenemanager.lua +++ b/sonic-radiance.love/core/scenemanager.lua @@ -81,7 +81,7 @@ function SceneManager:update(dt) self.currentScene:updateStart(dt) self.currentScene:setKeys() self.currentScene.assets:update(dt) - self.currentScene.menusystem:update(dt) + self.currentScene:updateMenus(dt) self.currentScene:updateWorld(dt) self.currentScene:update(dt) self.currentScene:updateEnd(dt) @@ -131,7 +131,7 @@ function SceneManager:draw() self.currentScene:drawStart() self.currentScene:drawWorld() self.currentScene:draw() - self.currentScene.menusystem:draw() + self.currentScene:drawMenus() self.currentScene:drawEnd() self.controller.screen:drawTransition() self.currentScene:drawOverTransition()