bevymoduitextureatlas_image

crates.io MIT/Apache 2.0 crates.io

Draw images from texture atlases with the Bevy UI.

image

Supports Bevy 0.8 #

Details

To use, add this dependency to your project's Cargo.toml:

toml bevy_mod_ui_texture_atlas_image = "0.1"

Then add the UiAtlasImagePlugin plugin to your Bevy App:

rust App::new() .add_plugins(DefaultPlugins) .add_plugin(UiAtlasImagePlugin) // ..rest of app .run()

Now you can spawn an AtlasImageBundle to draw images from a TextureAtlas with the Bevy UI.

The only difference between AtlasImageBundle and ImageBundle is that instead of an image field with type UiImage, it has an atlas_image field with type UiAtlasImage.

rust commands .spawn_bundle(AtlasImageBundle { atlas_image: UiAtlasImage { atlas: texture_atlas_handle.clone(), index: 5 }, ..Default::default() }); #

Minimal Example

cargo --run --example minimal