blob: 4f5312ec7e3544b8b514212ebb395c98e65396f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "TZR_resource.h"
#include "TZR_types.h"
#include <strings.h>
static TZR_ResourceType
deduce_type(const char *path)
{
const char *const path_extension = strrchr(path, '.');
if (path_extension == NULL)
return TZR_RES_RAW;
if (strcasecmp(path_extension, ".bmp") == 0 ||
strcasecmp(path_extension, ".png") == 0 ||
strcasecmp(path_extension, ".qoi") == 0)
return TZR_RES_IMAGE;
if (strcasecmp(path_extension, ".wav") == 0)
return TZR_RES_SOUND;
return TZR_RES_RAW;
}
TZR_Uint
TZR_LoadResource(const char *path)
{
return TZR_LoadResourceTyped(deduce_type(path), path);
}
|