3 releases

0.1.2 Aug 25, 2024
0.1.1 Aug 24, 2024
0.1.0 Aug 24, 2024

#528 in Game dev

Download history 350/week @ 2024-08-22 21/week @ 2024-08-29 26/week @ 2024-09-12 15/week @ 2024-09-19 38/week @ 2024-09-26 34/week @ 2024-10-03 3/week @ 2024-10-10

52 downloads per month

MIT license

61KB
1.5K SLoC

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();

Dependencies

~1.5MB
~25K SLoC