From 04d27a5af9d919ef432eb5a264b0cd20acaf48e8 Mon Sep 17 00:00:00 2001 From: Nic Barker Date: Mon, 21 Oct 2024 20:59:36 +1300 Subject: [PATCH] odin updates --- bindings/odin/clay-odin/clay.odin | 1 + .../clay-official-website.odin | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bindings/odin/clay-odin/clay.odin b/bindings/odin/clay-odin/clay.odin index 9423502..7d114c3 100644 --- a/bindings/odin/clay-odin/clay.odin +++ b/bindings/odin/clay-odin/clay.odin @@ -275,6 +275,7 @@ foreign Clay { BeginLayout :: proc() --- EndLayout :: proc() -> ClayArray(RenderCommand) --- PointerOver :: proc(id: ElementId) -> bool --- + GetElementId :: proc(id: String) -> ElementId --- GetScrollContainerData :: proc(id: ElementId) -> ScrollContainerData --- SetMeasureTextFunction :: proc(measureTextFunction: proc "c" (text: ^String, config: ^TextElementConfig) -> Dimensions) --- RenderCommandArray_Get :: proc(array: ^ClayArray(RenderCommand), index: i32) -> ^RenderCommand --- diff --git a/bindings/odin/examples/clay-official-website/clay-official-website.odin b/bindings/odin/examples/clay-official-website/clay-official-website.odin index 9a81f40..657ca65 100644 --- a/bindings/odin/examples/clay-official-website/clay-official-website.odin +++ b/bindings/odin/examples/clay-official-website/clay-official-website.odin @@ -436,15 +436,13 @@ createLayout :: proc(lerpValue: f32) -> clay.ClayArray(clay.RenderCommand) { clay.Text("Docs", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}})) } } - // githubButtonId: clay.ElementId = clay.ID("HeaderButtonGithub") - if clay.UI(clay.ID("LinkGithubOuter"), clay.Layout({}), clay.BorderOutsideRadius({2, COLOR_RED}, 10)) { - if clay.UI( - // githubButtonId, - clay.Layout({padding = {16, 6}}), - clay.Rectangle({cornerRadius = clay.CornerRadiusAll(10), color = COLOR_LIGHT}), - ) { - clay.Text("Github", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}})) - } + if clay.UI( + clay.ID("LinkGithubOuter"), + clay.Layout({padding = {16, 6}}), + clay.BorderOutsideRadius({2, COLOR_RED}, 10), + clay.Rectangle({cornerRadius = clay.CornerRadiusAll(10), color = clay.PointerOver(clay.GetElementId(clay.MakeString("LinkGithubOuter"))) ? COLOR_LIGHT_HOVER : COLOR_LIGHT}) + ) { + clay.Text("Github", clay.TextConfig({fontId = FONT_ID_BODY_24, fontSize = 24, textColor = {61, 26, 5, 255}})) } } if clay.UI(clay.ID("TopBorder1"), clay.Layout({sizing = {clay.SizingGrow({}), clay.SizingFixed(4)}}), clay.Rectangle({color = COLOR_TOP_BORDER_5})) {}