blob: c1c73cecd50393586ebdc595aada57a7131ebb80 (
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
|
#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;
return TZR_RES_RAW;
}
TZR_Uint
TZR_LoadResource(const char *path)
{
return TZR_LoadResourceTyped(deduce_type(path), path);
}
|