From 0bf86ef7b8f0ecad958f3fb592ceaf3d2f30336a Mon Sep 17 00:00:00 2001 From: iamcheeseman <[hidden email]> Date: Tue, 13 Jan 2026 22:28:59 -0500 Subject: add support for tiled objects --- tools/compile_assets/main.odin | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'tools/compile_assets/main.odin') diff --git a/tools/compile_assets/main.odin b/tools/compile_assets/main.odin index e33dc37..ea1ff90 100644 --- a/tools/compile_assets/main.odin +++ b/tools/compile_assets/main.odin @@ -33,6 +33,9 @@ Room_Id :: enum { Tileset_Id :: enum { } +Object_Type :: enum { +} + Resource_Id :: union { Image_Id, Animation_Id, @@ -46,8 +49,6 @@ images: [Image_Id]Image_Resource = { animations: [Animation_Id]Animation_Resource = { } -//odinfmt: disable - rooms: [Room_Id]Room_Resource = { } @@ -57,8 +58,6 @@ tilesets: [Tileset_Id]Tileset_Resource = { tiles: []Tile_Resource = { } -//odinfmt: enable - world: []Room_Position_Resource = { } @@ -79,6 +78,9 @@ tilesets: map[string]string world: [dynamic]string +// Don't want to add types multiple times, so it's a set +object_type_names: map[string]struct{} + output_dir: string paths_to_res_type: map[string]string @@ -355,6 +357,26 @@ main :: proc() { } content = set_placeholder(content, "", res_paths) + object_type_enum := "" + + for object_type in object_type_names { + object_type_enum = strings.concatenate({ + object_type_enum, + " ", + object_type, + ",\n" + }, allocator = context.temp_allocator) + + delete(object_type) + } + + content, _ = strings.replace_all( + content, + "", + object_type_enum, + allocator = context.temp_allocator, + ) + os.write_string(output_file, content) for image in images { @@ -369,4 +391,3 @@ main :: proc() { free_all(context.temp_allocator) } - -- cgit v1.3-2-g0d8e