I don't know what i did wrong

This commit is contained in:
2026-06-16 20:09:56 -07:00
parent 3ec1c6a227
commit 46114a1dbb
4 changed files with 145 additions and 5 deletions
+29 -3
View File
@@ -1,11 +1,38 @@
package game
import clay "../clay-odin"
import "core:fmt"
import rl "vendor:raylib"
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}
build_hud :: proc(world: ^World) {
if clay.UI(clay.ID("HudBar"))({
layout = {
layoutDirection = .LeftToRight,
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,
})
}
}
render_hud :: proc(world: ^World) {
rl.DrawText(fmt.ctprintf("Gold: %d", world.gold), 10, 10, 22, rl.BLACK) // Gold HUD
rl.DrawText(fmt.ctprintf("Base HP: %d", world.base_health), 10, 32, 22, rl.BLACK) // HP HUD
rl.DrawText(fmt.ctprintf("Base HP: %d", world.base_health), 10, 32, 22, rl.BLACK)
rl.DrawText(fmt.ctprintf("Enemies: %d", active_enemy_count(world)), 10, 54, 22, rl.BLACK)
rl.DrawText(fmt.ctprintf("Wave: %d / %d", world.wave, MAX_WAVES), 10, 76, 22, rl.BLACK)
@@ -20,4 +47,3 @@ render_hud :: proc(world: ^World) {
rl.DrawText("Victory!", 260, 280, 40, rl.GREEN)
}
}