From 763f9094a1490c82f3090efe8bbffd2290f02732 Mon Sep 17 00:00:00 2001 From: Adrian Wallin <150428124+LeadHood@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:51:38 +0100 Subject: [PATCH] Move redundant DrawText calls outside loop The example draws the text for the controls inside the for-loop, which is bad practice. Instead I moved it outside the for-loop, so it does not draw that text the amount of rectangles times. --- examples/core/core_random_sequence.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/core/core_random_sequence.c b/examples/core/core_random_sequence.c index 32ec3001bdec..876bacb19c60 100644 --- a/examples/core/core_random_sequence.c +++ b/examples/core/core_random_sequence.c @@ -95,12 +95,12 @@ int main(void) for (int i = 0; i < rectCount; i++) { DrawRectangleRec(rectangles[i].rect, rectangles[i].color); - - DrawText("Press SPACE to shuffle the current sequence", 10, screenHeight - 96, 20, BLACK); - DrawText("Press UP to add a rectangle and generate a new sequence", 10, screenHeight - 64, 20, BLACK); - DrawText("Press DOWN to remove a rectangle and generate a new sequence", 10, screenHeight - 32, 20, BLACK); } + DrawText("Press SPACE to shuffle the current sequence", 10, screenHeight - 96, 20, BLACK); + DrawText("Press UP to add a rectangle and generate a new sequence", 10, screenHeight - 64, 20, BLACK); + DrawText("Press DOWN to remove a rectangle and generate a new sequence", 10, screenHeight - 32, 20, BLACK); + DrawText(TextFormat("Count: %d rectangles", rectCount), 10, 10, 20, MAROON); DrawFPS(screenWidth - 80, 10);