3 releases
0.1.2 | Aug 25, 2024 |
---|---|
0.1.1 | Aug 24, 2024 |
0.1.0 | Aug 24, 2024 |
#528 in Game dev
52 downloads per month
61KB
1.5K
SLoC
strawberride
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