Skip to content

Commit

Permalink
more consistent comment spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
maniwani committed Jul 25, 2023
1 parent b0e9a30 commit a716fce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
23 changes: 11 additions & 12 deletions crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,11 @@ impl Plugin for WinitPlugin {
app.init_non_send_resource::<WinitWindows>()
.init_resource::<WinitSettings>()
.set_runner(winit_runner)
// exit_on_all_closed only uses the query to determine if the query is empty,
// and so doesn't care about ordering relative to changed_window
.add_systems(
Last,
(
// `exit_on_all_closed` seemingly conflicts with `changed_window`
// but does not actually access any data (only checks if the query is empty)
// `exit_on_all_closed` only checks if windows exist but doesn't access data,
// so we don't need to care about its ordering relative to `changed_windows`
changed_windows.ambiguous_with(exit_on_all_closed),
// apply all changes first, then despawn windows
despawn_windows.after(changed_windows),
Expand All @@ -105,16 +103,16 @@ impl Plugin for WinitPlugin {

let event_loop = event_loop_builder.build();

// iOS, macOS, and Android don't like it if you create windows before the
// event loop is initialized.
// iOS, macOS, and Android don't like it if you create windows before the event loop is
// initialized.
//
// See:
// - https://github.com/rust-windowing/winit/blob/master/README.md#macos
// - https://github.com/rust-windowing/winit/blob/master/README.md#ios
#[cfg(not(any(target_os = "android", target_os = "ios", target_os = "macos")))]
{
// Otherwise, we want to create a window before `bevy_render` initializes
// the renderer so that we have a surface to use as a hint.
// Otherwise, we want to create a window before `bevy_render` initializes the renderer
// so that we have a surface to use as a hint.
// This improves compatibility with wgpu backends, especially WASM/WebGL2.
let mut create_windows = IntoSystem::into_system(create_windows::<()>);
create_windows.initialize(&mut app.world);
Expand Down Expand Up @@ -242,7 +240,8 @@ unsafe fn transmute_to_static_ref<T>(r: &T) -> &'static T {

/// The default [`App::runner`] for the [`WinitPlugin`] plugin.
///
/// Overriding the app's [runner](bevy_app::App::runner) while using `WinitPlugin` will bypass the `EventLoop`.
/// Overriding the app's [runner](bevy_app::App::runner) while using `WinitPlugin` will bypass the
/// `EventLoop`.
pub fn winit_runner(mut app: App) {
let mut event_loop = app
.world
Expand Down Expand Up @@ -450,9 +449,9 @@ pub fn winit_runner(mut app: App) {
let new_factor = window.resolution.scale_factor();

if let Some(forced_factor) = window.resolution.scale_factor_override() {
// This window is overriding the OS-suggested DPI, so its physical
// size should be set based on the overriding value.
// Its logical size already incorporates any resize constraints.
// This window is overriding the OS-suggested DPI, so its physical size
// should be set based on the overriding value. Its logical size already
// incorporates any resize constraints.
*new_inner_size =
winit::dpi::LogicalSize::new(window.width(), window.height())
.to_physical::<u32>(forced_factor);
Expand Down
20 changes: 10 additions & 10 deletions crates/bevy_winit/src/winit_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ pub struct WinitSettings {
/// - If this value is set to `true`, [`run_return`] is called, and exiting the loop will
/// return control to the caller.
///
/// **NOTE:** This cannot be changed while the loop is running. `winit` discourages use of `run_return`.
/// **NOTE:** This cannot be changed while the loop is running. `winit` discourages use of
/// `run_return`.
///
/// # Supported platforms
///
Expand Down Expand Up @@ -84,16 +85,15 @@ impl Default for WinitSettings {
/// Determines how frequently an [`App`](bevy_app::App) should update.
///
/// **NOTE:** This setting is independent of VSync. VSync is controlled by a window's
/// [`PresentMode`](bevy_window::PresentMode) setting. If an app can update faster than
/// the refresh rate, but VSync is enabled, the update rate will be indirectly limited
/// by the renderer.
/// [`PresentMode`](bevy_window::PresentMode) setting. If an app can update faster than the refresh
/// rate, but VSync is enabled, the update rate will be indirectly limited by the renderer.
#[derive(Debug, Clone, Copy)]
pub enum UpdateMode {
/// The [`App`](bevy_app::App) will update over and over, as fast as it possibly can,
/// until an [`AppExit`](bevy_app::AppExit) event appears.
/// The [`App`](bevy_app::App) will update over and over, as fast as it possibly can, until an
/// [`AppExit`](bevy_app::AppExit) event appears.
Continuous,
/// The [`App`](bevy_app::App) will update in response to the following,
/// until an [`AppExit`](bevy_app::AppExit) event appears:
/// The [`App`](bevy_app::App) will update in response to the following, until an
/// [`AppExit`](bevy_app::AppExit) event appears:
/// - enough time has elapsed since the previous update
/// - a redraw is requested
/// - new window or device events have appeared
Expand All @@ -104,8 +104,8 @@ pub enum UpdateMode {
/// The [`App`](bevy_app::App) will wait forever if you set this to [`Duration::MAX`].
wait: Duration,
},
/// The [`App`](bevy_app::App) will update in response to the following,
/// until an [`AppExit`](bevy_app::AppExit) event appears:
/// The [`App`](bevy_app::App) will update in response to the following, until an
/// [`AppExit`](bevy_app::AppExit) event appears:
/// - enough time has elapsed since the previous update
/// - a redraw is requested
/// - new window events have appeared
Expand Down

0 comments on commit a716fce

Please sign in to comment.