bevy/examples/ui
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
..
borders.rs Ui Node Borders (#7795) 2023-06-14 22:43:38 +00:00
button.rs Ui Node Borders (#7795) 2023-06-14 22:43:38 +00:00
flex_layout.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
font_atlas_debug.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
grid.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
overflow.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
overflow_debug.rs Remove outdated example code/comment (#8635) 2023-05-19 18:21:26 +00:00
relative_cursor_position.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
size_constraints.rs Require #[derive(Event)] on all Events (#7086) 2023-06-06 14:44:32 +00:00
text.rs Allow systems using Diagnostics to run in parallel (#8677) 2023-06-05 20:51:22 +00:00
text_debug.rs Allow systems using Diagnostics to run in parallel (#8677) 2023-06-05 20:51:22 +00:00
text_wrap_debug.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
transparency_ui.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
ui.rs Ui Node Borders (#7795) 2023-06-14 22:43:38 +00:00
ui_scaling.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00
ui_texture_atlas.rs UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
viewport_debug.rs Ui Node Borders (#7795) 2023-06-14 22:43:38 +00:00
window_fallthrough.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
z_index.rs Flatten UI Style properties that use Size + remove Size (#8548) 2023-05-16 01:36:32 +00:00