mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 14:40:19 +00:00
b3aff9a7b1
# 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`. |
||
---|---|---|
.. | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_crevice | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_gilrs | ||
bevy_gltf | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_pbr | ||
bevy_reflect | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |