31 lines
697 B
C
31 lines
697 B
C
#ifndef RESOURCE_H
|
|
#define RESOURCE_H
|
|
|
|
#include "sys.h"
|
|
|
|
/* Represents raw bytes that can back a resource. This can be file data or embedded
|
|
* data in the executable. */
|
|
struct resource {
|
|
struct buffer bytes;
|
|
|
|
/* Internal */
|
|
#if !RESOURCES_EMBEDDED
|
|
struct sys_file file;
|
|
struct sys_file_map file_map;
|
|
#endif
|
|
};
|
|
|
|
struct resource_startup_receipt { i32 _; };
|
|
struct resource_startup_receipt resource_startup(void);
|
|
b32 resource_exists(struct string path);
|
|
struct resource resource_open(struct string path);
|
|
|
|
#if RESOURCES_EMBEDDED
|
|
/* Embedded resources don't need to be closed */
|
|
#define resource_close(res) (UNUSED)res
|
|
#else
|
|
void resource_close(struct resource res);
|
|
#endif
|
|
|
|
#endif
|