aboutsummaryrefslogtreecommitdiffstats
path: root/src/shop.c
diff options
context:
space:
mode:
authornathansmith117 <thenathansmithsmith@gmail.com>2024-03-11 18:10:24 +0000
committernathansmith117 <thenathansmithsmith@gmail.com>2024-03-11 18:10:24 +0000
commitdb67be702a0254df3284832f011217a421428bd1 (patch)
treef8acfa757d88899c330f8c92c6024c9dfd066014 /src/shop.c
parentbddaf2daaa7f67c2d46a6a611421fc9db6eef83d (diff)
downloadPenguinYippies-db67be702a0254df3284832f011217a421428bd1.tar.gz
PenguinYippies-db67be702a0254df3284832f011217a421428bd1.tar.bz2
PenguinYippies-db67be702a0254df3284832f011217a421428bd1.zip
More silly shop thingies
Diffstat (limited to 'src/shop.c')
-rw-r--r--src/shop.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/shop.c b/src/shop.c
index 3b77f09..f1b6493 100644
--- a/src/shop.c
+++ b/src/shop.c
@@ -1,11 +1,13 @@
#include "shop.h"
#include "game.h"
#include "assets.h"
+#include "util.h"
+#include <raylib.h>
// Callbacks.
-void createPenguinLolCB(Game* game)
+void createPenguinLolCB(ShopEntry* entry, Game* game)
{
-
+ puts("hihihi");
}
void initShop(Shop* shop, Game* game)
@@ -67,7 +69,22 @@ void updateShop(Shop* shop, Game* game)
WHITE
);
- DrawRectangleLinesEx(rects[i], 2, BLACK);
+ Color outlineColor = BLACK;
+
+ // Test collision.
+ if (CheckCollisionPointRec(getScaledMousePosition(), rects[i]))
+ {
+ if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
+ {
+ shop->entries[i].callback(&shop->entries[i], game);
+ }
+ else if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
+ {
+ outlineColor = BLUE;
+ }
+ }
+
+ DrawRectangleLinesEx(rects[i], 2, outlineColor);
}
}