From 8f2d85aa019f089b6946f3b9e0355ce59b12b67a Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 27 Dec 2025 16:00:54 -0700 Subject: Buildings going well --- src/entities/johnsStore.c | 21 +++++++++------------ src/entities/johnsStore.h | 1 + 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src/entities') 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 -- cgit v1.2.3