Add load_asset_from_pack function
This commit is contained in:
1 parent
c60a9e6507
commit
d85bfc0f01
2 files changed
+20
No files matched your search
@@ -8,6 +8,7 @@
|
||||
#include "SDL_pixels.h"
|
||||
#include "Window.h"
|
||||
#include "aliases.h"
|
||||
#include "pak.h"
|
||||
#include "reusable_ids.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -46,6 +47,8 @@ void remove_object(ObjectID *id);
|
||||
|
||||
// ASSET MANAGEMENT API
|
||||
AssetID load_asset_from_file(const char *path, AssetType type);
|
||||
AssetID load_asset_from_pack(asset_pack_t *pack, const char *filename,
|
||||
AssetType type);
|
||||
void unload_asset(AssetID *id);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
@@ -207,6 +207,10 @@ void remove_object(ObjectID *id) {
|
||||
}
|
||||
|
||||
AssetID load_asset_from_file(const char *path, AssetType type) {
|
||||
if (!path) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
|
||||
return type == ASSET_TYPE_IMAGE
|
||||
? load_asset_to_manager(GameEngine.asset_manager, path, type,
|
||||
GameEngine.window.renderer, NULL)
|
||||
@@ -214,6 +218,19 @@ AssetID load_asset_from_file(const char *path, AssetType type) {
|
||||
NULL);
|
||||
}
|
||||
|
||||
AssetID load_asset_from_pack(asset_pack_t *pack, const char *filename,
|
||||
AssetType type) {
|
||||
if (!pack || !filename) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
|
||||
return type == ASSET_TYPE_IMAGE
|
||||
? load_asset_to_manager(GameEngine.asset_manager, filename, type,
|
||||
GameEngine.window.renderer, pack)
|
||||
: load_asset_to_manager(GameEngine.asset_manager, filename, type,
|
||||
NULL, pack);
|
||||
}
|
||||
|
||||
void unload_asset(AssetID *id) {
|
||||
if (*id < 0) {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user