bevymoduitextureatlas_image

crates.io MIT/Apache 2.0 crates.io

Draw images from texture atlases with Bevy UI.

image

Supports Bevy 0.8

Cargo dependency: toml bevy_mod_ui_texture_atlas_image = "0.1"

Details

To use add the UiTextureAtlasImagePlugin plugin to your Bevy App:

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

Then you can spawn a TextureAtlasImageBundle to show images from texture atlases with the Bevy UI.

TextureAtlasImageBundle is no different than ImageBundle except instead of a UiImage it takes a UiTextureAtlasImage.

rust commands .spawn_bundle(TextureAtlasImageBundle { image: UiTextureAtlasImage { atlas: texture_atlas_handle.clone(), index: 5 }, ..Default::default() }); #

Minimal Example

cargo --run --example minimal