diff --git a/.gitignore b/.gitignore index 362a987..b467572 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ log.txt linux build/ +build_generator/ ols.json \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index edc8dcf..f7cc3f0 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -57,15 +57,11 @@ }, }, { - "label": "Build&Run Tile Generator Test", + "label": "Build&Run Atlas Generator Test", "type": "shell", - "command": "odin run", - "args": [ - "src/aseprite_odin_generator", - "-define:RAYLIB_SHARED=true", - "-out:build_generator/aseprite_odin_generator.exe", - "-debug" - ], + "windows": { + "command": "${workspaceFolder}/scripts/build_generator_debug.bat && build_generator\\aseprite_odin_generator.exe", + }, "options": { "cwd": "${workspaceFolder}" }, diff --git a/scripts/build_debug.bat b/scripts/build_debug.bat index ecaabef..2340f93 100644 --- a/scripts/build_debug.bat +++ b/scripts/build_debug.bat @@ -1,2 +1,2 @@ @echo off -odin build src/main_release -define:RAYLIB_SHARED=false -out:build/game_debug.exe -no-bounds-check -subsystem:windows -debug +odin build src/aseprite_odin_generator -define:RAYLIB_SHARED=true -out:build_generator/aseprite_odin_generator.exe -debug diff --git a/scripts/build_generator_debug.bat b/scripts/build_generator_debug.bat new file mode 100644 index 0000000..ecaabef --- /dev/null +++ b/scripts/build_generator_debug.bat @@ -0,0 +1,2 @@ +@echo off +odin build src/main_release -define:RAYLIB_SHARED=false -out:build/game_debug.exe -no-bounds-check -subsystem:windows -debug diff --git a/src/generator.odin b/src/generator.odin index 3886bc3..f75e568 100644 --- a/src/generator.odin +++ b/src/generator.odin @@ -80,7 +80,6 @@ pack_atlas_entries :: proc( offset_y: int = 0, ) { all_entries: [dynamic]rl.Image // it's fine to store it like this, rl.Image just stores a pointer to the data - // todo: set up the stb_rect_pack rectangles { for entry in entries { append(&all_entries, ..entry.cells[:]) @@ -117,7 +116,7 @@ pack_atlas_entries :: proc( ctx: stbrp.Context stbrp.init_target(&ctx, atlas.width, atlas.height, &nodes[0], auto_cast num_entries) res := stbrp.pack_rects(&ctx, &rects[0], auto_cast num_entries) - if bool(res) { + if res == 1 { fmt.println("Packed everything successfully!") fmt.printfln("Rects: {0}", rects[:]) } else {