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
|
#include "johnsStore.h"
void initJohnsStore(Entity* entity)
{
int width = 6;
int height = 6;
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
};
entity->data = (void*)createEntityBuilding(
colorsToImage(colors, width, height));
EntityBuilding* building = (EntityBuilding*)entity->data;
entity->box = GetModelBoundingBox(building->model);
}
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);
}
void closeJohnsStore(Entity* entity)
{
if (entity->data != NULL)
{
freeEntityBuilding((EntityBuilding*)entity->data);
}
}
|