From 9317e83fd5772c5dee9066c5bb114e0f49c7635a Mon Sep 17 00:00:00 2001 From: codegirl-007 Date: Sun, 28 Jun 2026 00:08:43 -0700 Subject: [PATCH] clean up overlay.odin --- game/constants.odin | 4 +++- game/overlay.odin | 23 +++++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/game/constants.odin b/game/constants.odin index 72e378e..4f1395f 100644 --- a/game/constants.odin +++ b/game/constants.odin @@ -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} + diff --git a/game/overlay.odin b/game/overlay.odin index c3bec01..ba90c26 100644 --- a/game/overlay.odin +++ b/game/overlay.odin @@ -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 -} -