Fix crashes due to Responsive scaling (#91)
Some checks failed
Rust Checks / checks (push) Failing after 3m9s

Co-authored-by: raphael <Aude11..>
Reviewed-on: fish-canard/border-wars#91
Reviewed-by: Tipragot <contact@tipragot.fr>
Reviewed-by: CoCo_Sol <solois.corentin@gmail.com>
This commit is contained in:
Raphaël 2024-03-31 16:27:30 +00:00
parent a8895963bf
commit ceca7d3681

View file

@ -29,6 +29,9 @@ pub fn change_scaling(
size: Res<UILayoutSize>,
) {
let window = windows.get_single().expect("Main window not found");
if window.resolution.physical_height() <= 0 {
return;
};
let (a, b) = (
window.resolution.width() / size.0.x,
window.resolution.height() / size.0.y,