#sprite-sheet #texture #packer #atlas

spritesheet-generator

A spritesheet generator library using the piston's texture_packer

9 unstable releases (4 breaking)

Uses old Rust 2015

0.5.0 Jun 4, 2019
0.4.0 Oct 13, 2018
0.3.4 Oct 3, 2018
0.3.3 Jul 5, 2018
0.1.0 Jul 3, 2018

#1221 in Game dev

MIT license

25KB
245 lines

spritesheet-generator

Build Status

A spritesheet generator library using the piston's texture_packer, this lib provides the packed image and a json with all information following the codeandweb's Texture Packer basic format.

Usage

Add the crate named spritesheet-generator to your dependencies in Cargo.toml:

[dependencies]
spritesheet-generator = "0.5"

Code Sample

To export the spritesheet:

extern crate spritesheet_generator;
use spritesheet_generator::spritesheet_generator::generate;
use spritesheet_generator::spritesheet_generator_config::SpritesheetGeneratorConfig;

fn main() {
    let config = SpritesheetGeneratorConfig {
        max_width: 500,
        max_height: 500,
        border_padding: 4,
        input_folder: "examples/assets/".to_string(),
        output_folder: "examples/resources/".to_string(),
        output_file_name: "example".to_string(),
        allow_rotation: false,
    };
    generate(config);
}

Example

To test the sample code, run the code below from the project directory.

# Be sure you're running this code at the root of the project directory!
cargo run --example generate-test

Credits

Dependencies

~16MB
~121K SLoC