1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "johnsStore.h"
void initJohnsStore(Entity* entity)
{
Color colors[] = {
WHITE, WHITE, WHITE, WHITE, WHITE, WHITE,
WHITE, BLACK, BLACK, BLACK, BLACK, WHITE,
WHITE, BLACK, BLACK, BLACK, BLACK, WHITE,
WHITE, BLACK, BLACK, BLACK, BLACK, WHITE,
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);
EntityBuilding* building = (EntityBuilding*)entity->data;
entity->box = GetModelBoundingBox(building->model);
}
void updateJohnsStore(Entity* entity, Game* game)
{
EntityBuilding* building = (EntityBuilding*)entity->data;
DrawModel(building->model, entity->position, 1.0, WHITE);
DrawBoundingBox(entity->box, RED);
}
void closeJohnsStore(Entity* entity)
{
if (entity->data != NULL)
{
freeEntityBuilding((EntityBuilding*)entity->data);
}
}
|