#include "TZR_resource.h" #include void TZR_DestroyResource(TZR_Resource *res, int free_path) { if (res->path != NULL && free_path) free(res->path); switch (res->type) { case TZR_RES_RAW: if (res->raw.data != NULL) free(res->raw.data); break; case TZR_RES_IMAGE: if (res->image.ptr != NULL) SDL_DestroyTexture(res->image.ptr); break; case TZR_RES_SOUND: #ifdef TZR_SOLOUD if (res->sound.ptr != NULL) Wav_destroy(res->sound.ptr); #else if (res->sound.ptr != NULL) Mix_FreeChunk(res->sound.ptr); #endif break; default: TZR_Log("unknown resource type %u", res->type); break; } }