aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-12-27 23:00:54 +0000
committernathan <nathansmith@disroot.org>2025-12-27 23:00:54 +0000
commit8f2d85aa019f089b6946f3b9e0355ce59b12b67a (patch)
treeac26c36f4c41f21641cf2786d740567413cd6ac5 /src/entities
parentc6096a028d57da1026aa86ac215ea2f07461cd96 (diff)
downloadFindThings-8f2d85aa019f089b6946f3b9e0355ce59b12b67a.tar.gz
FindThings-8f2d85aa019f089b6946f3b9e0355ce59b12b67a.tar.bz2
FindThings-8f2d85aa019f089b6946f3b9e0355ce59b12b67a.zip
Buildings going well
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/johnsStore.c21
-rw-r--r--src/entities/johnsStore.h1
2 files changed, 10 insertions, 12 deletions
diff --git a/src/entities/johnsStore.c b/src/entities/johnsStore.c
index 5a38bd7..e3f4908 100644
--- a/src/entities/johnsStore.c
+++ b/src/entities/johnsStore.c
@@ -2,6 +2,9 @@
void initJohnsStore(Entity* entity)
{
+ int width = 6;
+ int height = 6;
+
Color colors[] = {
WHITE, WHITE, WHITE, WHITE, WHITE, WHITE,
WHITE, BLACK, BLACK, BLACK, BLACK, WHITE,
@@ -10,19 +13,9 @@ void initJohnsStore(Entity* entity)
WHITE, BLACK, BLACK, BLACK, BLACK, WHITE,
WHITE, WHITE, BLACK, BLACK, WHITE, WHITE
};
-
- int width = 6;
- int height = 6;
-
- Image cubemap = (Image){
- .data = colors,
- .width = width,
- .height = height,
- .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
- .mipmaps = 1
- };
- entity->data = (void*)createEntityBuilding(cubemap);
+ entity->data = (void*)createEntityBuilding(
+ colorsToImage(colors, width, height));
EntityBuilding* building = (EntityBuilding*)entity->data;
entity->box = GetModelBoundingBox(building->model);
}
@@ -30,7 +23,11 @@ void initJohnsStore(Entity* entity)
void updateJohnsStore(Entity* entity, Game* game)
{
EntityBuilding* building = (EntityBuilding*)entity->data;
+
+ building->model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture =
+ game->assets.textures[JOHNS_SHOP_TEXTURE];
DrawModel(building->model, entity->position, 1.0, WHITE);
+
DrawBoundingBox(entity->box, RED);
}
diff --git a/src/entities/johnsStore.h b/src/entities/johnsStore.h
index fd84214..c377741 100644
--- a/src/entities/johnsStore.h
+++ b/src/entities/johnsStore.h
@@ -1,6 +1,7 @@
#include "game.h"
#include "entity.h"
#include "utils.h"
+#include "assets.h"
#ifndef JOHNS_STORE_H
#define JOHNS_STORE_H