Skip to content

Commit

Permalink
Use scaling_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
richchurcher committed Sep 7, 2024
1 parent 38ac367 commit 92a61b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/2d/pixel_grid_snap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use bevy::{
sprite::MaterialMesh2dBundle,
window::WindowResized,
};
use bevy_render::camera::ScalingMode;

/// In-game resolution width.
const RES_WIDTH: u32 = 160;
Expand Down Expand Up @@ -176,6 +177,6 @@ fn fit_canvas(
let h_scale = event.width / RES_WIDTH as f32;
let v_scale = event.height / RES_HEIGHT as f32;
let mut projection = projections.single_mut();
projection.scale = 1. / h_scale.min(v_scale).round();
projection.scaling_mode = ScalingMode::WindowSize(h_scale.min(v_scale).round());
}
}

0 comments on commit 92a61b3

Please sign in to comment.