summaryrefslogtreecommitdiff
path: root/ui.lua
diff options
context:
space:
mode:
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,
}