#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

#8 in #texture

Download history 2/week @ 2019-04-28 9/week @ 2019-05-05 17/week @ 2019-05-12 19/week @ 2019-05-19 66/week @ 2019-05-26 19/week @ 2019-06-02 10/week @ 2019-06-09 18/week @ 2019-06-16 129/week @ 2019-06-23 71/week @ 2019-06-30 28/week @ 2019-07-07 1/week @ 2019-07-14 9/week @ 2019-07-28 9/week @ 2019-08-04

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

~4MB
~102K SLoC