Files
punchie-engine/include/AssetManager.h
T
abdelrahman dfee36ffe9 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.
2022-09-24 04:17:16 +01:00

37 lines
899 B
C

#ifndef ASSET_MANAGER_H
#define ASSET_MANAGER_H
#include "Renderer.h"
#include "SDL_mixer.h"
#include "SDL_render.h"
#include "reusable_ids.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif // !__cplusplus
typedef enum {
ASSET_TYPE_IMAGE,
ASSET_TYPE_AUDIO_FX,
ASSET_TYPE_MUSIC,
ASSET_TYPE_COUNT
} AssetType;
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_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