bevy/examples/stress_tests
Ben Frankel e8ae0d6c49
Decouple BackgroundColor from UiImage (#11165)
# Objective

Fixes https://github.com/bevyengine/bevy/issues/11157.

## Solution

Stop using `BackgroundColor` as a color tint for `UiImage`. Add a
`UiImage::color` field for color tint instead. Allow a UI node to
simultaneously include a solid-color background and an image, with the
image rendered on top of the background (this is already how it works
for e.g. text).


![2024-02-29_1709239666_563x520](https://github.com/bevyengine/bevy/assets/12173779/ec50c9ef-4c7f-4ab8-a457-d086ce5b3425)

---

## Changelog

- The `BackgroundColor` component now renders a solid-color background
behind `UiImage` instead of tinting its color.
- Removed `BackgroundColor` from `ImageBundle`, `AtlasImageBundle`, and
`ButtonBundle`.
- Added `UiImage::color`.
- Expanded `RenderUiSystem` variants.
- Renamed `bevy_ui::extract_text_uinodes` to `extract_uinodes_text` for
consistency.

## Migration Guide

- `BackgroundColor` no longer tints the color of UI images. Use
`UiImage::color` for that instead.
- For solid color buttons, replace `ButtonBundle { background_color:
my_color.into(), ... }` with `ButtonBundle { image:
UiImage::default().with_color(my_color), ... }`, and update button
interaction systems to use `UiImage::color` instead of `BackgroundColor`
as well.
- `bevy_ui::RenderUiSystem::ExtractNode` has been split into
`ExtractBackgrounds`, `ExtractImages`, `ExtractBorders`, and
`ExtractText`.
- `bevy_ui::extract_uinodes` has been split into
`bevy_ui::extract_uinode_background_colors` and
`bevy_ui::extract_uinode_images`.
- `bevy_ui::extract_text_uinodes` has been renamed to
`extract_uinode_text`.
2024-03-03 21:35:50 +00:00
..
bevymark.rs Add size and physical_size to window (#12238) 2024-03-01 22:28:37 +00:00
many_animated_sprites.rs Deprecate SpriteSheetBundle and AtlasImageBundle (#12218) 2024-03-03 20:11:15 +00:00
many_buttons.rs Decouple BackgroundColor from UiImage (#11165) 2024-03-03 21:35:50 +00:00
many_cubes.rs Intern mesh vertex buffer layouts so that we don't have to compare them over and over. (#12216) 2024-03-01 20:56:21 +00:00
many_foxes.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
many_gizmos.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
many_glyphs.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
many_lights.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
many_sprites.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
README.md Add a stress test profile (#6901) 2022-12-20 15:59:41 +00:00
text_pipeline.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
transform_hierarchy.rs Remove some old references to CoreSet (#9833) 2023-09-18 01:07:11 +00:00
warning_string.txt Added performance warning when running stress test examples in debug mode (#5029) 2022-07-13 19:13:46 +00:00

Stress tests

These examples are used to stress test Bevy's performance in various ways. These should be run with the "stress-test" profile to accurately represent performance in production, otherwise they will run in cargo's default "dev" profile which is very slow.

Example Command

cargo run --profile stress-test --example <EXAMPLE>