39 lines
850 B
Lua
39 lines
850 B
Lua
local MainMenu = {}
|
|
local UI = require("ui")
|
|
local rgb = require("helpers.rgb")
|
|
local darken = require("helpers.darken")
|
|
local lighten = require("helpers.lighten")
|
|
|
|
function MainMenu:init()
|
|
self.ui = UI.new{
|
|
font = love.graphics.newFont(48),
|
|
text_color = rgb(255, 255, 255),
|
|
bg_color = rgb(60, 60, 60),
|
|
bg_hover_color = {lighten(rgb(60, 60, 60))},
|
|
bg_pressed_color = {darken(rgb(60, 60, 60))},
|
|
}
|
|
|
|
self.ip_textbox = { text = "127.0.0.1" }
|
|
end
|
|
|
|
function MainMenu:update()
|
|
end
|
|
|
|
function MainMenu:keypressed(...)
|
|
self.ui:keypressed(...)
|
|
end
|
|
|
|
function MainMenu:textinput(...)
|
|
self.ui:textinput(...)
|
|
end
|
|
|
|
function MainMenu:draw()
|
|
local w, h = love.graphics.getDimensions()
|
|
self.ui:textbox(self.ip_textbox, w/2-350, h/2-30, 400, 60)
|
|
if self.ui:button("Connect", w/2+100, h/2-30, 250, 60) then
|
|
end
|
|
self.ui:postDraw()
|
|
end
|
|
|
|
return MainMenu
|