#ifndef _assets_h #define _assets_h #include #ifdef __cplusplus extern "C" { #endif #include "stddef.h" #include "SDL2/SDL.h" typedef enum resourcetype_t { RESOURCETYPE_MIN, RESOURCETYPE_TEXTURE, RESOURCETYPE_FONT, RESOURCETYPE_ARBITRARY, RESOURCETYPE_MAX } resourcetype_t; typedef void(*deleter_t)(void* target); typedef struct resource_t { resourcetype_t type; uintptr_t hash; char* name; union { SDL_Texture* texture; TTF_Font* font; struct { void* memory; deleter_t deleter; } arbitrary_type; }; } resource_t; extern void add_arbitrary_asset(void* memory, deleter_t deleter); extern SDL_Texture* load_texture(const char* file); extern TTF_Font* load_font(const char* file, int size); extern SDL_Texture* get_texture(const char* file); extern TTF_Font* get_font(const char* file, int size); extern resource_t* get_asset(const char* file); extern void clean_assets(); #ifdef __cplusplus } #endif #endif /* _assets_h */