clean up overlay.odin

This commit is contained in:
2026-06-28 00:08:43 -07:00
parent e166076e11
commit 9317e83fd5
2 changed files with 10 additions and 17 deletions
+3 -1
View File
@@ -25,10 +25,10 @@ CANNON_PROJECTILES_SPEED :: 320.0
OVERLAY_BAR_H :: 28
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}
OVERLAY_FONT_SIZE :: 18
CONTROL_BAR_H :: 40
CONTROL_BAR_BG :: rl.Color{30, 55, 30, 220}
@@ -42,3 +42,5 @@ CONTROLS_SHOP_HOVER :: rl.Color{90, 130, 90, 255}
ICE_SLOW_DURATION :: 2.5
ICE_SLOW_FACTOR :: 0.5
ENEMY_LABEL_COLOR :: rl.Color{255, 200, 200, 255}
+7 -16
View File
@@ -6,37 +6,28 @@ 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
y: i32 = (OVERLAY_BAR_H - OVERLAY_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
x += rl.MeasureText(gold, OVERLAY_FONT_SIZE) + gap
hp := fmt.ctprintf("Health: %d", world.base_health)
rl.DrawText(hp, x, y, font_size, OVERLAY_TEXT_COLOR)
x += rl.MeasureText(hp, font_size) + gap
rl.DrawText(hp, x, y, OVERLAY_FONT_SIZE, OVERLAY_TEXT_COLOR)
x += rl.MeasureText(hp, OVERLAY_FONT_SIZE) + gap
enemies := fmt.ctprintf("Enemies: %d", active_enemy_count(world))
rl.DrawText(enemies, x, y, font_size, enemy_label_color(world))
x += rl.MeasureText(enemies, font_size) + gap
rl.DrawText(enemies, x, y, OVERLAY_FONT_SIZE, ENEMY_LABEL_COLOR)
x += rl.MeasureText(enemies, OVERLAY_FONT_SIZE) + gap
waves := fmt.ctprintf("Waves: %d / %d", world.wave, MAX_WAVES)
rl.DrawText(waves, x, y, font_size, OVERLAY_TEXT_COLOR)
rl.DrawText(waves, x, y, OVERLAY_FONT_SIZE, OVERLAY_TEXT_COLOR)
if world.phase == .Game_Over || world.phase == .Victory {
draw_end_screen(world)
}
}
enemy_label_color :: proc(world: ^World) -> rl.Color {
if world.phase == .Combat {
return rl.Color{255, 200, 200, 255}
}
return OVERLAY_TEXT_COLOR
}