aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornathansmith117 <thenathansmithsmith@gmail.com>2024-03-13 18:15:15 +0000
committernathansmith117 <thenathansmithsmith@gmail.com>2024-03-13 18:15:15 +0000
commita82d43089143337524c90b6e2d9df174466abdcb (patch)
treedfc2b8d9d2eadad9082dcacbbfc8cd6a60f8aff0 /src
parent8372a776ad2e06b99e4704403504ba74932276ec (diff)
downloadPenguinYippies-a82d43089143337524c90b6e2d9df174466abdcb.tar.gz
PenguinYippies-a82d43089143337524c90b6e2d9df174466abdcb.tar.bz2
PenguinYippies-a82d43089143337524c90b6e2d9df174466abdcb.zip
Cost in shop added
Diffstat (limited to 'src')
-rw-r--r--src/shop.c16
1 files changed, 16 insertions, 0 deletions
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);
}
}