fixed aspect scaling

This commit is contained in:
2025-03-30 16:54:01 -04:00
parent 2e11d2c2ab
commit 6cd85f2f3e
2 changed files with 23 additions and 14 deletions

View File

@@ -26,6 +26,14 @@ impl Camera {
Vector2::new(1.0, fsize.y / fsize.x)
}
}
pub fn inv_scale(&self, size: &Vector2<u32>) -> Vector2<f32> {
let fsize: Vector2<f32> = size.cast();
if size.x < size.y {
Vector2::new(fsize.y / fsize.x, 1.0)
} else {
Vector2::new(1.0, fsize.x / fsize.y)
}
}
}
impl Default for Camera {