Allow windows to maximized. (#1004)
Adds a new `set_maximized` method to allow users to maximize windows.
This commit is contained in:
parent
fcbae57489
commit
1398d78330
@ -82,6 +82,9 @@ pub enum WindowCommand {
|
|||||||
SetCursorPosition {
|
SetCursorPosition {
|
||||||
position: Vec2,
|
position: Vec2,
|
||||||
},
|
},
|
||||||
|
SetMaximized {
|
||||||
|
maximized: bool,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines the way a window is displayed
|
/// Defines the way a window is displayed
|
||||||
@ -140,6 +143,12 @@ impl Window {
|
|||||||
self.height
|
self.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_maximized(&mut self, maximized: bool) {
|
||||||
|
self.command_queue
|
||||||
|
.push(WindowCommand::SetMaximized { maximized });
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_resolution(&mut self, width: u32, height: u32) {
|
pub fn set_resolution(&mut self, width: u32, height: u32) {
|
||||||
self.width = width;
|
self.width = width;
|
||||||
self.height = height;
|
self.height = height;
|
||||||
|
@ -104,6 +104,10 @@ fn change_window(_: &mut World, resources: &mut Resources) {
|
|||||||
))
|
))
|
||||||
.unwrap_or_else(|e| error!("Unable to set cursor position: {}", e));
|
.unwrap_or_else(|e| error!("Unable to set cursor position: {}", e));
|
||||||
}
|
}
|
||||||
|
bevy_window::WindowCommand::SetMaximized { maximized } => {
|
||||||
|
let window = winit_windows.get_window(id).unwrap();
|
||||||
|
window.set_maximized(maximized)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user