aboutsummaryrefslogtreecommitdiff
path: root/sources/TZR_DestroyResource.c
blob: 0e7369043848a0c10d83cb381b96b8e8ea3e4049 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "TZR_resource.h"

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;
	default:
		fprintf(stderr, "unknown resource type %u\n", res->type);
		break;
	}
}