diff options
author | San Jacobs | 2025-09-25 22:53:48 +0200 |
---|---|---|
committer | San Jacobs | 2025-09-25 22:53:48 +0200 |
commit | 88020820193ef01e0ee7e6e15efe55901250c911 (patch) | |
tree | 045f5fd5554dfb16f3be4c65d15210c247e45ab0 /src/main.odin | |
parent | 0c09982fbbc554188ad4a048a136dced6981bacf (diff) | |
download | tafl-88020820193ef01e0ee7e6e15efe55901250c911.tar.gz tafl-88020820193ef01e0ee7e6e15efe55901250c911.tar.bz2 tafl-88020820193ef01e0ee7e6e15efe55901250c911.zip |
Buttons are being clicked
Diffstat (limited to 'src/main.odin')
-rw-r--r-- | src/main.odin | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/main.odin b/src/main.odin index f28fab4..a621812 100644 --- a/src/main.odin +++ b/src/main.odin @@ -1,5 +1,6 @@ package main +import "core:fmt" import t "tafl" main :: proc() { @@ -28,17 +29,21 @@ main :: proc() { sizing_height=t.GROW, sizing_width=t.FIT, layout=.TOP_TO_BOTTOM) - {t.tafl(color={0,0,0,0}, - sizing_height=t.GROW, - sizing_width=t.GROW)} - {t.tafl( - padding={8,8,8,8}, - child_gap=8, - color={.0, .0, .0, 0.4}, - ) - button("Yeet") - button("Test") - button("Render") + { + t.tafl(color={0,0,0,0}, + sizing_height=t.GROW, + sizing_width=t.GROW)} + { + t.tafl( + padding={8,8,8,8}, + child_gap=8, + color={.0, .0, .0, 0.4}, + ) + { + if button("Yeet", "yeet").clicked do fmt.println("YEEET!") + if button("Test", "test").clicked do fmt.println("Test!") + if button("Render", "render").clicked do fmt.println("Render!") + } } } @@ -108,17 +113,20 @@ main :: proc() { } -button :: proc(text : string) { - t.tafl(sizing_width=t.FIXED(120), +button :: proc(text : string, id : string) -> t.Com { + com := t.tafl(sizing_width=t.FIXED(120), sizing_height=t.FIXED(40), color=colors.button_outline, - padding={2,2,2,2}) + padding={2,2,2,2}, + flags=t.BUTTON, + id=id) t.tafl(sizing_width=t.GROW, sizing_height=t.GROW, color={.1,.1,.1, 1}, position_horizontal=.MIDDLE, position_vertical=.MIDDLE,) t.tafl(text=text) + return com } Color_Scheme :: struct { |