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.
Add the crate named spritesheet-generator
to your dependencies in Cargo.toml
:
ignore
[dependencies]
spritesheet-generator = "0.4"
To export the spritesheet: ```rust extern crate spritesheetgenerator; use spritesheetgenerator::spritesheetgenerator::generate; use spritesheetgenerator::spritesheetgeneratorconfig::SpritesheetGeneratorConfig;
fn main() { let config = SpritesheetGeneratorConfig { maxwidth: 500, maxheight: 500, borderpadding: 4, inputfolder: "examples/assets/".tostring(), outputfolder: "examples/resources/".tostring(), outputfilename: "example".tostring(), }; generate(config); } ```
To test the sample code, run the code below from the project directory. ```bash
cargo run --example generate-test ```