From a82d43089143337524c90b6e2d9df174466abdcb Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Wed, 13 Mar 2024 12:15:15 -0600 Subject: Cost in shop added --- src/shop.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/shop.c b/src/shop.c index 47f3b7b..ea9b60c 100644 --- a/src/shop.c +++ b/src/shop.c @@ -97,6 +97,7 @@ void updateShop(Shop* shop, Game* game) { Texture entryTexture = *shop->entries[i].texture; + // Draw the entry texture. DrawTexturePro( entryTexture, (Rectangle){0.0, 0.0, entryTexture.width, entryTexture.height}, @@ -121,7 +122,22 @@ void updateShop(Shop* shop, Game* game) } } + // Draw outline. DrawRectangleLinesEx(rects[i], 2, outlineColor); + + // Draw cost. + char costBuf[20]; + int cost = shop->entries[i].cost; + snprintf(costBuf, sizeof(costBuf), "%d", cost); + + Color costColor = BLACK; + + if (cost > game->stones) + { + costColor = RED; + } + + DrawText(costBuf, rects[i].x + rects[i].width + 2, rects[i].y + 10, 50, costColor); } } -- cgit v1.2.3