aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathansmith117 <thenathansmithsmith@gmail.com>2024-03-11 17:58:19 +0000
committernathansmith117 <thenathansmithsmith@gmail.com>2024-03-11 17:58:19 +0000
commitbddaf2daaa7f67c2d46a6a611421fc9db6eef83d (patch)
tree89c2586f6f64c1d689236e60e5816ab71d60cea8
parent57a682c295eb665dfa935031446df255471f8edd (diff)
downloadPenguinYippies-bddaf2daaa7f67c2d46a6a611421fc9db6eef83d.tar.gz
PenguinYippies-bddaf2daaa7f67c2d46a6a611421fc9db6eef83d.tar.bz2
PenguinYippies-bddaf2daaa7f67c2d46a6a611421fc9db6eef83d.zip
Shop going well
-rw-r--r--src/shop.c41
-rw-r--r--src/shop.h14
2 files changed, 53 insertions, 2 deletions
diff --git a/src/shop.c b/src/shop.c
index 68ce2f9..3b77f09 100644
--- a/src/shop.c
+++ b/src/shop.c
@@ -2,9 +2,19 @@
#include "game.h"
#include "assets.h"
+// Callbacks.
+void createPenguinLolCB(Game* game)
+{
+
+}
+
void initShop(Shop* shop, Game* game)
{
+ Assets* assets = &game->assets;
+ // Entries.
+ shop->penguinLol = LoadTextureFromImage(assets->animations[PENGUIN_LOL_ANIMATION].image);
+ shop->entries[0] = (ShopEntry){&shop->penguinLol, 10, createPenguinLolCB};
}
void updateShop(Shop* shop, Game* game)
@@ -24,7 +34,7 @@ void updateShop(Shop* shop, Game* game)
// Penguin thingy thing thing
Texture yoyoyo = game->assets.textures[EMPEROR_SHOP_UI_TEXTURE];
- DrawTexturePro(
+ DrawTexturePro(
yoyoyo,
(Rectangle){0.0, 0.0, yoyoyo.width, yoyoyo.height},
(Rectangle){0.0, 0.0, WINDOW_WIDTH, WINDOW_HEIGHT},
@@ -32,9 +42,36 @@ void updateShop(Shop* shop, Game* game)
0.0,
WHITE
);
+
+ // Entry rects.
+ double startX = 150.0;
+ double startY = 80.0;
+ double width = 100.0;
+ double height = 100.0;
+
+ Rectangle rects[SHOP_ENTRY_COUNT] = {
+ (Rectangle){startX, startY, width, height}
+ };
+
+ // Entries.
+ for (int i = 0; i < SHOP_ENTRY_COUNT; ++i)
+ {
+ Texture entryTexture = *shop->entries[i].texture;
+
+ DrawTexturePro(
+ entryTexture,
+ (Rectangle){0.0, 0.0, entryTexture.width, entryTexture.height},
+ rects[i],
+ (Vector2){0.0, 0.0},
+ 0.0,
+ WHITE
+ );
+
+ DrawRectangleLinesEx(rects[i], 2, BLACK);
+ }
}
void closeShop(Shop* shop)
{
-
+ UnloadTexture(shop->penguinLol);
}
diff --git a/src/shop.h b/src/shop.h
index bae42b3..e9555a5 100644
--- a/src/shop.h
+++ b/src/shop.h
@@ -2,10 +2,24 @@
// The fullname is waaayyy toooo looonnnng for lazy lazy me
+#define SHOP_ENTRY_COUNT 1
+
#ifndef SHOP_H
#define SHOP_H
+typedef void (*ShopyEntryCB)(Game* game);
+
+typedef struct ShopEntry {
+ Texture* texture;
+ int cost;
+ ShopyEntryCB callback;
+} ShopEntry;
+
typedef struct Shop {
+ ShopEntry entries[SHOP_ENTRY_COUNT];
+
+ // Some silly textures.
+ Texture penguinLol;
} Shop;
void initShop(Shop* shop, Game* game);