#pragma once #include "TZR_types.h" /* Return 0 on error. */ [[nodiscard]] TZR_Uint TZR_LoadResourceFromMemory(TZR_ResourceType type, const void *data, int size); [[nodiscard]] TZR_Uint TZR_LoadResourceTyped(TZR_ResourceType type, const char *path); /* Return 0 on error; try to autodetect resource type from file extension. */ [[nodiscard]] TZR_Uint TZR_LoadResource(const char *path); /* Doesn't handle invalid ID. Pointer might get invalidated by resource * creation calls, use with caution. */ TZR_Resource *TZR_GetResourcePointer(TZR_Uint id); /* Doesn't handle invalid ID. Pointer might get invalidated by resource * creation calls, use with caution. */ TZR_Raw *TZR_GetRawResource(TZR_Uint id); /* Doesn't handle invalid ID. */ TZR_ResourceType TZR_GetResourceType(TZR_Uint id); /* Doesn't handle invalid ID. */ const char *TZR_GetResourcePath(TZR_Uint id); /* Doesn't handle invalid ID. */ int TZR_GetImageWidth(TZR_Uint id); /* Doesn't handle invalid ID. */ int TZR_GetImageHeight(TZR_Uint id); /* Reload ressource. Returns -1 on error and doesn't apply changes. */ int TZR_ReloadResource(TZR_Uint id); /* Watch for changes on managed resources and hotreload if appropriate. */ void TZR_ResourcesWatch(void); /* Used internaly. */ [[nodiscard]] int TZR_DirectResourceLoad(TZR_Resource *res, const void *data, int size); void TZR_DestroyResource(TZR_Resource *res, int free_path);