first go at a control panel, not fancy
This commit is contained in:
@@ -18,31 +18,5 @@ render_overlay :: proc(world: ^World) {
|
||||
|
||||
hp := fmt.ctprintf("Health: %d", world.base_health)
|
||||
rl.DrawText(hp, x, y, font_size, OVERLAY_TEXT_COLOR)
|
||||
|
||||
if world.phase == .Build {
|
||||
btn := start_wave_button_rect()
|
||||
mouse := rl.GetMousePosition()
|
||||
hovered := rl.CheckCollisionPointRec(mouse, btn)
|
||||
bg := hovered ? OVERLAY_BUTTON_HOVER : OVERLAY_BUTTON_COLOR
|
||||
rl.DrawRectangleRec(btn, bg)
|
||||
rl.DrawText("Start Wave", i32(btn.x) + 8, i32(btn.y) + 3, 16, OVERLAY_TEXT_COLOR)
|
||||
}
|
||||
}
|
||||
|
||||
start_wave_button_rect :: proc() -> rl.Rectangle {
|
||||
return {x = f32(SCREEN_W - 120), y = 3, width = 110, height = 22}
|
||||
}
|
||||
|
||||
overlay_ui_command :: proc(world: ^World) -> Command {
|
||||
if world.phase != .Build do return Command{kind = .None}
|
||||
|
||||
mouse := rl.GetMousePosition()
|
||||
btn := start_wave_button_rect()
|
||||
|
||||
if rl.CheckCollisionPointRec(mouse, btn) && rl.IsMouseButtonPressed(.LEFT) {
|
||||
return Command{kind = .Start_Wave}
|
||||
}
|
||||
|
||||
return Command{kind = .None}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user