bevy/crates
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
..
bevy_app remove Events from bevy_app, they now live in bevy_ecs (#4066) 2022-03-01 19:33:56 +00:00
bevy_asset iter_mut on Assets: send modified event only when asset is iterated over (#3565) 2022-03-05 21:25:30 +00:00
bevy_audio Audio control - play, pause, volume, speed, loop (#3948) 2022-03-01 01:12:11 +00:00
bevy_core Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_core_pipeline Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_crevice Don't panic in macro shape validation (#3647) 2022-01-15 22:14:43 +00:00
bevy_derive small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_diagnostic small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_dylib Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_dynamic_plugin Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_ecs Add clear_schedule (#3941) 2022-03-05 21:53:17 +00:00
bevy_ecs_compile_fail_tests Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_gilrs remove Events from bevy_app, they now live in bevy_ecs (#4066) 2022-03-01 19:33:56 +00:00
bevy_gltf Mesh vertex buffer layouts (#3959) 2022-02-23 23:21:13 +00:00
bevy_input remove Events from bevy_app, they now live in bevy_ecs (#4066) 2022-03-01 19:33:56 +00:00
bevy_internal default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
bevy_log Example of module-level log usage and RUST_LOG usage in main doc (#3919) 2022-03-05 03:00:31 +00:00
bevy_macro_utils small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_math Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
bevy_pbr StandardMaterial: expose a cull_mode option (#3982) 2022-03-05 03:37:23 +00:00
bevy_reflect Add Reflect support for DMat3, DMat4, DQuat (#4128) 2022-03-08 00:14:21 +00:00
bevy_render Add conversions from Color to u32 (#4088) 2022-03-08 00:46:03 +00:00
bevy_scene remove Events from bevy_app, they now live in bevy_ecs (#4066) 2022-03-01 19:33:56 +00:00
bevy_sprite Make get_resource (and friends) infallible (#4047) 2022-02-27 22:37:18 +00:00
bevy_tasks small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_text Add docs and common helper functions to Windows (#4107) 2022-03-08 00:46:04 +00:00
bevy_transform small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
bevy_ui Add docs and common helper functions to Windows (#4107) 2022-03-08 00:46:04 +00:00
bevy_utils default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
bevy_window Add docs and common helper functions to Windows (#4107) 2022-03-08 00:46:04 +00:00
bevy_winit Add docs and common helper functions to Windows (#4107) 2022-03-08 00:46:04 +00:00