Crate strawberride

Crate strawberride 

Source
Expand description

§strawberride


This is a library for loading and saving Celeste maps from files, including high-level representations of map objects like Level, Entity, Decal, and Tilemap.

/// 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.get(x, y).unwrap();
            let dst = *tilemap.get(width - x - 1, height - y - 1).unwrap();
            *tilemap.get_mut(x, y).unwrap() = dst;
            *tilemap.get_mut(width - x - 1, height - y - 1).unwrap() = src;
        }
    }
}

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

map.store(&mut f, true).unwrap();

Macros§

attributes
Syntactic sugar for defining the attributes of an Element.

Structs§

Decal
A decal inside a Level.
Element
An element of a map.
Entity
An entity inside a Level.
Filler
A filler rectangle.
Level
A single level within a map.
LevelData
A struct that holds the (large amount of) metadata within a Level.
Map
A Celeste custom map.
Tilemap
A 2-dimensional tilemap for use in Celeste levels.

Enums§

LoadError
Something that can go wrong when loading a map.
Value
A value that can appear in the attributes of an element.

Traits§

MapElement
Dictates an object as part of a map.