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 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/entities/johnsStore.c') 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); } -- cgit v1.2.3