@@ -85,13 +85,11 @@ impl Plugin for WinitPlugin {
85
85
app. init_non_send_resource :: < WinitWindows > ( )
86
86
. init_resource :: < WinitSettings > ( )
87
87
. set_runner ( winit_runner)
88
- // exit_on_all_closed only uses the query to determine if the query is empty,
89
- // and so doesn't care about ordering relative to changed_window
90
88
. add_systems (
91
89
Last ,
92
90
(
93
- // `exit_on_all_closed` seemingly conflicts with `changed_window`
94
- // but does not actually access any data (only checks if the query is empty)
91
+ // `exit_on_all_closed` only checks if windows exist but doesn't access data,
92
+ // so we don't need to care about its ordering relative to `changed_windows`
95
93
changed_windows. ambiguous_with ( exit_on_all_closed) ,
96
94
// apply all changes first, then despawn windows
97
95
despawn_windows. after ( changed_windows) ,
@@ -105,16 +103,16 @@ impl Plugin for WinitPlugin {
105
103
106
104
let event_loop = event_loop_builder. build ( ) ;
107
105
108
- // iOS, macOS, and Android don't like it if you create windows before the
109
- // event loop is initialized.
106
+ // iOS, macOS, and Android don't like it if you create windows before the event loop is
107
+ // initialized.
110
108
//
111
109
// See:
112
110
// - https://github.com/rust-windowing/winit/blob/master/README.md#macos
113
111
// - https://github.com/rust-windowing/winit/blob/master/README.md#ios
114
112
#[ cfg( not( any( target_os = "android" , target_os = "ios" , target_os = "macos" ) ) ) ]
115
113
{
116
- // Otherwise, we want to create a window before `bevy_render` initializes
117
- // the renderer so that we have a surface to use as a hint.
114
+ // Otherwise, we want to create a window before `bevy_render` initializes the renderer
115
+ // so that we have a surface to use as a hint.
118
116
// This improves compatibility with wgpu backends, especially WASM/WebGL2.
119
117
let mut create_windows = IntoSystem :: into_system ( create_windows :: < ( ) > ) ;
120
118
create_windows. initialize ( & mut app. world ) ;
@@ -242,7 +240,8 @@ unsafe fn transmute_to_static_ref<T>(r: &T) -> &'static T {
242
240
243
241
/// The default [`App::runner`] for the [`WinitPlugin`] plugin.
244
242
///
245
- /// Overriding the app's [runner](bevy_app::App::runner) while using `WinitPlugin` will bypass the `EventLoop`.
243
+ /// Overriding the app's [runner](bevy_app::App::runner) while using `WinitPlugin` will bypass the
244
+ /// `EventLoop`.
246
245
pub fn winit_runner ( mut app : App ) {
247
246
let mut event_loop = app
248
247
. world
@@ -450,9 +449,9 @@ pub fn winit_runner(mut app: App) {
450
449
let new_factor = window. resolution . scale_factor ( ) ;
451
450
452
451
if let Some ( forced_factor) = window. resolution . scale_factor_override ( ) {
453
- // This window is overriding the OS-suggested DPI, so its physical
454
- // size should be set based on the overriding value.
455
- // Its logical size already incorporates any resize constraints.
452
+ // This window is overriding the OS-suggested DPI, so its physical size
453
+ // should be set based on the overriding value. Its logical size already
454
+ // incorporates any resize constraints.
456
455
* new_inner_size =
457
456
winit:: dpi:: LogicalSize :: new ( window. width ( ) , window. height ( ) )
458
457
. to_physical :: < u32 > ( forced_factor) ;
0 commit comments