bevy/crates/bevy_ui/src
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
..
layout Fix errors in the doc comment for UiSurface::upsert_node. (#8796) 2023-06-09 11:59:57 +00:00
render UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
widget UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
accessibility.rs Move bevy_ui accessibility systems to PostUpdate. (#8653) 2023-05-23 23:50:48 +00:00
camera_config.rs bevy_ui: Add FromReflect derives (#8495) 2023-04-26 12:17:23 +00:00
focus.rs Perform relative_cursor_position calculation vectorwise in ui_focus_system (#8795) 2023-06-09 12:01:07 +00:00
geometry.rs Add UiRect::px() and UiRect::percent() utils (#8866) 2023-06-19 14:00:18 +00:00
lib.rs UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
measurement.rs Add FromReflect where Reflect is used (#8776) 2023-06-19 16:18:17 +00:00
node_bundles.rs UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
stack.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
ui_node.rs UI texture atlas support (#8822) 2023-06-19 21:52:02 +00:00
update.rs Split UI Overflow by axis (#8095) 2023-04-17 22:23:52 +00:00