From ddde2e8fdf05efac5914ca2b812b7762b78ba9ec Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Thu, 30 Apr 2026 19:09:18 +0200 Subject: Refactor debug info --- all.h | 1 + game.c | 5 +---- interface.c | 6 ++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/all.h b/all.h index ec07c39..59bdd32 100644 --- a/all.h +++ b/all.h @@ -140,6 +140,7 @@ void UnloadMap(void); // Interface void DrawCrosshair(void); +void DrawDebugInfo(void); // Player void UpdatePlayer(void); diff --git a/game.c b/game.c index dc54ce5..67767d3 100644 --- a/game.c +++ b/game.c @@ -325,10 +325,7 @@ void DrawGame(void) { EndMode3D(); DrawCrosshair(); - - DrawTextEx(game.font_ui, TextFormat("%i FPS", GetFPS()), (Vector2){ 10, 10 }, 20, 2, GREEN); - DrawTextEx(game.font_ui, TextFormat("VSync: %s", game.vsync ? "ON" : "OFF"), (Vector2){ 10, 35 }, 20, 2, GREEN); - DrawTextEx(game.font_ui, TextFormat("Speed: %.0f", game.horizontal_speed), (Vector2){ 10, 60 }, 20, 2, GREEN); + DrawDebugInfo(); } EndDrawing(); diff --git a/interface.c b/interface.c index a376ed2..d2cb4e0 100644 --- a/interface.c +++ b/interface.c @@ -6,3 +6,9 @@ void DrawCrosshair(void) { DrawLine(screenWidth / 2 - 10, screenHeight / 2, screenWidth / 2 + 10, screenHeight / 2, GREEN); DrawLine(screenWidth / 2, screenHeight / 2 - 10, screenWidth / 2, screenHeight / 2 + 10, GREEN); } + +void DrawDebugInfo(void) { + DrawTextEx(game.font_ui, TextFormat("%i FPS", GetFPS()), (Vector2){ 10, 10 }, 20, 2, GREEN); + DrawTextEx(game.font_ui, TextFormat("VSync: %s", game.vsync ? "ON" : "OFF"), (Vector2){ 10, 35 }, 20, 2, GREEN); + DrawTextEx(game.font_ui, TextFormat("Speed: %.0f", game.horizontal_speed), (Vector2){ 10, 60 }, 20, 2, GREEN); +} -- cgit v1.2.3