commit 860309b7f9b6efb30a16b3882150c050a2875944
parent 92fb309c8e904a59d20446c99c7ea3f16fa32132
Author: Henry Unite <unitehenry@gmail.com>
Date: Sun, 19 Apr 2026 17:40:34 +0000
feat: render digits
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/game.c b/src/game.c
@@ -202,11 +202,19 @@ void draw_score() {
return;
}
- float centerX = (screenWidth - scoreTexture[0].width) / 2.0f;
+ int testScore = 123;
+
+ char *renderScore;
+
+ asprintf(&renderScore, "%i", testScore);
float scoreY = 0.0f + (scoreTexture[0].height * 1.5f);
- DrawTexture(scoreTexture[0], centerX, scoreY, WHITE);
+ for(int i = 0; i < sizeof(renderScore) - 1; i++) {
+ float scoreX = ((screenWidth - scoreTexture[0].width) / 2.0f) + (scoreTexture[0].width * i);
+
+ DrawTexture(scoreTexture[renderScore[i] - '0'], scoreX, scoreY, WHITE);
+ }
}
void draw() {