Add window surface resizing function

This commit is contained in:
Jarrod Doyle 2023-10-20 11:05:38 +01:00
parent ae298d8ca2
commit 8c53a2d7b7
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 9 additions and 0 deletions

View File

@ -68,4 +68,13 @@ impl Context {
queue, queue,
} }
} }
pub fn resize(&mut self, new_size: PhysicalSize<u32>) {
if new_size.width > 0 && new_size.height > 0 {
self.size = new_size;
self.surface_config.width = new_size.width;
self.surface_config.height = new_size.height;
self.surface.configure(&self.device, &self.surface_config);
}
}
} }