From 648ede5874a15be10d5e6daedb846dd6c37fd768 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 10 Feb 2019 20:00:37 +0100 Subject: [PATCH] scene/boost: reactivate the pause menu --- .../subgame/sonic-boost/controller/pause.lua | 24 ++++++++----------- .../scenes/subgame/sonic-boost/init.lua | 8 +++---- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/sonic-boost.love/scenes/subgame/sonic-boost/controller/pause.lua b/sonic-boost.love/scenes/subgame/sonic-boost/controller/pause.lua index 42b31ff..7f248ff 100644 --- a/sonic-boost.love/scenes/subgame/sonic-boost/controller/pause.lua +++ b/sonic-boost.love/scenes/subgame/sonic-boost/controller/pause.lua @@ -1,9 +1,10 @@ local PauseMenu = Object:extend() -local Menu = require "modules.menus" -local ResumeWidget = Menu.Widget.Base:extend() -local RestartWidget = Menu.Widget.Base:extend() -local ExitWidget = Menu.Widget.Base:extend() +local Widget = require "core.modules.menusystem.widgets" + +local ResumeWidget = Widget.Base:extend() +local RestartWidget = Widget.Base:extend() +local ExitWidget = Widget.Base:extend() function PauseMenu:new(controller) self.controller = controller @@ -13,10 +14,9 @@ function PauseMenu:new(controller) self.assets = self.controller.assets - self.menusystem = Menu.Controller() - self.menu = Menu.TextMenu(424/2, self.height+8, self.assets.fonts["menu"], 6) + self.menu = self.controller.menusystem.TextMenu(424/2, self.height+8, self.assets.fonts["menu"], 6) - self.menusystem:addMenu(self.menu) + self.controller.menusystem:addMenu(self.menu) self.menu:centerText(180) self.menu:setSound(self.assets.sfx["select"]) self.menu.focus = true @@ -30,10 +30,6 @@ function PauseMenu:new(controller) self.width = 0 end -function PauseMenu:update(dt) - self.menusystem:update(dt) -end - function PauseMenu:draw() if (self.activeCanvas == false) then local width = self.menu:getWidth() or 10 @@ -41,7 +37,7 @@ function PauseMenu:draw() end love.graphics.draw(self.canvas, (424 - self.width)/2, self.height - 28) - self.menusystem:draw() + self.controller.menusystem:draw() end function PauseMenu:drawCanvas(width, height) @@ -49,14 +45,14 @@ function PauseMenu:drawCanvas(width, height) local height = height or 80 self.canvas = love.graphics.newCanvas(width + 64, height + 64) - CScreen:cease() + core.screen:cease() love.graphics.setCanvas( self.canvas ) --self.controller.gui.textbox["solid"]:draw(32, 32, width, height) self.controller.assets.fonts["title"]:draw("PAUSE", (width + 64)/2, 12, -1) love.graphics.setCanvas( ) - CScreen:cease() + core.screen:cease() self.activeCanvas = true diff --git a/sonic-boost.love/scenes/subgame/sonic-boost/init.lua b/sonic-boost.love/scenes/subgame/sonic-boost/init.lua index ffeb20f..684a01f 100644 --- a/sonic-boost.love/scenes/subgame/sonic-boost/init.lua +++ b/sonic-boost.love/scenes/subgame/sonic-boost/init.lua @@ -7,7 +7,7 @@ local HUD = require(folder .. "hud") local Background = require(folder .. "background") local Camera = require(folder .. "camera") local World = require(folder .. "world") ---local PauseMenu = require(folder .. "pause") +local PauseMenu = require(folder .. "pause") local CharacterManager = require(folder .. "characters") @@ -56,7 +56,7 @@ function BoostLevel:initManagers() self.camera = Camera(self, 0, 0) self.background = Background(self) self.characters = CharacterManager(self) - --self.pausemenu = PauseMenu(self) + self.pausemenu = PauseMenu(self) end function BoostLevel:initMission(levelid) @@ -107,7 +107,7 @@ function BoostLevel:update(dt) self.world:update(dt) self.camera:update(dt) else - --self.pausemenu:update(dt) + self.pausemenu:update(dt) end if self.keys["start"].isPressed then @@ -126,7 +126,7 @@ function BoostLevel:draw() self.hud:draw() if self.pause == true then - --self.pausemenu:draw(dt) + self.pausemenu:draw(dt) end end