Merge pull request #2627 from bbb651/more-window-settings
Add `maximized` and `fullscreen` to `window::Settings`
This commit is contained in:
commit
634365564e
2 changed files with 14 additions and 0 deletions
|
|
@ -35,6 +35,12 @@ pub struct Settings {
|
||||||
/// The initial logical dimensions of the window.
|
/// The initial logical dimensions of the window.
|
||||||
pub size: Size,
|
pub size: Size,
|
||||||
|
|
||||||
|
/// Whether the window should start maximized.
|
||||||
|
pub maximized: bool,
|
||||||
|
|
||||||
|
/// Whether the window should start fullscreen.
|
||||||
|
pub fullscreen: bool,
|
||||||
|
|
||||||
/// The initial position of the window.
|
/// The initial position of the window.
|
||||||
pub position: Position,
|
pub position: Position,
|
||||||
|
|
||||||
|
|
@ -80,6 +86,8 @@ impl Default for Settings {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
size: Size::new(1024.0, 768.0),
|
size: Size::new(1024.0, 768.0),
|
||||||
|
maximized: false,
|
||||||
|
fullscreen: false,
|
||||||
position: Position::default(),
|
position: Position::default(),
|
||||||
min_size: None,
|
min_size: None,
|
||||||
max_size: None,
|
max_size: None,
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,12 @@ pub fn window_attributes(
|
||||||
width: settings.size.width,
|
width: settings.size.width,
|
||||||
height: settings.size.height,
|
height: settings.size.height,
|
||||||
})
|
})
|
||||||
|
.with_maximized(settings.maximized)
|
||||||
|
.with_fullscreen(
|
||||||
|
settings
|
||||||
|
.fullscreen
|
||||||
|
.then_some(winit::window::Fullscreen::Borderless(None)),
|
||||||
|
)
|
||||||
.with_resizable(settings.resizable)
|
.with_resizable(settings.resizable)
|
||||||
.with_enabled_buttons(if settings.resizable {
|
.with_enabled_buttons(if settings.resizable {
|
||||||
winit::window::WindowButtons::all()
|
winit::window::WindowButtons::all()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue