9 releases
0.1.5 | Apr 12, 2020 |
---|---|
0.1.4 | Apr 8, 2020 |
0.1.2 | Mar 31, 2020 |
0.0.5 | Mar 21, 2020 |
0.0.4 | Feb 27, 2020 |
#719 in Build Utils
38 downloads per month
62KB
1K
SLoC
Nuuro
Nuuro is specialized game development library.
When creating a game, it is good practice to make a layer, specific to one's needs, that separates the game logic from the resource management, rendering, audio, and other interfacing that is needed for a game.
Users of this crate should create a build script in their project, invoking functionality from the sibling crate "nuuro_build". This will generate texture atlases and enums to reference assets. See the "nuuro_build" crate for more details.
You can start with the nuuro template.
lib.rs
:
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);
}
Dependencies
~4.5MB
~86K SLoC