techkaczynski.dev / code

summaryrefslogtreecommitdiff
path: root/res.h
diff options
context:
space:
mode:
Diffstat (limited to 'res.h')
-rw-r--r--res.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/res.h b/res.h
new file mode 100644
index 0000000..6824842
--- /dev/null
+++ b/res.h
@@ -0,0 +1,43 @@
+#ifndef RES_H
+#define RES_H
+
+#include "common.h"
+
+typedef struct {
+ Shader sdr;
+ map_t(int) uniforms;
+} FunShader;
+
+typedef enum {
+ ASSET_TAG_INVALID,
+ ASSET_TAG_MODEL,
+ ASSET_TAG_TEXTURE,
+ ASSET_TAG_SOUND,
+ ASSET_TAG_FONT,
+} AssetTag;
+
+typedef struct {
+ AssetTag tag;
+ union {
+ Model mdl;
+ Texture tex;
+ Sound snd;
+ Font fnt;
+ };
+ char *path;
+ u32 path_strlen, ref_cnt;
+ bool loaded;
+} Asset;
+
+void res_init(void);
+void res_exit(void);
+void res_update(void);
+
+Asset* asset_get(cstr key);
+FunShader* shader_get(cstr key);
+
+void fun_shader_create(cstr key, cstr vpath, cstr fpath);
+void fun_shader_delete(FunShader*);
+int fun_shader_uniform(cstr skey, cstr ukey);
+
+#endif