bevymoduitextureatlas_image

crates.io MIT/Apache 2.0 crates.io

Draw images from texture atlases with the Bevy UI.

image

Details

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

toml bevy_mod_ui_texture_atlas_image = "0.3"

or with Cargo:

cargo add bevy_mod_ui_texture_atlas_image

Components

Bundles

Plugin

The UiAtlasImagePlugin plugin must be added to your Bevy App:

```rust use bevymoduitextureatlas_image::*;

fn main () { App::new() .addplugins(DefaultPlugins) .addplugin(UiAtlasImagePlugin) // ..rest of app .run() } ```

Then you can spawn an AtlasImageBundle to draw images from a TextureAtlas with the Bevy UI: rust commands .spawn(AtlasImageBundle { atlas_image: UiAtlasImage { atlas: texture_atlas_handle.clone(), index: 5 }, ..Default::default() }); The differences between an AtlasImageBundle and an ImageBundle are that * Instead of a UiImage component, AtlasImageBundle has a UiAtlasImage component that sets the image displayed by the node. * Instead of a BackgroundColor component, AtlasImageBundle has an ImageTint component that sets the color tint of the image.

#

Examples