NOTE: JamPack is currently being made as a highschooler's hobby project. Suggestions are very much appreciated!
JamPack is a lightweight, asynchronous and extensible asset framework made for use in games and apps. By default, it doesn't come with any encoders or decoders, but it's easy to make your own!
To decode assets at runtime, you can open a jar, which you can unpack in order to receive it's raw asset data.
Rust
fn main() {
let my_asset = jampack::jar("res/image")
.unwrap();
let data = my_asset.unpack();
}
If the data type you want to decode implements the Jam
trait, it can be done automatically!
```Rust
use jampack::Jam;
fn main() {
let myasset = jampack::open
struct MyType {}
impl Jam for MyType {
fn unjar(ty: u8, data: Vec
Encoding data is done using a stove, which uses recipes in order to cook asset files. If the original asset hasn't been modified, it will skip it. It will also automatically remove deleted files.
The recommended use of a stove is in build scripts.
```Rust // build.rs const INPUTDIR: &str = "./res-src"; const OUTDIR: &str = "./res";
fn main() { let stove = jampack::Stove::new() .unwrap() .withrecipe(passthroughrecipe());
stove.cook(INPUT_DIR, OUT_DIR);
}
fn passthrough_recipe() -> jampack::Recipe {
fn bake(data: Vec