vision/src/client/ui/mainmenu.lua

54 lines
1.6 KiB
Lua

local lg = assert( love.graphics )
local love = assert( love )
local scene = assert( require 'client.scene' )
local strings = strings or assert( require 'client.assets.strings.english' )
local button = assert( require 'client.ui.button' )
local menu = assert( require 'client.ui.menu' )
local font = assert( require 'client.ui.fonts').headerFont
return menu.new{
name = "mainmenu",
buttons = {
button{
x = 15, w = lg.getWidth(), y = 115, h = 72, space = 15,
text = lg.newText( font, strings.newgame_button ),
color = { 0.6, 0.6, 0.6, 0.9 },
callback = function() return scene.connecting{ip = "127.0.0.0", port = 8} end },
button{
text = lg.newText( font, strings.join_button ),
color = { 0.6, 0.6, 0.6, 0.9 },
callback = function() return scene.browser() end },
button{
text = lg.newText( font, strings.option_button ),
color = { 0.6, 0.6, 0.6, 0.9 },
callback = function() return scene.options() end },
button{
text = lg.newText( font, strings.quit_button ),
color = { 0.6, 0.6, 0.6, 0.9 },
callback = love.event.quit },
},
fg = lg.newMesh{
{ 0, 0, 0, 0, 0.4, 0.1, 0.05, 0.0 },
{ 1, 0, 1, 0, 0.8, 0.3, 0.1, 0.8 },
{ 1, 1, 1, 1, 0.7, 0.4, 0.1, 0.8 },
{ 0, 1, 0, 1, 0.4, 0.1, 0.03, 0.0 },
},
bg = lg.newMesh{
{ 0, 0, 0, 0, 1, 1, 1, 0.01 },
{ 1, 0, 1, 0, 1, 1, 1, 0.1 },
{ 1, 1, 1, 1, 0, 0, 0, 0.1 },
{ 0, 1, 0, 1, 0, 0, 0, 0.01 },
},
font = font,
wheelmoved = function( x, y ) return ( y ~= 0 ) and love.keypressed( nil, (y > 0) and "up" or "down" ) end
}