diff options
Diffstat (limited to 'src/entities/johnsStore.c')
| -rw-r--r-- | src/entities/johnsStore.c | 21 |
1 files changed, 9 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); } |
