aboutsummaryrefslogtreecommitdiff
path: root/src/assets.odin
diff options
context:
space:
mode:
authorXander Swan <[hidden email]>2026-01-07 23:12:22 -0500
committerXander Swan <[hidden email]>2026-01-07 23:12:22 -0500
commit0988ab832bfc7a1b1c851125b6172cf68c6d9cb9 (patch)
tree460bc2d9f0bce463af273d6b2b2c20faa880ac29 /src/assets.odin
parentade0dc4d257d053b7064184f193f8168c496e308 (diff)
doesn't compile but i'm commiting anywya
Diffstat (limited to 'src/assets.odin')
-rwxr-xr-xsrc/assets.odin78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/assets.odin b/src/assets.odin
new file mode 100755
index 0000000..e74dcf8
--- /dev/null
+++ b/src/assets.odin
@@ -0,0 +1,78 @@
+#+feature dynamic-literals
+package demonchime
+
+// DO NOT EDIT
+//
+// This file is autogenerated by tools/compile_assets
+// All resource types are defined in 'src/resources.odin'.
+
+import rl "vendor:raylib"
+
+Image_Id :: enum {
+ TILESETS,
+ PLAYER,
+}
+
+Animation_Id :: enum {
+ PLAYER,
+}
+
+Map_Id :: enum {
+ ROOM_BEGIN_1,
+ ROOM_BEGIN,
+}
+
+Tileset_Id :: enum {
+ TILESET,
+}
+
+Resource_Id :: union {
+ Image_Id,
+ Animation_Id,
+ Map_Id,
+ Tileset_Id,
+}
+
+images: [Image_Id]Image_Resource
+animations: [Animation_Id]Animation_Resource
+maps: [Map_Id]Map_Resource
+tilesets: [Tileset_Id]Tileset_Resource
+
+path_to_id: map[string]Resource_Id
+
+load_resources :: proc() {
+ load_images()
+ load_anims()
+ load_maps()
+ load_tilesets()
+
+ // Allow conversion from paths to a resource id, since it's a better way to
+ // reference resources in other resources (JSON is a good example).
+ path_to_id["res/tileset.tsj"] = Tileset_Id.TILESET
+ path_to_id["res/img/player.ase"] = Image_Id.PLAYER
+ path_to_id["res/img/tilesets.png"] = Image_Id.TILESETS
+ path_to_id["res/room_begin.tmj"] = Map_Id.ROOM_BEGIN
+ path_to_id["res/room_begin_1.tmj"] = Map_Id.ROOM_BEGIN_1
+}
+
+@(private="file")
+load_images :: proc() {
+ images[.TILESETS] = {data = #load("/home/xswan/demonchime/.compiled-res/tilesets.qoi")}
+ images[.PLAYER] = {data = #load("/home/xswan/demonchime/.compiled-res/player-sheet.qoi")}
+}
+
+@(private="file")
+load_anims :: proc() {
+ animations[.PLAYER] = {frame_count = 23, frame_durations = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}, tags = {"jump_trans"={from = 16, to = 16}, "jump_down"={from = 17, to = 18}, "idle"={from = 0, to = 5}, "sleep"={from = 19, to = 22}, "jump_up"={from = 14, to = 15}, "run"={from = 6, to = 13}}}
+}
+
+@(private="file")
+load_maps :: proc() {
+ maps[.ROOM_BEGIN_1] = #load("/home/xswan/demonchime/res/room_begin_1.tmj")
+ maps[.ROOM_BEGIN] = #load("/home/xswan/demonchime/res/room_begin.tmj")
+}
+
+@(private="file")
+load_tilesets :: proc() {
+ tilesets[.TILESET] = #load("/home/xswan/demonchime/res/tileset.tsj")
+}