bevy/crates/bevy_ui/src/widget
mwbryant 8b5bf42c28
UI texture atlas support (#8822)
# Objective

This adds support for using texture atlas sprites in UI. From
discussions today in the ui-dev discord it seems this is a much wanted
feature.

This was previously attempted in #5070 by @ManevilleF however that was
blocked #5103. This work can be easily modified to support #5103 changes
after that merges.

## Solution

I created a new UI bundle that reuses the existing texture atlas
infrastructure. I create a new atlas image component to prevent it from
being drawn by the existing non-UI systems and to remove unused
parameters.

In extract I added new system to calculate the required values for the
texture atlas image, this extracts into the same resource as the
existing UI Image and Text components.

This should have minimal performance impact because if texture atlas is
not present then the exact same code path is followed. Also there should
be no unintended behavior changes because without the new components the
existing systems write the extract same resulting data.

I also added an example showing the sprite working and a system to
advance the animation on space bar presses.

Naming is hard and I would accept any feedback on the bundle name! 

---

## Changelog

>  Added TextureAtlasImageBundle

---------

Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
2023-06-19 21:52:02 +00:00
..
button.rs bevy_ui: Add FromReflect derives (#8495) 2023-04-26 12:17:23 +00:00
image.rs UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
label.rs bevy_ui: Add FromReflect derives (#8495) 2023-04-26 12:17:23 +00:00
mod.rs Integrate AccessKit (#6874) 2023-03-01 22:45:04 +00:00
text.rs Add FromReflect where Reflect is used (#8776) 2023-06-19 16:18:17 +00:00