summaryrefslogtreecommitdiffstats
path: root/src/resources/resource.h
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-02-15 15:28:42 (EST)
committer P. J. McDermott <pjm@nac.net>2013-02-15 15:28:42 (EST)
commitc978f746058497ddd9ddc9cf3e156c4453e487f1 (patch)
treeb7855dd65c735c54ad535f31d4fbd645ca29fc1b /src/resources/resource.h
parent80191b41352ad20493fb62e8f3683d69133d0d24 (diff)
downloadoverworld-rpg-c978f746058497ddd9ddc9cf3e156c4453e487f1.zip
overworld-rpg-c978f746058497ddd9ddc9cf3e156c4453e487f1.tar.gz
overworld-rpg-c978f746058497ddd9ddc9cf3e156c4453e487f1.tar.bz2
Add resource manager and move src/image.*.
Diffstat (limited to 'src/resources/resource.h')
-rw-r--r--src/resources/resource.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/resources/resource.h b/src/resources/resource.h
new file mode 100644
index 0000000..ada91fd
--- /dev/null
+++ b/src/resources/resource.h
@@ -0,0 +1,23 @@
+#ifndef RESOURCE_H
+#define RESOURCE_H
+
+struct resource_table {
+ struct resource *head;
+ struct resource *tail;
+};
+struct resource {
+ char *path;
+ int refs;
+ struct resource *prev;
+ struct resource *next;
+};
+
+extern inline void *resource_alloc(const char *path, size_t size);
+struct resource *resource_get(struct resource_table *resources,
+ const char *path);
+void resource_add(struct resource_table *resources, const char *path,
+ struct resource *new_res);
+void resource_use(struct resource *resource);
+int resource_free(struct resource_table *resources, struct resource *resource);
+
+#endif