pull request
Some checks failed
Rust Checks / checks (push) Failing after 1m53s
Rust Checks / checks (pull_request) Failing after 45s

This commit is contained in:
raphael 2024-03-08 08:20:34 +01:00
parent f0671e12e2
commit f0af5f4cfd
2 changed files with 13 additions and 11 deletions

View file

@ -19,14 +19,3 @@ pub enum CurrentScene {
/// When we play this wonderful game.
Game,
}
/// Calculates the ui_scale.0 depending on the size of the main node
/// in order to make the screen responsive
pub fn change_scaling(mut ui_scale: ResMut<UiScale>, window: Query<&Window>) {
let window = window.single();
let (a, b) = (
window.resolution.width() / 1280.,
window.resolution.height() / 720.,
);
ui_scale.0 = if a < b { a } else { b } as f64
}

View file

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