scene/boost: reactivate the pause menu

This commit is contained in:
Kazhnuz 2019-02-10 20:00:37 +01:00
parent 723806510b
commit 648ede5874
2 changed files with 14 additions and 18 deletions

View file

@ -1,9 +1,10 @@
local PauseMenu = Object:extend() local PauseMenu = Object:extend()
local Menu = require "modules.menus"
local ResumeWidget = Menu.Widget.Base:extend() local Widget = require "core.modules.menusystem.widgets"
local RestartWidget = Menu.Widget.Base:extend()
local ExitWidget = Menu.Widget.Base:extend() local ResumeWidget = Widget.Base:extend()
local RestartWidget = Widget.Base:extend()
local ExitWidget = Widget.Base:extend()
function PauseMenu:new(controller) function PauseMenu:new(controller)
self.controller = controller self.controller = controller
@ -13,10 +14,9 @@ function PauseMenu:new(controller)
self.assets = self.controller.assets self.assets = self.controller.assets
self.menusystem = Menu.Controller() self.menu = self.controller.menusystem.TextMenu(424/2, self.height+8, self.assets.fonts["menu"], 6)
self.menu = Menu.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:centerText(180)
self.menu:setSound(self.assets.sfx["select"]) self.menu:setSound(self.assets.sfx["select"])
self.menu.focus = true self.menu.focus = true
@ -30,10 +30,6 @@ function PauseMenu:new(controller)
self.width = 0 self.width = 0
end end
function PauseMenu:update(dt)
self.menusystem:update(dt)
end
function PauseMenu:draw() function PauseMenu:draw()
if (self.activeCanvas == false) then if (self.activeCanvas == false) then
local width = self.menu:getWidth() or 10 local width = self.menu:getWidth() or 10
@ -41,7 +37,7 @@ function PauseMenu:draw()
end end
love.graphics.draw(self.canvas, (424 - self.width)/2, self.height - 28) love.graphics.draw(self.canvas, (424 - self.width)/2, self.height - 28)
self.menusystem:draw() self.controller.menusystem:draw()
end end
function PauseMenu:drawCanvas(width, height) function PauseMenu:drawCanvas(width, height)
@ -49,14 +45,14 @@ function PauseMenu:drawCanvas(width, height)
local height = height or 80 local height = height or 80
self.canvas = love.graphics.newCanvas(width + 64, height + 64) self.canvas = love.graphics.newCanvas(width + 64, height + 64)
CScreen:cease() core.screen:cease()
love.graphics.setCanvas( self.canvas ) love.graphics.setCanvas( self.canvas )
--self.controller.gui.textbox["solid"]:draw(32, 32, width, height) --self.controller.gui.textbox["solid"]:draw(32, 32, width, height)
self.controller.assets.fonts["title"]:draw("PAUSE", (width + 64)/2, 12, -1) self.controller.assets.fonts["title"]:draw("PAUSE", (width + 64)/2, 12, -1)
love.graphics.setCanvas( ) love.graphics.setCanvas( )
CScreen:cease() core.screen:cease()
self.activeCanvas = true self.activeCanvas = true

View file

@ -7,7 +7,7 @@ local HUD = require(folder .. "hud")
local Background = require(folder .. "background") local Background = require(folder .. "background")
local Camera = require(folder .. "camera") local Camera = require(folder .. "camera")
local World = require(folder .. "world") local World = require(folder .. "world")
--local PauseMenu = require(folder .. "pause") local PauseMenu = require(folder .. "pause")
local CharacterManager = require(folder .. "characters") local CharacterManager = require(folder .. "characters")
@ -56,7 +56,7 @@ function BoostLevel:initManagers()
self.camera = Camera(self, 0, 0) self.camera = Camera(self, 0, 0)
self.background = Background(self) self.background = Background(self)
self.characters = CharacterManager(self) self.characters = CharacterManager(self)
--self.pausemenu = PauseMenu(self) self.pausemenu = PauseMenu(self)
end end
function BoostLevel:initMission(levelid) function BoostLevel:initMission(levelid)
@ -107,7 +107,7 @@ function BoostLevel:update(dt)
self.world:update(dt) self.world:update(dt)
self.camera:update(dt) self.camera:update(dt)
else else
--self.pausemenu:update(dt) self.pausemenu:update(dt)
end end
if self.keys["start"].isPressed then if self.keys["start"].isPressed then
@ -126,7 +126,7 @@ function BoostLevel:draw()
self.hud:draw() self.hud:draw()
if self.pause == true then if self.pause == true then
--self.pausemenu:draw(dt) self.pausemenu:draw(dt)
end end
end end