summaryrefslogtreecommitdiff
path: root/ui.lua
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2026-06-03 22:31:42 +0200
committerLizzy Fleckenstein <lizzy@vlhl.dev>2026-06-03 23:30:17 +0200
commit341af788ffb60b1066f7735c10a2ef8480ec0aa9 (patch)
treeb1acbfe48184a263098e6146922730dd7ece8808 /ui.lua
parenta42c94e103ecf7cb365a8888c3f5afc785def284 (diff)
downloadr6p-main.tar.xz
add player selectionHEADmain
Diffstat (limited to 'ui.lua')
-rw-r--r--ui.lua21
1 files changed, 15 insertions, 6 deletions
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,
}