diff --git a/examples/scenes/gameplay/plateform/pause.lua b/examples/scenes/gameplay/plateform/pause.lua index cac6f66..ba5ea49 100644 --- a/examples/scenes/gameplay/plateform/pause.lua +++ b/examples/scenes/gameplay/plateform/pause.lua @@ -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()