Skip to content

Array syntax in RON dynamic collections? #78

@inodentry

Description

@inodentry

Would it be possible to do something like this?

#[derive(AssetCollection)]
struct SpriteAnimationSequences {
    // maybe this needs a new attribute?
    // `collection(array)` or something,
    // to distinguish from `Files`
    #[asset(key = "anim.jumps", collection(typed)]
    jumps: Vec<Handle<TextureAtlas>>,
}
({
    // just use RON "array syntax"
    // to list as many items as we need
    "anim.jumps": [
        TextureAtlas (
            path: "jump_long.png",
            tile_size_x: 24.,
            tile_size_y: 32.,
            columns: 16,
            rows: 1,
        ),
        TextureAtlas (
            path: "jump_med.png",
            tile_size_x: 24.,
            tile_size_y: 32.,
            columns: 12,
            rows: 1,
        ),
        TextureAtlas (
            path: "jump_short.png",
            tile_size_x: 24.,
            tile_size_y: 32.,
            columns: 8,
            rows: 1,
        ),
    ],
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions