more modular menu

This commit is contained in:
Alexey 2025-10-23 14:47:00 +03:00
commit 7df0478890
6 changed files with 178 additions and 117 deletions

40
menu/start.lua Normal file
View file

@ -0,0 +1,40 @@
require 'menu.state'
require 'button'
require 'text'
local common = require 'menu.common'
local startButton = Button:new(
common.buttonTopPos,
common.buttonSize,
'Start',
nil,
nil,
function()
Menu.current_state = MenuStateIndex.hidden
GameGrid = LevelHandler:first()
Menu.updateCellSize()
end
)
local exitGameButton = Button:new(
common.buttonBotPos,
common.buttonSize,
'Exit',
nil,
nil,
function()
love.event.quit()
end
)
local title = Text:new(
common.titlePos,
common.buttonSize,
'Lines'
)
return MenuState:new(
{ startButton, exitGameButton },
{ title }
)