diff options
Diffstat (limited to 'src/assets.c')
-rw-r--r-- | src/assets.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/assets.c b/src/assets.c index b08201a..f6d4792 100644 --- a/src/assets.c +++ b/src/assets.c @@ -19,6 +19,11 @@ Asset assets[] = { .type = Texture_Asset, .name = "human-shadow", .filePath = "assets/art/characters/shadow.png" + }, + { + .type = Texture_Asset, + .name = "player-body", + .filePath = "assets/art/characters/player.png" } }; @@ -32,6 +37,11 @@ void LoadAssets() { switch (c->type) { case Texture_Asset: c->texture = LoadTexture(c->filePath); + + if (c->texture.id == 0) { + TraceLog(LOG_ERROR, "Failed to load texture %s, exitting!", c->filePath); + exit(EXIT_FAILURE); + } break; default: @@ -51,6 +61,17 @@ Asset* GetMatchingAssetWithType(const char* targetName, AssetType targetType) { return NULL; } +Asset* GetMatchingAssetExitOnFail(const char* targetName, AssetType targetType) { + Asset* matchingAsset = GetMatchingAssetWithType(targetName, targetType); + + if (!matchingAsset) { + TraceLog(LOG_ERROR, "Failed to load asset %s, exitting!", targetName); + exit(EXIT_FAILURE); + } + + return matchingAsset; +} + void UnloadAssets() { for (size_t i = 0; i < ASSET_COUNT; i++) { Asset* c = &assets[i]; |