create combat banner

This commit is contained in:
2026-06-20 21:12:52 -07:00
parent 1a18c42b9e
commit 195b94076b
3 changed files with 29 additions and 5 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ execute_command :: proc(world: ^World, cmd: Command) {
switch cmd.kind {
case .None:
case .Place_Tower:
try_place_tower(world, cmd.gx, cmd.gy, .Archer)
try_place_tower(world, cmd.gx, cmd.gy, world.selected_tower)
case .Start_Wave:
start_wave(world)
}
+28 -3
View File
@@ -42,7 +42,7 @@ draw_archer_button :: proc(world: ^World, archer: rl.Rectangle) {
arch_bg := CONTROLS_SHOP_IDLE
if world.selected_tower == .Archer do arch_bg = CONTROL_SHOP_SELECTED
if rl.CheckCollisionPointRec(mouse, archer) do arch_bg = CONTROL_BUTTON_HOVER
if rl.CheckCollisionPointRec(mouse, archer) do arch_bg = CONTROLS_SHOP_HOVER
label := fmt.ctprintf("Archer - %dg", arch.cost)
draw_button(archer, label, arch_bg, 14, OVERLAY_TEXT_COLOR)
@@ -55,7 +55,7 @@ draw_start_wave_button :: proc(start_wave_rect: rl.Rectangle, mouse: rl.Vector2)
draw_button(start_wave_rect, "Start Wave", bg, 16, OVERLAY_TEXT_COLOR)
}
render_controls :: proc(world: ^World) {
draw_build_controls :: proc(world: ^World) {
if world.phase != .Build do return
mouse := rl.GetMousePosition()
@@ -65,6 +65,31 @@ render_controls :: proc(world: ^World) {
archer, start_wave_rect := build_controls_layout()
draw_archer_button(world, archer)
draw_start_wave_button(start_wave_rect, mouse)
}
render_controls :: proc(world: ^World) {
switch world.phase {
case .Build:
draw_build_controls(world)
case .Combat:
draw_combat_banner()
case .Game_Over, .Victory:
}
}
draw_combat_banner :: proc() {
bar_y := bottom_bar_y()
rl.DrawRectangle(0, bar_y, SCREEN_W, CONTROL_BAR_H, rl.Color{120, 40, 40, 200})
text: cstring = "Combat!"
font: i32 = 16
tw := rl.MeasureText(text, font)
rl.DrawText(
text,
(SCREEN_W - tw) / 2,
bar_y + (CONTROL_BAR_H - font) / 2,
font,
rl.Color{255, 220, 220, 255},
)
}
-1
View File
@@ -10,7 +10,6 @@ render_hud :: proc(world: ^World) {
switch world.phase {
case .Build:
case .Combat:
rl.DrawText("Combat!", 10, 98, 22, rl.MAROON)
case .Game_Over:
rl.DrawText("GAME_OVER", 260, 280, 40, rl.RED)
case .Victory: