From 106f8195e2c0d9cb9308339318fbd818fb3507cc Mon Sep 17 00:00:00 2001 From: Jason Hilder Date: Tue, 15 Sep 2026 05:41:41 +0200 Subject: [PATCH] Added a winning score to levels. --- src/level_manager.odin | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/level_manager.odin b/src/level_manager.odin index a7c6bad..8866f26 100644 --- a/src/level_manager.odin +++ b/src/level_manager.odin @@ -15,6 +15,7 @@ Level :: struct { wait_time: f32, score_player: int, score_enemy: int, + score_win: int, } FIELD_BORDER :: 3 @@ -50,6 +51,7 @@ init_level :: proc() -> Level { wait_time = SERVE_WAIT_TIME, score_player = 0, score_enemy = 0, + score_win = 2, } } @@ -89,17 +91,14 @@ render_hud :: proc(level: Level) { opp_box := rl.Rectangle{(VIEWPORT_W - 5 - opp_size.x), 5, (opp_size.x), (opp_size.y)} opp_pos := rl.Vector2{opp_box.x, opp_box.y} rl.DrawTextEx(font, "COMPUTER", opp_pos, 20, 2, rl.WHITE) - // rl.DrawRectangleLinesEx(opp_box, 1.0, rl.RED) // score box - // DYNAMIC SCORE BOX // Format the score dynamically into a C-string allocated on the temp allocator score_text := fmt.ctprintf("%d : %d", level.score_player, level.score_enemy) score_size := rl.MeasureTextEx(font, score_text, 20, 2) score_box := rl.Rectangle{(VIEWPORT_W / 2 - score_size.x / 2), 5, (score_size.x), (score_size.y)} score_pos := rl.Vector2{score_box.x, score_box.y} rl.DrawTextEx(font, score_text, score_pos, 20, 2, rl.WHITE) - // rl.DrawRectangleLinesEx(score_box, 1.0, rl.RED) // game name // rl.DrawRectangleLines(VIEWPORT_W / 2 - 50, VIEWPORT_H - 50, 100, 50, rl.RED)