From 0256cea0b389506bc97d1c026d566706e1cc8e76 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Fri, 13 Oct 2023 18:29:41 +0200 Subject: Fixed font loading in labels --- src/ui_implementation.odin | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui_implementation.odin b/src/ui_implementation.odin index 7c5f9e3..594e5a1 100644 --- a/src/ui_implementation.odin +++ b/src/ui_implementation.odin @@ -88,7 +88,7 @@ button :: proc(text: string, width: int, selected := false) -> Item { Text_Alignment :: enum int { Left, Right, - Center + Center, } label :: proc(text: string, font: rl.Font, alignment: Text_Alignment = .Left) -> Item { item := oui.item_make() @@ -97,6 +97,7 @@ label :: proc(text: string, font: rl.Font, alignment: Text_Alignment = .Left) -> data.subtype = .Label data.text = text data.font_size = font.baseSize // This should not be necesssary + data.font = font data.alignment = alignment return item @@ -135,7 +136,7 @@ ui_draw :: proc(item: oui.Item) { // For some reason, data.font.baseSize == 0 here. It doesn't outside of this function. Dunno why. font_height := f32(data.font_size) - + rl.DrawTextEx(data.font, strings.unsafe_string_to_cstring(data.text), { 0, 0 }, font_height, 0.0, rl.RAYWHITE); //rl.DrawTextEx(rl.GetFontDefault(), strings.unsafe_string_to_cstring(data.text), { 0, 0 }, 40, 0, rl.WHITE); //rl.DrawFPS(0, 0) -- cgit v1.2.1