Added documentation to WindowMode to better document what 'use_size' … (#3216)
This pull request aims to solve the issue of a lack of documentation in the enum WindowMode # Objective - Fixes #3136 ## Solution - Added a few lines of documentation that should document what the enum does better
This commit is contained in:
parent
d59a3ddd61
commit
bab4ee962d
@ -183,15 +183,17 @@ pub enum WindowCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Defines the way a window is displayed
|
/// Defines the way a window is displayed
|
||||||
/// The use_size option that is used in the Fullscreen variant
|
|
||||||
/// defines whether a videomode is chosen that best fits the width and height
|
|
||||||
/// in the Window structure, or if these are ignored.
|
|
||||||
/// E.g. when use_size is set to false the best video mode possible is chosen.
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub enum WindowMode {
|
pub enum WindowMode {
|
||||||
|
/// Creates a window that uses the given size
|
||||||
Windowed,
|
Windowed,
|
||||||
|
/// Creates a borderless window that uses the full size of the screen
|
||||||
BorderlessFullscreen,
|
BorderlessFullscreen,
|
||||||
Fullscreen { use_size: bool },
|
/// Creates a fullscreen window that will render at desktop resolution. The app will use the closest supported size
|
||||||
|
/// from the given size and scale it to fit the screen.
|
||||||
|
SizedFullscreen,
|
||||||
|
/// Creates a fullscreen window that uses the maximum supported size
|
||||||
|
Fullscreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
|
@ -59,16 +59,18 @@ fn change_window(world: &mut World) {
|
|||||||
bevy_window::WindowMode::BorderlessFullscreen => {
|
bevy_window::WindowMode::BorderlessFullscreen => {
|
||||||
window.set_fullscreen(Some(winit::window::Fullscreen::Borderless(None)))
|
window.set_fullscreen(Some(winit::window::Fullscreen::Borderless(None)))
|
||||||
}
|
}
|
||||||
bevy_window::WindowMode::Fullscreen { use_size } => window.set_fullscreen(
|
bevy_window::WindowMode::Fullscreen => {
|
||||||
Some(winit::window::Fullscreen::Exclusive(match use_size {
|
window.set_fullscreen(Some(winit::window::Fullscreen::Exclusive(
|
||||||
true => get_fitting_videomode(
|
get_best_videomode(&window.current_monitor().unwrap()),
|
||||||
&window.current_monitor().unwrap(),
|
)))
|
||||||
width,
|
}
|
||||||
height,
|
bevy_window::WindowMode::SizedFullscreen => window.set_fullscreen(Some(
|
||||||
),
|
winit::window::Fullscreen::Exclusive(get_fitting_videomode(
|
||||||
false => get_best_videomode(&window.current_monitor().unwrap()),
|
&window.current_monitor().unwrap(),
|
||||||
})),
|
width,
|
||||||
),
|
height,
|
||||||
|
)),
|
||||||
|
)),
|
||||||
bevy_window::WindowMode::Windowed => window.set_fullscreen(None),
|
bevy_window::WindowMode::Windowed => window.set_fullscreen(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,17 @@ impl WinitWindows {
|
|||||||
WindowMode::BorderlessFullscreen => winit_window_builder.with_fullscreen(Some(
|
WindowMode::BorderlessFullscreen => winit_window_builder.with_fullscreen(Some(
|
||||||
winit::window::Fullscreen::Borderless(event_loop.primary_monitor()),
|
winit::window::Fullscreen::Borderless(event_loop.primary_monitor()),
|
||||||
)),
|
)),
|
||||||
WindowMode::Fullscreen { use_size } => winit_window_builder.with_fullscreen(Some(
|
WindowMode::Fullscreen => {
|
||||||
winit::window::Fullscreen::Exclusive(match use_size {
|
winit_window_builder.with_fullscreen(Some(winit::window::Fullscreen::Exclusive(
|
||||||
true => get_fitting_videomode(
|
get_best_videomode(&event_loop.primary_monitor().unwrap()),
|
||||||
&event_loop.primary_monitor().unwrap(),
|
)))
|
||||||
window_descriptor.width as u32,
|
}
|
||||||
window_descriptor.height as u32,
|
WindowMode::SizedFullscreen => winit_window_builder.with_fullscreen(Some(
|
||||||
),
|
winit::window::Fullscreen::Exclusive(get_fitting_videomode(
|
||||||
false => get_best_videomode(&event_loop.primary_monitor().unwrap()),
|
&event_loop.primary_monitor().unwrap(),
|
||||||
}),
|
window_descriptor.width as u32,
|
||||||
|
window_descriptor.height as u32,
|
||||||
|
)),
|
||||||
)),
|
)),
|
||||||
_ => {
|
_ => {
|
||||||
let WindowDescriptor {
|
let WindowDescriptor {
|
||||||
@ -180,6 +182,7 @@ impl WinitWindows {
|
|||||||
self.winit_to_window_id.get(&id).cloned()
|
self.winit_to_window_id.get(&id).cloned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_fitting_videomode(
|
pub fn get_fitting_videomode(
|
||||||
monitor: &winit::monitor::MonitorHandle,
|
monitor: &winit::monitor::MonitorHandle,
|
||||||
width: u32,
|
width: u32,
|
||||||
|
Loading…
Reference in New Issue
Block a user