Crates.io | strawberride |
lib.rs | strawberride |
version | 0.1.2 |
source | src |
created_at | 2024-08-24 20:40:23.243174 |
updated_at | 2024-08-25 01:46:07.236145 |
description | A Celeste map serializer and deserializer. |
homepage | |
repository | https://github.com/balt-dev/strawberride |
max_upload_size | |
id | 1350549 |
size | 64,379 |
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();