Enabled SDL_image's support for PNG and TIFF files and improved the

AssetManager with a hashing function, a linked list structure to store
the hashes as well as a reference counter to support multiple users
sharing the same asset.
This commit is contained in:
abdelrahman committed 2022-09-24 04:17:16 +01:00
1 parent 3f71cf0f3f
commit dfee36ffe9
12 files changed
+292 -60

No files matched your search

+10 -2
View File
@@ -5,7 +5,11 @@
#include "SDL_mixer.h"
#include "SDL_render.h"
#include "reusable_ids.h"
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif // !__cplusplus
typedef enum {
ASSET_TYPE_IMAGE,
@@ -19,10 +23,14 @@ typedef struct asset_manager AssetManager;
AssetManager *create_asset_manager();
AssetID load_asset_to_manager(AssetManager *am, const char *path,
AssetType type, Renderer *renderer);
void remove_asset_from_manager(AssetManager *am, AssetID id);
void remove_asset_from_manager(AssetManager *am, AssetID *id_ptr);
SDL_Texture *get_texture(AssetManager *am, AssetID id);
Mix_Chunk *get_audio_chunk(AssetManager *am, AssetID id);
Mix_Music *get_music(AssetManager *am, AssetID id);
void destroy_asset_manager(AssetManager *am);
#ifdef __cplusplus
}
#endif // !__cplusplus
#endif // !ASSET_MANAGER_H