Files
tower-defense-prototype/game/overlay.odin
T

43 lines
1.1 KiB
Odin

package game
import "core:fmt"
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.economy.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)
x += rl.MeasureText(hp, 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
waves := fmt.ctprintf("Waves: %d / %d", world.wave, MAX_WAVES)
rl.DrawText(waves, x, y, 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
}