This commit is contained in:
2026-08-01 21:48:30 +03:00
commit 3ce70bd00a
10 changed files with 588 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package main
import rl "vendor:raylib"
ui_draw_world_hp_bar :: proc(actor: ^Actor) {
hp_ratio := f32(actor.hp) / f32(actor.max_hp)
bar_w := actor.col_size * 3
bar_pos := actor.pos + rl.Vector2{-bar_w / 2, -actor.col_size - 10}
rl.DrawRectangleV(bar_pos, {bar_w, 4}, {60, 60, 60, 255})
rl.DrawRectangleV(bar_pos, {bar_w * hp_ratio, 4}, {220, 40, 40, 255})
}
ui_draw :: proc(state: ^GameState3) {
rl.DrawText(
rl.TextFormat("HP: %d/%d", state.player.hp, state.player.max_hp),
12,
12,
20,
rl.RAYWHITE,
)
rl.DrawText(rl.TextFormat("Enemies: %d", len(state.enemies)), 12, 36, 16, {180, 180, 180, 255})
rl.DrawText("[SPACE] attack [WASD] move", 12, SCREEN_H - 28, 14, {120, 120, 120, 255})
}