blob: 330589dccc85a70b786218e57dc8674b3c467161 (
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
25
26
27
28
29
|
#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, ".jpg") == 0 ||
strcasecmp(path_extension, ".qoi") == 0)
return TZR_RES_IMAGE;
if (strcasecmp(path_extension, ".wav") == 0)
return TZR_RES_SOUND;
if (strcasecmp(path_extension, ".ttf") == 0 ||
strcasecmp(path_extension, ".otf") == 0 ||
strcasecmp(path_extension, ".fon") == 0)
return TZR_RES_FONT;
return TZR_RES_RAW;
}
TZR_Uint
TZR_LoadResource(const char *path)
{
return TZR_LoadResourceTyped(deduce_type(path), path);
}
|