diff options
author | San Jacobs | 2025-10-03 10:07:05 +0200 |
---|---|---|
committer | San Jacobs | 2025-10-03 10:07:05 +0200 |
commit | 2b5cde684bfe8e4aeffb688ff60d957349ba0d53 (patch) | |
tree | e2e707d20c202d362ce75b375cdc9acbb558c552 /src | |
parent | 05d5193c01c02e11dad5d7fe3224e2fd9b001c6e (diff) | |
download | tafl-2b5cde684bfe8e4aeffb688ff60d957349ba0d53.tar.gz tafl-2b5cde684bfe8e4aeffb688ff60d957349ba0d53.tar.bz2 tafl-2b5cde684bfe8e4aeffb688ff60d957349ba0d53.zip |
If something has text, let it be sized to the text by default
Diffstat (limited to 'src')
-rw-r--r-- | src/tafl/tafl.odin | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tafl/tafl.odin b/src/tafl/tafl.odin index 83fc670..50c68c5 100644 --- a/src/tafl/tafl.odin +++ b/src/tafl/tafl.odin @@ -102,6 +102,12 @@ tafl_open :: proc( parent = &tafl_elements[tafl_stack[tafl_stack_depth-1]] } + if text != "" { + measurement := rl.MeasureTextEx(DEFAULT_FONT, strings.clone_to_cstring(text, allocator=context.temp_allocator), f32(FONT_SIZE), 0) + width = max(width, int(measurement.x)) + height = max(height, int(measurement.y)) + } + if width == -1 { width = parent.inner.width } @@ -109,11 +115,6 @@ tafl_open :: proc( height = parent.inner.height } - if text != "" { - measurement := rl.MeasureTextEx(DEFAULT_FONT, strings.clone_to_cstring(text, allocator=context.temp_allocator), f32(FONT_SIZE), 0) - width = max(width, int(measurement.x)) - height = max(height, int(measurement.y)) - } x, y : int if parent != nil { |