https://github.com/ickshonpe/bevymoduitextureatlas_image Draw images from texture atlases with the Bevy UI.
Supports Bevy 0.8
Cargo dependency:
toml
bevy_mod_ui_texture_atlas_image = "0.1"
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()
});
#
cargo --run --example minimal