bevy/crates/bevy_text/src
Aevyrie b3aff9a7b1 Add docs and common helper functions to Windows (#4107)
# Objective

- Improve documentation.
- Provide helper functions for common uses of `Windows` relating to getting the primary `Window`.
- Reduce repeated `Window` code.

# Solution

- Adds infallible `primary()` and `primary_mut()` functions with standard error text. This replaces the commonly used `get_primary().unwrap()` seen throughout bevy which has inconsistent or nonexistent error messages.
- Adds `scale_factor(WindowId)` to replace repeated code blocks throughout.

# Considerations

- The added functions can panic if the primary window does not exist.
    - It is very uncommon for the primary window to not exist, as seen by the regular use of `get_primary().unwrap()`. Most users will have a single window and will need to reference the primary window in their code multiple times.
    - The panic provides a consistent error message to make this class of error easy to spot from the panic text.
    - This follows the established standard of short names for infallible-but-unlikely-to-panic functions in bevy.
- Removes line noise for common usage of `Windows`.
2022-03-08 00:46:04 +00:00
..
error.rs Fix errors and panics to typical Rust conventions (#968) 2020-12-02 11:31:16 -08:00
font.rs small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
font_atlas.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
font_atlas_set.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
font_loader.rs Add support for OTF fonts (#1200) 2021-01-03 12:10:23 -08:00
glyph_brush.rs small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
lib.rs Add headless mode (#3439) 2022-01-08 10:39:43 +00:00
pipeline.rs small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
text.rs Add FromReflect trait to convert dynamic types to concrete types (#1395) 2021-12-26 18:49:01 +00:00
text2d.rs Add docs and common helper functions to Windows (#4107) 2022-03-08 00:46:04 +00:00