Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7 (#6218)
# Objective
- Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7.
## Solution
---
## Changelog
### Changed
- Changed `RawWindowHandleWrapper` to `RawHandleWrapper` which wraps both `RawWindowHandle` and `RawDisplayHandle`, which satisfies the `impl HasRawWindowHandle and HasRawDisplayHandle` that `wgpu` 0.14.0 requires.
- Changed `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, change its type from `bool` to `bevy_window::CursorGrabMode`.
## Migration Guide
- Adjust usage of `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, and adjust its type from `bool` to `bevy_window::CursorGrabMode`.
2022-10-19 17:40:23 +00:00
|
|
|
use crate::converters::convert_cursor_grab_mode;
|
2022-09-06 14:45:44 +00:00
|
|
|
use bevy_math::{DVec2, IVec2};
|
|
|
|
use bevy_utils::HashMap;
|
Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7 (#6218)
# Objective
- Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7.
## Solution
---
## Changelog
### Changed
- Changed `RawWindowHandleWrapper` to `RawHandleWrapper` which wraps both `RawWindowHandle` and `RawDisplayHandle`, which satisfies the `impl HasRawWindowHandle and HasRawDisplayHandle` that `wgpu` 0.14.0 requires.
- Changed `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, change its type from `bool` to `bevy_window::CursorGrabMode`.
## Migration Guide
- Adjust usage of `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, and adjust its type from `bool` to `bevy_window::CursorGrabMode`.
2022-10-19 17:40:23 +00:00
|
|
|
use bevy_window::{
|
2022-10-31 16:12:18 +00:00
|
|
|
CursorGrabMode, MonitorSelection, RawHandleWrapper, Window, WindowDescriptor, WindowId,
|
|
|
|
WindowMode,
|
Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7 (#6218)
# Objective
- Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7.
## Solution
---
## Changelog
### Changed
- Changed `RawWindowHandleWrapper` to `RawHandleWrapper` which wraps both `RawWindowHandle` and `RawDisplayHandle`, which satisfies the `impl HasRawWindowHandle and HasRawDisplayHandle` that `wgpu` 0.14.0 requires.
- Changed `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, change its type from `bool` to `bevy_window::CursorGrabMode`.
## Migration Guide
- Adjust usage of `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, and adjust its type from `bool` to `bevy_window::CursorGrabMode`.
2022-10-19 17:40:23 +00:00
|
|
|
};
|
|
|
|
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
2022-09-06 14:45:44 +00:00
|
|
|
use winit::{
|
|
|
|
dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize},
|
|
|
|
window::Fullscreen,
|
|
|
|
};
|
2020-03-30 21:53:32 +00:00
|
|
|
|
2020-10-08 18:43:01 +00:00
|
|
|
#[derive(Debug, Default)]
|
2020-03-30 21:53:32 +00:00
|
|
|
pub struct WinitWindows {
|
|
|
|
pub windows: HashMap<winit::window::WindowId, winit::window::Window>,
|
|
|
|
pub window_id_to_winit: HashMap<WindowId, winit::window::WindowId>,
|
|
|
|
pub winit_to_window_id: HashMap<winit::window::WindowId, WindowId>,
|
2022-02-24 01:40:02 +00:00
|
|
|
// Some winit functions, such as `set_window_icon` can only be used from the main thread. If
|
|
|
|
// they are used in another thread, the app will hang. This marker ensures `WinitWindows` is
|
|
|
|
// only ever accessed with bevy's non-send functions and in NonSend systems.
|
|
|
|
_not_send_sync: core::marker::PhantomData<*const ()>,
|
2020-03-30 21:53:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl WinitWindows {
|
|
|
|
pub fn create_window(
|
|
|
|
&mut self,
|
|
|
|
event_loop: &winit::event_loop::EventLoopWindowTarget<()>,
|
2020-12-13 23:05:56 +00:00
|
|
|
window_id: WindowId,
|
|
|
|
window_descriptor: &WindowDescriptor,
|
|
|
|
) -> Window {
|
2020-08-13 08:47:40 +00:00
|
|
|
let mut winit_window_builder = winit::window::WindowBuilder::new();
|
2020-08-13 06:18:10 +00:00
|
|
|
|
2022-09-06 14:45:44 +00:00
|
|
|
let &WindowDescriptor {
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
position,
|
|
|
|
monitor,
|
|
|
|
scale_factor_override,
|
|
|
|
..
|
|
|
|
} = window_descriptor;
|
|
|
|
|
|
|
|
let logical_size = LogicalSize::new(width, height);
|
|
|
|
|
|
|
|
let monitor = match monitor {
|
|
|
|
MonitorSelection::Current => None,
|
|
|
|
MonitorSelection::Primary => event_loop.primary_monitor(),
|
|
|
|
MonitorSelection::Index(i) => event_loop.available_monitors().nth(i),
|
|
|
|
};
|
|
|
|
|
|
|
|
let selected_or_primary_monitor = monitor.clone().or_else(|| event_loop.primary_monitor());
|
|
|
|
|
2020-12-13 23:05:56 +00:00
|
|
|
winit_window_builder = match window_descriptor.mode {
|
2022-09-06 14:45:44 +00:00
|
|
|
WindowMode::BorderlessFullscreen => winit_window_builder
|
|
|
|
.with_fullscreen(Some(Fullscreen::Borderless(selected_or_primary_monitor))),
|
|
|
|
WindowMode::Fullscreen => winit_window_builder.with_fullscreen(Some(
|
|
|
|
Fullscreen::Exclusive(get_best_videomode(&selected_or_primary_monitor.unwrap())),
|
2020-08-13 09:27:51 +00:00
|
|
|
)),
|
2021-11-30 23:51:11 +00:00
|
|
|
WindowMode::SizedFullscreen => winit_window_builder.with_fullscreen(Some(
|
2022-09-06 14:45:44 +00:00
|
|
|
Fullscreen::Exclusive(get_fitting_videomode(
|
|
|
|
&selected_or_primary_monitor.unwrap(),
|
2021-11-30 23:51:11 +00:00
|
|
|
window_descriptor.width as u32,
|
|
|
|
window_descriptor.height as u32,
|
|
|
|
)),
|
2020-08-13 09:27:51 +00:00
|
|
|
)),
|
2020-12-28 20:26:50 +00:00
|
|
|
_ => {
|
|
|
|
if let Some(sf) = scale_factor_override {
|
2022-09-06 14:45:44 +00:00
|
|
|
winit_window_builder.with_inner_size(logical_size.to_physical::<f64>(sf))
|
2022-07-04 13:04:14 +00:00
|
|
|
} else {
|
2022-09-06 14:45:44 +00:00
|
|
|
winit_window_builder.with_inner_size(logical_size)
|
2020-12-28 20:26:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.with_resizable(window_descriptor.resizable)
|
2021-12-08 20:53:35 +00:00
|
|
|
.with_decorations(window_descriptor.decorations)
|
2022-11-14 22:34:29 +00:00
|
|
|
.with_transparent(window_descriptor.transparent)
|
|
|
|
.with_always_on_top(window_descriptor.always_on_top),
|
2020-08-13 08:47:40 +00:00
|
|
|
};
|
2020-07-26 19:36:01 +00:00
|
|
|
|
2021-03-03 02:56:50 +00:00
|
|
|
let constraints = window_descriptor.resize_constraints.check_constraints();
|
|
|
|
let min_inner_size = LogicalSize {
|
|
|
|
width: constraints.min_width,
|
|
|
|
height: constraints.min_height,
|
|
|
|
};
|
|
|
|
let max_inner_size = LogicalSize {
|
|
|
|
width: constraints.max_width,
|
|
|
|
height: constraints.max_height,
|
|
|
|
};
|
|
|
|
|
|
|
|
let winit_window_builder =
|
|
|
|
if constraints.max_width.is_finite() && constraints.max_height.is_finite() {
|
|
|
|
winit_window_builder
|
|
|
|
.with_min_inner_size(min_inner_size)
|
|
|
|
.with_max_inner_size(max_inner_size)
|
|
|
|
} else {
|
|
|
|
winit_window_builder.with_min_inner_size(min_inner_size)
|
|
|
|
};
|
|
|
|
|
2020-09-21 23:12:34 +00:00
|
|
|
#[allow(unused_mut)]
|
2020-12-13 23:05:56 +00:00
|
|
|
let mut winit_window_builder = winit_window_builder.with_title(&window_descriptor.title);
|
2020-09-21 23:12:34 +00:00
|
|
|
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
{
|
|
|
|
use wasm_bindgen::JsCast;
|
|
|
|
use winit::platform::web::WindowBuilderExtWebSys;
|
|
|
|
|
2020-12-13 23:05:56 +00:00
|
|
|
if let Some(selector) = &window_descriptor.canvas {
|
2020-09-21 23:12:34 +00:00
|
|
|
let window = web_sys::window().unwrap();
|
|
|
|
let document = window.document().unwrap();
|
|
|
|
let canvas = document
|
|
|
|
.query_selector(&selector)
|
2020-12-02 19:31:16 +00:00
|
|
|
.expect("Cannot query for canvas element.");
|
2020-09-21 23:12:34 +00:00
|
|
|
if let Some(canvas) = canvas {
|
|
|
|
let canvas = canvas.dyn_into::<web_sys::HtmlCanvasElement>().ok();
|
|
|
|
winit_window_builder = winit_window_builder.with_canvas(canvas);
|
|
|
|
} else {
|
2020-12-02 19:31:16 +00:00
|
|
|
panic!("Cannot find element: {}.", selector);
|
2020-09-21 23:12:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-29 20:52:15 +00:00
|
|
|
let winit_window = winit_window_builder.build(event_loop).unwrap();
|
2020-08-13 09:27:51 +00:00
|
|
|
|
2022-09-06 14:45:44 +00:00
|
|
|
if window_descriptor.mode == WindowMode::Windowed {
|
|
|
|
use bevy_window::WindowPosition::*;
|
|
|
|
match position {
|
|
|
|
Automatic => {
|
|
|
|
if let Some(monitor) = monitor {
|
|
|
|
winit_window.set_outer_position(monitor.position());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Centered => {
|
|
|
|
if let Some(monitor) = monitor.or_else(|| winit_window.current_monitor()) {
|
|
|
|
let monitor_position = monitor.position().cast::<f64>();
|
|
|
|
let size = monitor.size();
|
|
|
|
|
|
|
|
// Logical to physical window size
|
|
|
|
let PhysicalSize::<u32> { width, height } =
|
|
|
|
logical_size.to_physical(monitor.scale_factor());
|
|
|
|
|
|
|
|
let position = PhysicalPosition {
|
|
|
|
x: size.width.saturating_sub(width) as f64 / 2. + monitor_position.x,
|
|
|
|
y: size.height.saturating_sub(height) as f64 / 2. + monitor_position.y,
|
|
|
|
};
|
|
|
|
|
|
|
|
winit_window.set_outer_position(position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
At(position) => {
|
|
|
|
if let Some(monitor) = monitor.or_else(|| winit_window.current_monitor()) {
|
|
|
|
let monitor_position = DVec2::from(<(_, _)>::from(monitor.position()));
|
|
|
|
let position = monitor_position + position.as_dvec2();
|
|
|
|
|
|
|
|
if let Some(sf) = scale_factor_override {
|
|
|
|
winit_window.set_outer_position(
|
|
|
|
LogicalPosition::new(position.x, position.y).to_physical::<f64>(sf),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
winit_window
|
|
|
|
.set_outer_position(LogicalPosition::new(position.x, position.y));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-31 16:12:18 +00:00
|
|
|
// Do not set the grab mode on window creation if it's none, this can fail on mobile
|
|
|
|
if window_descriptor.cursor_grab_mode != CursorGrabMode::None {
|
|
|
|
match winit_window
|
|
|
|
.set_cursor_grab(convert_cursor_grab_mode(window_descriptor.cursor_grab_mode))
|
|
|
|
{
|
|
|
|
Ok(_) | Err(winit::error::ExternalError::NotSupported(_)) => {}
|
|
|
|
Err(err) => Err(err).unwrap(),
|
|
|
|
}
|
2020-10-20 00:29:31 +00:00
|
|
|
}
|
|
|
|
|
2020-12-13 23:05:56 +00:00
|
|
|
winit_window.set_cursor_visible(window_descriptor.cursor_visible);
|
2020-10-16 21:07:01 +00:00
|
|
|
|
2020-12-13 23:05:56 +00:00
|
|
|
self.window_id_to_winit.insert(window_id, winit_window.id());
|
|
|
|
self.winit_to_window_id.insert(winit_window.id(), window_id);
|
2020-03-30 21:53:32 +00:00
|
|
|
|
2020-09-19 03:11:26 +00:00
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
{
|
|
|
|
use winit::platform::web::WindowExtWebSys;
|
|
|
|
|
2020-12-13 23:05:56 +00:00
|
|
|
if window_descriptor.canvas.is_none() {
|
2020-09-21 23:12:34 +00:00
|
|
|
let canvas = winit_window.canvas();
|
2020-09-19 03:11:26 +00:00
|
|
|
|
2020-09-21 23:12:34 +00:00
|
|
|
let window = web_sys::window().unwrap();
|
|
|
|
let document = window.document().unwrap();
|
|
|
|
let body = document.body().unwrap();
|
2020-09-19 03:11:26 +00:00
|
|
|
|
2020-09-21 23:12:34 +00:00
|
|
|
body.append_child(&canvas)
|
2020-12-02 19:31:16 +00:00
|
|
|
.expect("Append canvas to HTML body.");
|
2020-09-21 23:12:34 +00:00
|
|
|
}
|
2020-09-19 03:11:26 +00:00
|
|
|
}
|
|
|
|
|
2021-01-25 04:06:06 +00:00
|
|
|
let position = winit_window
|
|
|
|
.outer_position()
|
|
|
|
.ok()
|
|
|
|
.map(|position| IVec2::new(position.x, position.y));
|
2020-12-07 21:32:57 +00:00
|
|
|
let inner_size = winit_window.inner_size();
|
2020-12-13 23:05:56 +00:00
|
|
|
let scale_factor = winit_window.scale_factor();
|
Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7 (#6218)
# Objective
- Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7.
## Solution
---
## Changelog
### Changed
- Changed `RawWindowHandleWrapper` to `RawHandleWrapper` which wraps both `RawWindowHandle` and `RawDisplayHandle`, which satisfies the `impl HasRawWindowHandle and HasRawDisplayHandle` that `wgpu` 0.14.0 requires.
- Changed `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, change its type from `bool` to `bevy_window::CursorGrabMode`.
## Migration Guide
- Adjust usage of `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, and adjust its type from `bool` to `bevy_window::CursorGrabMode`.
2022-10-19 17:40:23 +00:00
|
|
|
let raw_handle = RawHandleWrapper {
|
|
|
|
window_handle: winit_window.raw_window_handle(),
|
|
|
|
display_handle: winit_window.raw_display_handle(),
|
|
|
|
};
|
2020-03-30 21:53:32 +00:00
|
|
|
self.windows.insert(winit_window.id(), winit_window);
|
2020-12-13 23:05:56 +00:00
|
|
|
Window::new(
|
|
|
|
window_id,
|
2021-07-29 20:52:15 +00:00
|
|
|
window_descriptor,
|
2020-12-13 23:05:56 +00:00
|
|
|
inner_size.width,
|
|
|
|
inner_size.height,
|
|
|
|
scale_factor,
|
2021-01-25 04:06:06 +00:00
|
|
|
position,
|
Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7 (#6218)
# Objective
- Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7.
## Solution
---
## Changelog
### Changed
- Changed `RawWindowHandleWrapper` to `RawHandleWrapper` which wraps both `RawWindowHandle` and `RawDisplayHandle`, which satisfies the `impl HasRawWindowHandle and HasRawDisplayHandle` that `wgpu` 0.14.0 requires.
- Changed `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, change its type from `bool` to `bevy_window::CursorGrabMode`.
## Migration Guide
- Adjust usage of `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, and adjust its type from `bool` to `bevy_window::CursorGrabMode`.
2022-10-19 17:40:23 +00:00
|
|
|
Some(raw_handle),
|
2020-12-13 23:05:56 +00:00
|
|
|
)
|
2020-03-30 21:53:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_window(&self, id: WindowId) -> Option<&winit::window::Window> {
|
|
|
|
self.window_id_to_winit
|
|
|
|
.get(&id)
|
|
|
|
.and_then(|id| self.windows.get(id))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_window_id(&self, id: winit::window::WindowId) -> Option<WindowId> {
|
|
|
|
self.winit_to_window_id.get(&id).cloned()
|
|
|
|
}
|
2022-05-05 13:35:43 +00:00
|
|
|
|
|
|
|
pub fn remove_window(&mut self, id: WindowId) -> Option<winit::window::Window> {
|
|
|
|
let winit_id = self.window_id_to_winit.remove(&id)?;
|
|
|
|
// Don't remove from winit_to_window_id, to track that we used to know about this winit window
|
|
|
|
self.windows.remove(&winit_id)
|
|
|
|
}
|
2020-03-30 21:53:32 +00:00
|
|
|
}
|
2021-11-30 23:51:11 +00:00
|
|
|
|
2020-10-15 18:42:19 +00:00
|
|
|
pub fn get_fitting_videomode(
|
2020-08-13 08:47:40 +00:00
|
|
|
monitor: &winit::monitor::MonitorHandle,
|
2020-10-15 18:42:19 +00:00
|
|
|
width: u32,
|
|
|
|
height: u32,
|
2020-08-13 08:47:40 +00:00
|
|
|
) -> winit::monitor::VideoMode {
|
|
|
|
let mut modes = monitor.video_modes().collect::<Vec<_>>();
|
|
|
|
|
|
|
|
fn abs_diff(a: u32, b: u32) -> u32 {
|
|
|
|
if a > b {
|
|
|
|
return a - b;
|
|
|
|
}
|
|
|
|
b - a
|
|
|
|
}
|
|
|
|
|
|
|
|
modes.sort_by(|a, b| {
|
|
|
|
use std::cmp::Ordering::*;
|
2020-10-15 18:42:19 +00:00
|
|
|
match abs_diff(a.size().width, width).cmp(&abs_diff(b.size().width, width)) {
|
2020-08-13 08:47:40 +00:00
|
|
|
Equal => {
|
2020-10-15 18:42:19 +00:00
|
|
|
match abs_diff(a.size().height, height).cmp(&abs_diff(b.size().height, height)) {
|
Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7 (#6218)
# Objective
- Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7.
## Solution
---
## Changelog
### Changed
- Changed `RawWindowHandleWrapper` to `RawHandleWrapper` which wraps both `RawWindowHandle` and `RawDisplayHandle`, which satisfies the `impl HasRawWindowHandle and HasRawDisplayHandle` that `wgpu` 0.14.0 requires.
- Changed `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, change its type from `bool` to `bevy_window::CursorGrabMode`.
## Migration Guide
- Adjust usage of `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, and adjust its type from `bool` to `bevy_window::CursorGrabMode`.
2022-10-19 17:40:23 +00:00
|
|
|
Equal => b
|
|
|
|
.refresh_rate_millihertz()
|
|
|
|
.cmp(&a.refresh_rate_millihertz()),
|
2020-08-13 08:47:40 +00:00
|
|
|
default => default,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default => default,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
modes.first().unwrap().clone()
|
|
|
|
}
|
|
|
|
|
2020-10-15 18:42:19 +00:00
|
|
|
pub fn get_best_videomode(monitor: &winit::monitor::MonitorHandle) -> winit::monitor::VideoMode {
|
2020-08-13 08:47:40 +00:00
|
|
|
let mut modes = monitor.video_modes().collect::<Vec<_>>();
|
|
|
|
modes.sort_by(|a, b| {
|
|
|
|
use std::cmp::Ordering::*;
|
|
|
|
match b.size().width.cmp(&a.size().width) {
|
|
|
|
Equal => match b.size().height.cmp(&a.size().height) {
|
Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7 (#6218)
# Objective
- Update `wgpu` to 0.14.0, `naga` to `0.10.0`, `winit` to 0.27.4, `raw-window-handle` to 0.5.0, `ndk` to 0.7.
## Solution
---
## Changelog
### Changed
- Changed `RawWindowHandleWrapper` to `RawHandleWrapper` which wraps both `RawWindowHandle` and `RawDisplayHandle`, which satisfies the `impl HasRawWindowHandle and HasRawDisplayHandle` that `wgpu` 0.14.0 requires.
- Changed `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, change its type from `bool` to `bevy_window::CursorGrabMode`.
## Migration Guide
- Adjust usage of `bevy_window::WindowDescriptor`'s `cursor_locked` to `cursor_grab_mode`, and adjust its type from `bool` to `bevy_window::CursorGrabMode`.
2022-10-19 17:40:23 +00:00
|
|
|
Equal => b
|
|
|
|
.refresh_rate_millihertz()
|
|
|
|
.cmp(&a.refresh_rate_millihertz()),
|
2020-08-13 08:47:40 +00:00
|
|
|
default => default,
|
|
|
|
},
|
|
|
|
default => default,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
modes.first().unwrap().clone()
|
|
|
|
}
|