aboutsummaryrefslogtreecommitdiff
path: root/src/resources.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources.odin')
-rw-r--r--src/resources.odin12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/resources.odin b/src/resources.odin
index 315551d..1bd567e 100644
--- a/src/resources.odin
+++ b/src/resources.odin
@@ -96,3 +96,15 @@ get_image :: proc(id: Image_Id) -> rl.Texture2D {
get_room :: proc(id: Room_Id) -> Room_Resource {
return rooms[id]
}
+
+convert_path_to_resource :: proc(
+ obj: Object_Resource,
+ property: string,
+) -> Resource_Id {
+ path, has_path := obj.properties[property].(string)
+ if !has_path {
+ log.warnf("Property '%v' must be a path or string", property)
+ return nil
+ }
+ return path_to_resource_id[path]
+}