aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets.c
blob: a50b8242f5c3921d644d7fc26e6b810de395d94f (plain) (blame)
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
44
#include "assets.h"

const char imageAssetPaths[IMAGE_ASSET_COUNT][FT_NAMEMAX] = {
  "heightmap.png"
};

const char textureAssetPaths[TEXTURE_ASSET_COUNT][FT_NAMEMAX] = {
  "heightmap.png",
  "mint.png",
  "nickel.png",
  "tree.png"
};

void initAssets(Assets* assets)
{
  // Images.
  for (int index = 0; index < IMAGE_ASSET_COUNT; ++index)
  {
    assets->images[index] = LoadImage(
      TextFormat("assets/%s", imageAssetPaths[index]));
  }

  // Textures.
  for (int index = 0; index < TEXTURE_ASSET_COUNT; ++index)
  {
    assets->textures[index] = LoadTexture(
      TextFormat("assets/%s", textureAssetPaths[index]));
  }
}

void closeAssets(Assets* assets)
{
  // Images.
  for (int index = 0; index < IMAGE_ASSET_COUNT; ++index)
  {
    UnloadImage(assets->images[index]);
  }

  // Textures.
  for (int index = 0; index < TEXTURE_ASSET_COUNT; ++index)
  {
    UnloadTexture(assets->textures[index]);
  }
}