viridia / quill

A reactive UI framework for Bevy
Apache License 2.0
125 stars 12 forks source link

Add ability to use `Handle<Image>` instead of `&str` when creating an `Icon` and related types #7

Closed favilo closed 3 months ago

favilo commented 3 months ago

I am using this crate in conjunction with bevy_asset_loader, and I would like to have a stronger type than just copying the &str around.

It would be really nice if we could just do something like:

#[derive(AssetCollection, Resource)]
pub struct TextureAssets {
    #[asset(path = "textures/icon.png")]
    pub icon: Handle<Image>,
}

And then use it just like this:

    let textures = cx.use_resource::<TextureAssets>();

    Icon::new(textures.icon.clone())