strawberride

Crates.iostrawberride
lib.rsstrawberride
version0.1.2
sourcesrc
created_at2024-08-24 20:40:23.243174
updated_at2024-08-25 01:46:07.236145
descriptionA Celeste map serializer and deserializer.
homepage
repositoryhttps://github.com/balt-dev/strawberride
max_upload_size
id1350549
size64,379
Balt (balt-dev)

documentation

https://docs.rs/strawberride

README

strawberride

Passing Tests Documentation Repository Latest version License Maintenance

This is a library for loading and saving Celeste maps from files, including high-level representations of map objects like levels, entities, decals, tilemaps, and more!

This is focused on accuracy and ergonomics, being able to losslessly load and save any map as needed.

/// Rotate all levels in the map 180 degrees
let mut f = File::options()
    .read(true)
    .write(true)
    .open("map.bin").unwrap();
let mut map = Map::load(&mut f, true).unwrap();

for level in map.levels.iter_mut() {
    let tilemap = &mut level.solids;
    let width = tilemap.width();
    let height = tilemap.height();

    for y in 0..(height / 2) {
        for x in 0..width {
            let src = tilemap[(x, y)];
            let dst = tilemap[(width - x - 1, height - y - 1)];
            tilemap[(x, y)] = dst;
            tilemap[(width - x - 1, height - y - 1)] = src;
        }
    }
}

f.seek(SeekFrom::Start(0)).unwrap();

map.store(&mut f, true).unwrap();
Commit count: 0

cargo fmt