still segfaulting
This commit is contained in:
+13
-12
@@ -8,26 +8,26 @@ UI_BAR_COLOR :: clay.Color{20, 40, 20, 200}
|
||||
UI_TEXT_COLOR :: clay.Color{240, 240, 230, 255}
|
||||
UI_GOLD_COLOR :: clay.Color{255, 215, 80, 255}
|
||||
|
||||
ui_text_scratch: [64]u8
|
||||
|
||||
build_hud :: proc(world: ^World) {
|
||||
if clay.UI(clay.ID("HudBar"))({
|
||||
if clay.UI(clay.ID("HudBar"))(
|
||||
{
|
||||
layout = {
|
||||
layoutDirection = .LeftToRight,
|
||||
sizing = {
|
||||
width = clay.SizingGrow({}),
|
||||
height = clay.SizingFixed(28),
|
||||
},
|
||||
sizing = {width = clay.SizingGrow({}), height = clay.SizingFixed(28)},
|
||||
padding = clay.PaddingAll(6),
|
||||
childGap = 8,
|
||||
childAlignment = {y = .Center},
|
||||
},
|
||||
backgroundColor = UI_BAR_COLOR,
|
||||
}) {
|
||||
gold_text := fmt.tprintf("Gold: %d", world.gold)
|
||||
clay.Text(gold_text, clay.TextElementConfig{
|
||||
textColor = UI_GOLD_COLOR,
|
||||
fontId = UI_FONT_ID,
|
||||
fontSize = 18,
|
||||
})
|
||||
},
|
||||
) {
|
||||
gold_text := fmt.bprintf(ui_text_scratch[:], "Gold: %d", world.gold)
|
||||
clay.Text(
|
||||
gold_text,
|
||||
clay.TextElementConfig{textColor = UI_GOLD_COLOR, fontId = UI_FONT_ID, fontSize = 18},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,3 +47,4 @@ render_hud :: proc(world: ^World) {
|
||||
rl.DrawText("Victory!", 260, 280, 40, rl.GREEN)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,5 @@ render_world :: proc(world: ^World) {
|
||||
render_enemies(world)
|
||||
render_towers(world)
|
||||
render_projectiles(world)
|
||||
render_hud(world)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user