Update dependencies, refresh README.md, add build scripts for linux(& macos?)
This commit is contained in:
parent
3f1c523ad9
commit
faf42da522
12 changed files with 53 additions and 158 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "vendors/odin-aseprite"]
|
||||||
|
path = vendors/odin-aseprite
|
||||||
|
url = git@github.com:blob1807/odin-aseprite.git
|
||||||
31
.vscode/launch.json
vendored
31
.vscode/launch.json
vendored
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "cppvsdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "Build Debug",
|
|
||||||
"name": "Debug",
|
|
||||||
"program": "${workspaceFolder}/build/game_debug.exe",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "cppvsdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "Build Release",
|
|
||||||
"name": "Release",
|
|
||||||
"program": "${workspaceFolder}/game_release.exe",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "cppvsdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "Run File",
|
|
||||||
"program": "odin",
|
|
||||||
"args": ["run", "${fileBasename}", "-file"],
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"[odin]": {
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.tabSize": 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
92
.vscode/tasks.json
vendored
92
.vscode/tasks.json
vendored
|
|
@ -1,92 +0,0 @@
|
||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"command": "",
|
|
||||||
"args": [],
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "Build Debug",
|
|
||||||
"type": "shell",
|
|
||||||
"windows": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_debug.bat"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_debug.sh"
|
|
||||||
},
|
|
||||||
"osx": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_debug.sh"
|
|
||||||
},
|
|
||||||
"group": {
|
|
||||||
"kind": "build",
|
|
||||||
"isDefault": true
|
|
||||||
},
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Build Release",
|
|
||||||
"type": "shell",
|
|
||||||
"windows": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_release.bat"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_release.sh"
|
|
||||||
},
|
|
||||||
"osx": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_release.sh"
|
|
||||||
},
|
|
||||||
"group": "build"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Clean build folder(s)",
|
|
||||||
"type": "shell",
|
|
||||||
"windows": {
|
|
||||||
"command": "cd ${workspaceFolder}\\build && rm game*; cd ${workspaceFolder} && rm aseprite_odin_generator*"
|
|
||||||
},
|
|
||||||
"group": "build"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Build Hot Reload",
|
|
||||||
"type": "shell",
|
|
||||||
"windows": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_hot_reload.bat; start game.exe"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_hot_reload.sh"
|
|
||||||
},
|
|
||||||
"osx": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_hot_reload.sh"
|
|
||||||
},
|
|
||||||
"presentation": {
|
|
||||||
"echo": true,
|
|
||||||
"reveal": "always",
|
|
||||||
"focus": false,
|
|
||||||
"panel": "dedicated",
|
|
||||||
"showReuseMessage": false,
|
|
||||||
"clear": true
|
|
||||||
},
|
|
||||||
"group": "build",
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Build&Run Atlas Generator Test",
|
|
||||||
"type": "shell",
|
|
||||||
"windows": {
|
|
||||||
"command": "${workspaceFolder}/scripts/build_generator_debug.bat && build_generator\\aseprite_odin_generator.exe -input-files:value_of_custom_arg -h"
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"cwd": "${workspaceFolder}"
|
|
||||||
},
|
|
||||||
"presentation": {
|
|
||||||
"echo": true,
|
|
||||||
"reveal": "always",
|
|
||||||
"focus": false,
|
|
||||||
"panel": "dedicated",
|
|
||||||
"showReuseMessage": false,
|
|
||||||
"clear": true
|
|
||||||
},
|
|
||||||
"group": {
|
|
||||||
"kind": "build",
|
|
||||||
"isDefault": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
31
README.md
31
README.md
|
|
@ -1,20 +1,29 @@
|
||||||
|
|
||||||
# YAAP
|
# YAAP
|
||||||
Yet-Another-Atlas-Packer by Stefan Stefanov
|
Yet-Another-Atlas-Packer by bersK (Stefan Stefanov)
|
||||||
|
|
||||||
|
## Usage & requirements
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Pull this repo with `--recursive`, the `odin-aseprite` library is pulled in as a submodule.
|
||||||
|
|
||||||
|
* At least odin compiler version `dev-2025-07:204edd0fc`
|
||||||
|
* Build the `libtinyfiledialog` library in the `vendors/dialog` fold
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
> [!NOTE]
|
||||||
|
> Quite frankly if you want automatic atlas packing I would suggest using `stb_rect_pack` directly & an aseprite plugin for exporting your assets in a proper format for packing. Using this atlas packer in an automated fashion is not quite possible and slower as a workflow. I would only use it for experiment projects or places where having a built in atlas packer is not practical.
|
||||||
|
|
||||||
Simple atlas packer for .aseprite files. Generates metadata and potentially embeds in an output source file of your choosing.
|
Simple atlas packer for `.aseprite` files. Generates a packed png & metadata in the form of json and/or source files(cpp, odin, etc...).
|
||||||
|
> [!CAUTION]
|
||||||
|
> Does not handle palette files currently.
|
||||||
|
|
||||||
Uses `stb_rect_pack` from the `stb` family of header libraries & `raylib` for rendering/UI. Here's a quick preview on [youtube](https://youtu.be/4_dKq7G57Lw) of the application.
|
Uses `stb_rect_pack` for the image packing & `raylib` for the UI.
|
||||||
|
|
||||||
|
A quick preview on [youtube](https://youtu.be/4_dKq7G57Lw).
|
||||||
|
|
||||||
<a href="https://youtu.be/4_dKq7G57Lw">
|
|
||||||
<img src="https://raw.githubusercontent.com/bersK/yaap/master/repo_assets/image.png" />
|
<img src="https://raw.githubusercontent.com/bersK/yaap/master/repo_assets/image.png" />
|
||||||
<a/>
|
|
||||||
|
|
||||||
The goal of the tool is to take in multiple aseprite files and pack them into a single atlas, outputting metadata in the process in the form of
|
## Dependencies
|
||||||
JSON and/or source files for direct use in odin (or other languages through a customization file).
|
* odin-aseprite [github](https://github.com/blob1807/odin-aseprite)
|
||||||
|
* raylib (`vendor/raylib`, [link](https://github.com/odin-lang/Odin/tree/master/vendor/raylib))
|
||||||
I'm using a library for marshalling the aseprite files found [here](https://github.com/blob1807/odin-aseprite) on github.
|
* stb_rect_pack (`vendor/stb/rect_pack`, [link](https://github.com/odin-lang/Odin/tree/master/vendor/stb/rect_pack))
|
||||||
|
|
||||||
Project template provided by Karl Zylinski found [here](https://github.com/karl-zylinski/odin-raylib-hot-reload-game-template) on github.
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import ase "../vendors/aseprite"
|
import ase "../../vendors/odin-aseprite"
|
||||||
import "core:encoding/json"
|
import "core:encoding/json"
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
import "core:os"
|
import "core:os"
|
||||||
|
|
|
||||||
5
scripts/build.sh
Normal file
5
scripts/build.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
FLAGS="-define:RAYLIB_SHARED=true -out:build/yaap -debug"
|
||||||
|
SRC=src/frontend
|
||||||
|
|
||||||
|
mkdir -p build
|
||||||
|
odin build ${SRC} ${FLAGS}
|
||||||
7
scripts/setup.sh
Normal file
7
scripts/setup.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
pushd vendors/dialog
|
||||||
|
sh build.sh
|
||||||
|
popd
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package generator
|
package generator
|
||||||
|
|
||||||
import ase "../../vendors/aseprite"
|
import ase "../../vendors/odin-aseprite"
|
||||||
import "core:encoding/json"
|
import "core:encoding/json"
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
import "core:log"
|
import "core:log"
|
||||||
|
|
@ -115,7 +115,7 @@ unmarshall_aseprite_files :: proc(
|
||||||
if extension != ".aseprite" do continue
|
if extension != ".aseprite" do continue
|
||||||
|
|
||||||
log.infof("Unmarshalling file: ", file)
|
log.infof("Unmarshalling file: ", file)
|
||||||
ase.unmarshal_from_filename(file, &aseprite_document, alloc)
|
ase.unmarshal_from_filename(&aseprite_document, file)
|
||||||
atlas_entry := atlas_entry_from_compressed_cells(aseprite_document)
|
atlas_entry := atlas_entry_from_compressed_cells(aseprite_document)
|
||||||
atlas_entry.path = file
|
atlas_entry.path = file
|
||||||
|
|
||||||
|
|
@ -147,7 +147,7 @@ atlas_entry_from_compressed_cells :: proc(document: ase.Document) -> (atlas_entr
|
||||||
|
|
||||||
cell := CellData {
|
cell := CellData {
|
||||||
img = rl.Image {
|
img = rl.Image {
|
||||||
data = rawptr(&cel_img.pixel[0]),
|
data = rawptr(&cel_img.pixels[0]),
|
||||||
width = auto_cast cel_img.width,
|
width = auto_cast cel_img.width,
|
||||||
height = auto_cast cel_img.height,
|
height = auto_cast cel_img.height,
|
||||||
format = .UNCOMPRESSED_R8G8B8A8,
|
format = .UNCOMPRESSED_R8G8B8A8,
|
||||||
|
|
|
||||||
1
vendors/aseprite
vendored
1
vendors/aseprite
vendored
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 628e655661d822fecae67cf238cbfa414912d943
|
|
||||||
2
vendors/dialog/build.sh
vendored
2
vendors/dialog/build.sh
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
gcc ./libtinyfiledialogs/tinyfiledialogs.c -c -o libtinyfiledialogs.o
|
gcc ./libtinyfiledialogs/tinyfiledialogs.c -c -o libtinyfiledialogs.o
|
||||||
|
|
||||||
|
|
|
||||||
1
vendors/odin-aseprite
vendored
Submodule
1
vendors/odin-aseprite
vendored
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 72ea2e8094a5f05074d4c4f2faafdba42e54673c
|
||||||
Loading…
Add table
Add a link
Reference in a new issue