From 341af788ffb60b1066f7735c10a2ef8480ec0aa9 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Wed, 3 Jun 2026 22:31:42 +0200 Subject: add player selection --- ui.lua | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'ui.lua') diff --git a/ui.lua b/ui.lua index 8ad64e6..60f0833 100644 --- a/ui.lua +++ b/ui.lua @@ -320,19 +320,27 @@ local function ui_text(str, size, col) } end -local function ui_button(label, click) +local function ui_button_elem(elem, click) return { + fill_normal = color(0x808080), + fill_hover = color(0x8080a0), + line_hover = color(0x505050), + line_normal = color(0x505050), fill = function(self, f) - return f.hover and color(0x8080a0) or color(0x808080) + return f.hover and self.fill_hover or self.fill_normal + end, + line = function(self, f) + return f.hover and self.line_hover or self.line_normal end, - line = color(0x505050), events = { hover = true, press = true, click = click, }, - ui_pad_y(5, center_x(ui_pad_x(10, - ui_text(label, 25, color(0x000000)) - ))) + ui_pad_y(5, ui_pad_x(10, elem)) } end +local function ui_button(label, click) + return ui_button_elem(center_x(ui_text(label, 25, color(0x000000))), click) +end + local function ui_input(placeholder) local function is_placeholder(self, focus) return self.input_value == "" and not focus @@ -413,5 +421,6 @@ return { flex = ui_flex, text = ui_text, button = ui_button, + button_elem = ui_button_elem, input = ui_input, } -- cgit v1.2.3