Spak

Usage

You can always refer to the help with spak --help.

The CLI has two commands:

spak parse-single

Takes 1 Argument, a path to a folder containing one or more sprites (aka. images) of the same size. It will generate an output spritesheet with the same name as the input folder + how many sprites per row and how many rows are present in the spritesheet as well as the dimensions of an individual sprite.

Example: Given the following folder structure:

text Star1 ├── star1-01.png ├── star1-02.png ├── star1-03.png ├── star1-04.png ├── star1-05.png ├── star1-06.png ├── star1-07.png ├── star1-08.png ├── star1-09.png ├── star1-10.png ├── star1-11.png ├── star1-12.png ├── star1-13.png ├── star1-14.png ├── star1-15.png ├── star1-16.png └── star1-17.png

Assuming each sprite is 60x60 pixels.

spak parse-single ./Star1 will output a spritesheet called Star1-5x4-(60x60).png

The output spritesheet is read from left to right and from top to bottom. The last row can contain empty pixels.

spak parse-multiple

Takes 1 Argument, a path to a directory.

This command runs spak parse-single on each subdirectory contained in the specified directory.

Project Structure

src/main.rs

Contains the CLI for spak. It uses the processor library under the hood for operations.

src/processor.rs

Contains the logic that performs sprite generation.

Build Instructions

To build the CLI, run cargo build -r

Cross-Compiling

MacOS -> Windows x86

Make sure the cross-compilation toolchain is installed

brew install mingw-w64

Then run:

cargo build -r --target x86_64-pc-windows-gnu