bevy/examples/stress_tests
ira 9f906fdc8b Improve ergonomics and reduce boilerplate around creating text elements. (#5343)
# Objective

Creating UI elements is very boilerplate-y with lots of indentation.
This PR aims to reduce boilerplate around creating text elements.

## Changelog

* Renamed `Text::with_section` to `from_section`.
  It no longer takes a `TextAlignment` as argument, as the vast majority of cases left it `Default::default()`.
* Added `Text::from_sections` which creates a `Text` from a list of `TextSections`.
  Reduces line-count and reduces indentation by one level.
* Added `Text::with_alignment`.
  A builder style method for setting the `TextAlignment` of a `Text`.
* Added `TextSection::new`.
  Does not reduce line count, but reduces character count and made it easier to read. No more `.to_string()` calls!
* Added `TextSection::from_style` which creates an empty `TextSection` with a style.
  No more empty strings! Reduces indentation.
* Added `TextAlignment::CENTER` and friends.
* Added methods to `TextBundle`. `from_section`, `from_sections`, `with_text_alignment` and `with_style`.

## Note for reviewers.
Because of the nature of these changes I recommend setting diff view to 'split'.
~~Look for the book icon~~ cog in the top-left of the Files changed tab.

Have fun reviewing ❤️
<sup> >:D </sup>

## Migration Guide

`Text::with_section` was renamed to `from_section` and no longer takes a `TextAlignment` as argument.
Use `with_alignment` to set the alignment instead.

Co-authored-by: devil-ira <justthecooldude@gmail.com>
2022-07-20 14:14:29 +00:00
..
bevymark.rs Improve ergonomics and reduce boilerplate around creating text elements. (#5343) 2022-07-20 14:14:29 +00:00
many_animated_sprites.rs Add TextureAtlas stress test based on many_sprites and sprite_sheet examples (#5087) 2022-07-04 13:04:15 +00:00
many_cubes.rs Visibilty Inheritance, universal ComputedVisibility and RenderLayers support (#5310) 2022-07-15 23:24:42 +00:00
many_foxes.rs Add VisibilityBundle and use it to fix gltfs, scenes, and examples (#5335) 2022-07-16 02:47:23 +00:00
many_lights.rs update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
many_sprites.rs update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
README.md Added performance warning when running stress test examples in debug mode (#5029) 2022-07-13 19:13:46 +00:00
transform_hierarchy.rs Added performance warning when running stress test examples in debug mode (#5029) 2022-07-13 19:13:46 +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 --release argument to cargo or equivalent optimization, otherwise they will be very slow.