Crate sheety

Source
Expand description

sheety can be used to manipulate sprite sheets. A sprite sheet can be created using SpriteSheet. SpriteSheet::new creates a new empty sprite sheet, where SpriteSheet::load_div and SpriteSheet::load_cell_size are used to load a sheet from disk.

§Example

This is one of this crates examples - it concatenates to existing sprite sheets into a single.

SpriteSheet::concat(
    vec![
        SpriteSheet::load_cell_size("sheety/tests/machete_idle.png", (256, 256))
            .unwrap()
            .into_unordered()
            .unwrap(),
        SpriteSheet::load_cell_size("sheety/tests/machete_swing01.png", (256, 256))
            .unwrap()
            .into_unordered()
            .unwrap(),
    ]
    .into_iter(),
    Distribution::Packed(false),
)
.unwrap()
.save("sheety/tests/result_machete.png")
.unwrap();

Modules§

error
Contains all error-related types.

Structs§

Sprite
Wrapper around image::RgbaImage that allows use with SpriteSheet and UnorederedSpriteSheet
SpriteSheet
An ordered sprite sheet. Contains a 2 dimensions array of SpriteCells.
UnorderedSpriteSheet
An UnorderedSpriteSheet encapsulate a list of Sprites. It can be optained from a SpriteSheet by using SpriteSheet::into_unordered, or can be created from a Vec of Sprites.

Enums§

Distribution
Reprensents a constraint to follow when building SpriteSheet from an UnorderedSpriteSheet.
SpriteCell
Represents a cell of a SpriteSheet. It can either be Empty, or contain a Sprite.