vision/src/client/ui/options.lua

84 lines
2.2 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 config = assert( require 'client.config' )
local font = assert( require 'client.ui.fonts' ).midFont
local function editSelectedOption( button )
end
local optionsMenu = menu.new{
name = "options",
buttons = {
button{
x = 0.5 * lg.getWidth(), w = 0.45 * lg.getWidth(), h = lg.getHeight(), y = 55,
text = lg.newText( font, "" ),
color = { 0.4, 0.1, 0.1, 0.1 }
},
button{
x = 15, y = 115, w = 800, h = 30, space = 8,
text = lg.newText( font, strings.mainmenu_button ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = function() return scene.mainmenu() end },
button{
option = 'name',
text = lg.newText( font, strings.option_name ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = editSelectedOption },
button{
option = 'pronoun',
text = lg.newText( font, strings.option_pron ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = editSelectedOption },
button{
option = 'colour',
text = lg.newText( font, strings.option_tint ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = editSelectedOption },
button{
option = 'keybinds',
text = lg.newText( font, strings.option_keybinds ),
color = { 0.6, 0.6, 0.6, 0.8 },
callback = editSelectedOption,
}
},
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 },
}
}
do
local op = optionsMenu.paint
function optionsMenu:paint()
local selected = self.getSelectedButton()
local optionName = selected and selected.option
if optionName then self.buttons[1].text:set( optionName ) end
return op( self )
end
end
return optionsMenu