Resize the window surface when the window is resized

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

View File

@ -45,7 +45,7 @@ impl App {
}
}
pub fn run(self) {
pub fn run(mut self) {
let mut camera_controller = camera::CameraController::new(
&self.render_ctx,
camera::Camera::new(
@ -91,6 +91,12 @@ impl App {
window_id,
} if window_id == self.render_ctx.window.id() => match event {
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
WindowEvent::Resized(physical_size) => {
self.render_ctx.resize(*physical_size);
}
WindowEvent::ScaleFactorChanged { new_inner_size, .. } => {
self.render_ctx.resize(**new_inner_size);
}
_ => {
camera_controller.process_events(event);
}