Skip to content

Commit

Permalink
fix: surface error for non zero size on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ElhamAryanpur committed Feb 17, 2024
1 parent 6e2f434 commit 8426db3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blue_engine"
version = "0.5.5"
version = "0.5.6"
authors = ["Elham Aryanpur <elhamaryanpur5@gmail.com>"]
edition = "2021"
description = "General-Purpose, Easy-to-use, Fast, and Portable graphics engine"
Expand Down
27 changes: 15 additions & 12 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,21 @@ impl Renderer {
/// # Arguments
/// * `new_size` - The new window size.
pub(crate) fn resize(&mut self, new_size: winit::dpi::PhysicalSize<u32>) {
self.size = new_size;
self.config.width = new_size.width;
self.config.height = new_size.height;
#[cfg(not(feature = "android"))]
self.surface
.as_ref()
.unwrap()
.configure(&self.device, &self.config);
#[cfg(not(feature = "android"))]
{
self.depth_buffer =
Self::build_depth_buffer("Depth Buffer", &self.device, &self.config);
// check if new_size is non zero
if new_size.width != 0 && new_size.height != 0 {
self.size = new_size;
self.config.width = new_size.width;
self.config.height = new_size.height;
#[cfg(not(feature = "android"))]
self.surface
.as_ref()
.unwrap()
.configure(&self.device, &self.config);
#[cfg(not(feature = "android"))]
{
self.depth_buffer =
Self::build_depth_buffer("Depth Buffer", &self.device, &self.config);
}
}
}

Expand Down

0 comments on commit 8426db3

Please sign in to comment.