added new batch build script for the test generator program & minor cleanup

This commit is contained in:
Stefan Stefanov 2024-04-21 14:31:12 +03:00
parent b839d631dd
commit 81d9632396
5 changed files with 9 additions and 11 deletions

1
.gitignore vendored
View file

@ -14,4 +14,5 @@ log.txt
linux linux
build/ build/
build_generator/
ols.json ols.json

12
.vscode/tasks.json vendored
View file

@ -57,15 +57,11 @@
}, },
}, },
{ {
"label": "Build&Run Tile Generator Test", "label": "Build&Run Atlas Generator Test",
"type": "shell", "type": "shell",
"command": "odin run", "windows": {
"args": [ "command": "${workspaceFolder}/scripts/build_generator_debug.bat && build_generator\\aseprite_odin_generator.exe",
"src/aseprite_odin_generator", },
"-define:RAYLIB_SHARED=true",
"-out:build_generator/aseprite_odin_generator.exe",
"-debug"
],
"options": { "options": {
"cwd": "${workspaceFolder}" "cwd": "${workspaceFolder}"
}, },

View file

@ -1,2 +1,2 @@
@echo off @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

View file

@ -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

View file

@ -80,7 +80,6 @@ pack_atlas_entries :: proc(
offset_y: int = 0, 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 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 { for entry in entries {
append(&all_entries, ..entry.cells[:]) append(&all_entries, ..entry.cells[:])
@ -117,7 +116,7 @@ pack_atlas_entries :: proc(
ctx: stbrp.Context ctx: stbrp.Context
stbrp.init_target(&ctx, atlas.width, atlas.height, &nodes[0], auto_cast num_entries) 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) res := stbrp.pack_rects(&ctx, &rects[0], auto_cast num_entries)
if bool(res) { if res == 1 {
fmt.println("Packed everything successfully!") fmt.println("Packed everything successfully!")
fmt.printfln("Rects: {0}", rects[:]) fmt.printfln("Rects: {0}", rects[:])
} else { } else {