From 7f5dbe7245f421f320d52ae422e0548453742fd2 Mon Sep 17 00:00:00 2001 From: Rokonio <61879190+rokonio@users.noreply.github.com> Date: Mon, 9 Aug 2021 00:32:21 +0200 Subject: [PATCH] Fixing #200 --- code/beginner/tutorial5-textures/src/challenge.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/beginner/tutorial5-textures/src/challenge.rs b/code/beginner/tutorial5-textures/src/challenge.rs index 7e8484c1..80187f9a 100644 --- a/code/beginner/tutorial5-textures/src/challenge.rs +++ b/code/beginner/tutorial5-textures/src/challenge.rs @@ -268,11 +268,13 @@ impl State { } } - fn resize(&mut self, new_size: winit::dpi::PhysicalSize) { - self.size = new_size; - self.sc_desc.width = new_size.width; - self.sc_desc.height = new_size.height; - self.swap_chain = self.device.create_swap_chain(&self.surface, &self.sc_desc); + pub fn resize(&mut self, new_size: winit::dpi::PhysicalSize) { + if new_size.width > 0 && new_size.height > 0 { + self.size = new_size; + self.sc_desc.width = new_size.width; + self.sc_desc.height = new_size.height; + self.swap_chain = self.device.create_swap_chain(&self.surface, &self.sc_desc); + } } fn input(&mut self, event: &WindowEvent) -> bool {