move health to overlay

This commit is contained in:
2026-06-18 01:19:00 -07:00
parent 75c29a4d5e
commit d44e9501f5
3 changed files with 11 additions and 1 deletions
+1
View File
@@ -24,4 +24,5 @@ OVERLAY_PADDING :: 6
OVERLAY_BAR_COLOR :: rl.Color{20, 24, 20, 200}
OVERLAY_GOLD_COLOR :: rl.Color{255, 215, 80, 255}
OVERLAY_TEXT_COLOR :: rl.Color{240, 240, 230, 255}
-1
View File
@@ -4,7 +4,6 @@ import "core:fmt"
import rl "vendor:raylib"
render_hud :: proc(world: ^World) {
rl.DrawText(fmt.ctprintf("Base HP: %d", world.base_health), 10, 32, 22, rl.BLACK) // HP HUD
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)
+10
View File
@@ -6,7 +6,17 @@ import rl "vendor:raylib"
render_overlay :: proc(world: ^World) {
rl.DrawRectangle(0, 0, SCREEN_W, OVERLAY_BAR_H, OVERLAY_BAR_COLOR)
font_size: i32 = 18
y: i32 = (OVERLAY_BAR_H - font_size) / 2
x: i32 = OVERLAY_PADDING
gap: i32 : 16
gold := fmt.ctprintf("Gold: %d", world.gold)
rl.DrawText(gold, OVERLAY_PADDING, OVERLAY_PADDING, 18, OVERLAY_GOLD_COLOR)
x += rl.MeasureText(gold, font_size) + gap
hp := fmt.ctprintf("Health: %d", world.base_health)
rl.DrawText(hp, x, y, font_size, OVERLAY_TEXT_COLOR)
}