mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
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
2 changed files with 13 additions and 0 deletions
|
@ -82,6 +82,9 @@ pub enum WindowCommand {
|
|||
SetCursorPosition {
|
||||
position: Vec2,
|
||||
},
|
||||
SetMaximized {
|
||||
maximized: bool,
|
||||
},
|
||||
}
|
||||
|
||||
/// Defines the way a window is displayed
|
||||
|
@ -140,6 +143,12 @@ impl Window {
|
|||
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) {
|
||||
self.width = width;
|
||||
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));
|
||||
}
|
||||
bevy_window::WindowCommand::SetMaximized { maximized } => {
|
||||
let window = winit_windows.get_window(id).unwrap();
|
||||
window.set_maximized(maximized)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue