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 f0a4756260 - Show all commits

View file

@ -1,5 +1,5 @@
const DEFAULT_WIDTH = 1280.
const DEFAULT_HEIGHT = 720.
const DEFAULT_WIDTH: f32 = 1280.;
const DEFAULT_HEIGHT: f32 = 720.;
/// Calculates the ui_scale.0 depending on the size of the main node
/// in order to make the screen responsive
@ -10,4 +10,4 @@ pub fn change_scaling(mut ui_scale: ResMut<UiScale>, window: Query<&Window>) {
window.resolution.height() / DEFAULT_HEIGHT,
);
ui_scale.0 = if a < b { a } else { b } as f64
}
}