2021-09-16 21:00:39 +02:00
|
|
|
local Parent = require "game.modules.gui.fancymenu"
|
|
|
|
local MainMenu = Parent:extend()
|
2020-08-19 20:44:38 +02:00
|
|
|
|
2021-05-05 08:30:32 +02:00
|
|
|
local defTransitions = require "birb.modules.transitions"
|
2021-04-05 12:29:45 +02:00
|
|
|
local radTransitions = require "game.modules.transitions"
|
|
|
|
|
2021-09-16 21:00:39 +02:00
|
|
|
local MENU_X, MENU_Y = 24, 48
|
|
|
|
local MENU_W = 424/3
|
|
|
|
local MENU_ITEM_NUMBER = 8
|
2021-04-05 14:20:25 +02:00
|
|
|
|
2021-09-16 21:00:39 +02:00
|
|
|
function MainMenu:new()
|
|
|
|
MainMenu.super.new(self, "mainmenu", MENU_X, MENU_Y, MENU_W, MENU_ITEM_NUMBER, false)
|
|
|
|
self:addItem("Launch game", "left", function() self:launchGame() end)
|
|
|
|
self:addItem("Options", "left", function() self:launchOptions() end)
|
|
|
|
self:addItem("Return to title", "left", function() self:returnToTitle() end, "back")
|
|
|
|
self:setCancelWidget()
|
|
|
|
self:addItem("Exit game", "left", function() self:exitGame() end)
|
|
|
|
self:getFocus()
|
2020-08-02 23:47:42 +02:00
|
|
|
end
|
|
|
|
|
2021-09-16 21:00:39 +02:00
|
|
|
function MainMenu:launchGame()
|
|
|
|
core.screen:startTransition(defTransitions.circle, defTransitions.default, function() scenes.overworld() end, 424/2, 240/2)
|
|
|
|
core.scenemanager.currentScene:hideOverlay()
|
2020-08-02 23:47:42 +02:00
|
|
|
end
|
|
|
|
|
2021-09-16 21:00:39 +02:00
|
|
|
function MainMenu:launchOptions()
|
|
|
|
core.screen:startTransition(defTransitions.default, defTransitions.default, function() scenes.menus.options() end, 424/2, 240/2)
|
2020-08-02 23:47:42 +02:00
|
|
|
end
|
|
|
|
|
2021-09-16 21:00:39 +02:00
|
|
|
function MainMenu:returnToTitle()
|
|
|
|
core.screen:startTransition(defTransitions.circle, radTransitions.borders, function() scenes.menus.title(true) end, 424/2, 240/2)
|
2020-08-02 23:47:42 +02:00
|
|
|
end
|
|
|
|
|
2021-09-16 21:00:39 +02:00
|
|
|
function MainMenu:exitGame()
|
|
|
|
love.event.quit("000")
|
2020-08-02 23:47:42 +02:00
|
|
|
end
|
|
|
|
|
2021-09-16 21:00:39 +02:00
|
|
|
return MainMenu
|