[][src]Crate nuuro_build

Nuuro-Build contains utilities for packing image atlases and other assets as part of the build script for a Nuuro application (see the "nuuro" crate).

The AssetPacker of Nuuro-Build should be invoked in a build script in a Nuuro application. Rust enums are generated to reference the packed assets.

Example build script

In the below example, the user should place sprite png files in the "sprites" directory, music ogg files in the "music" directory, and sound ogg files in the "sounds" directory.

extern crate nuuro_build;

use std::path::Path;
use std::env;
use nuuro_build::AssetPacker;

fn main() {
    let out_dir = env::var("OUT_DIR").unwrap();
    let gen_code_path = Path::new(&out_dir).join("asset_id.rs");

    let mut packer = AssetPacker::new(Path::new("assets"));
    packer.cargo_rerun_if_changed();
    packer.sprites(Path::new("sprites"));
    packer.music(Path::new("music"));
    packer.sounds(Path::new("sounds"));
    packer.gen_asset_id_code(&gen_code_path);
}

Structs

AssetPacker

Packs image atlases and other assets as part of the build script for a Nuuro application.