#texture #packer #atlas #spritesheet

spritesheet-generator

A spritesheet generator library using the piston’s texture_packer

9 unstable releases (4 breaking)

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

#11 in Rendering engine

Download history 48/week @ 2019-03-26 8/week @ 2019-04-02 3/week @ 2019-04-09 10/week @ 2019-04-23 3/week @ 2019-04-30 16/week @ 2019-05-07 9/week @ 2019-05-14 27/week @ 2019-05-21 58/week @ 2019-05-28 20/week @ 2019-06-04 9/week @ 2019-06-11 23/week @ 2019-06-18 132/week @ 2019-06-25 64/week @ 2019-07-02

65 downloads per month

MIT license

25KB
245 lines

spritesheet-generator

Build Status Crate Version

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

~4.5MB
~87K SLoC