Add a responsive scaling for ui #73

Merged
raphael merged 11 commits from change-scaling into main 2024-03-09 17:24:22 +00:00
Showing only changes of commit 31bebd6542 - Show all commits

View file

@ -10,8 +10,8 @@ const DEFAULT_HEIGHT: f32 = 720.;
/// Calculates the ui_scale.0 depending on the default screen size
/// in order to make the screen responsive
pub fn change_scaling(mut ui_scale: ResMut<UiScale>, window: Query<&Window>) {
let window = window.single();
pub fn change_scaling(mut ui_scale: ResMut<UiScale>, windows: Query<&Window>) {
let window = windows.get_single().expect("Main window not found");
let (a, b) = (
window.resolution.width() / DEFAULT_WIDTH,
window.resolution.height() / DEFAULT_HEIGHT,