fix: port to the new menusystem the pause menu

This commit is contained in:
Kazhnuz 2021-01-30 09:19:22 +01:00
parent 150aad86f1
commit e8b796f978

View file

@ -7,26 +7,27 @@ local ResumeWidget = Widget.Text:extend()
local RestartWidget = Widget.Text:extend()
local ExitWidget = Widget.Text:extend()
local MENU_NAME = "PauseMenu"
function PauseMenu:new(scene)
self.scene = scene
local screenHeight, screenWidth = core.screen:getDimensions()
local w, h = 424/4, 240 - 48*4
local x, y = 3*w/2, 24*4
PauseMenu.super.new(self, scene.menusystem, "PauseMenu", x, y, w, h, 3)
PauseMenu.super.new(self, scene.menusystem, MENU_NAME, x, y, w, h, 3)
ResumeWidget(self)
RestartWidget(self)
ExitWidget(self)
ResumeWidget()
RestartWidget()
ExitWidget()
end
-- WIDGETS
-- All widgets used by the pause menu
function ResumeWidget:new(menu)
self.scene = menu.scene
local font = self.scene.assets:getFont("medium")
function ResumeWidget:new()
self.scene = core.scenemanager.currentScene
local label = "resume"
ResumeWidget.super.new(self, menu, font, label)
ResumeWidget.super.new(self, MENU_NAME, "medium", label)
end
function ResumeWidget:action()
@ -34,11 +35,10 @@ function ResumeWidget:action()
self.scene.menusystem:deactivate()
end
function RestartWidget:new(menu)
self.scene = menu.scene
local font = self.scene.assets:getFont("medium")
function RestartWidget:new()
self.scene = core.scenemanager.currentScene
local label = "restart"
RestartWidget.super.new(self, menu, font, label)
RestartWidget.super.new(self, MENU_NAME, "medium", label)
end
function RestartWidget:action()
@ -46,11 +46,10 @@ function RestartWidget:action()
self.scene:restart()
end
function ExitWidget:new(menu)
self.scene = menu.scene
local font = self.scene.assets:getFont("medium")
function ExitWidget:new()
self.scene = core.scenemanager.currentScene
local label = "exit"
ExitWidget.super.new(self, menu, font, label)
ExitWidget.super.new(self, MENU_NAME, "medium", label)
end
function ExitWidget:action()