Skip to content

Commit 9edce91

Browse files
committed
working v2
1 parent a02f34f commit 9edce91

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

crates/processing_glfw/src/lib.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,8 @@ impl GlfwContext {
301301
input_set_focus(surface, focused).unwrap();
302302
}
303303
WindowEvent::Size(width, height) => {
304-
let scale = self.content_scale();
305-
let logical_w = ((width as f32) / scale).max(1.0) as i32;
306-
let logical_h = ((height as f32) / scale).max(1.0) as i32;
307-
processing_render::surface_resize(
308-
surface,
309-
logical_w as u32,
310-
logical_h as u32,
311-
).unwrap();
304+
processing_render::surface_resize(surface, width.max(1) as u32, height.max(1) as u32)
305+
.unwrap();
312306
}
313307
_ => {}
314308
}
@@ -539,8 +533,8 @@ fn read_desired_window(surface: Entity) -> Option<DesiredWindow> {
539533
_ => None,
540534
},
541535
size: bevy::math::UVec2::new(
542-
window.resolution.physical_width(),
543-
window.resolution.physical_height(),
536+
window.resolution.width() as u32,
537+
window.resolution.height() as u32,
544538
),
545539
visible: window.visible,
546540
resizable: window.resizable,

crates/processing_render/src/surface.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use bevy::{
2222
app::{App, Plugin},
2323
asset::Assets,
24-
camera::{CameraProjection, Projection, RenderTarget},
24+
camera::{Projection, RenderTarget},
2525
ecs::query::QueryEntityError,
2626
math::{IRect, IVec2},
2727
prelude::{Commands, Component, Entity, In, Query, ResMut, Window, With, default},
@@ -41,7 +41,7 @@ use processing_core::error::{self, ProcessingError, Result};
4141
use std::ptr::NonNull;
4242

4343
use crate::{
44-
graphics::{ProcessingProjection, SurfaceSize},
44+
graphics::SurfaceSize,
4545
image::Image,
4646
};
4747

@@ -400,9 +400,6 @@ pub fn resize(
400400
mut windows: Query<&mut Window>,
401401
mut graphics_query: Query<(&RenderTarget, &mut SurfaceSize, &mut Projection)>,
402402
) -> Result<()> {
403-
let width = width.max(1);
404-
let height = height.max(1);
405-
406403
if let Ok(mut window) = windows.get_mut(window_entity) {
407404
let scale = window.resolution.scale_factor();
408405
let physical_w = (width as f32 * scale) as u32;

0 commit comments

Comments
 (0)