generated from tipragot/rust
Add a responsive scaling for ui #73
|
@ -10,8 +10,8 @@ const DEFAULT_HEIGHT: f32 = 720.;
|
||||||
|
|
||||||
/// Calculates the ui_scale.0 depending on the default screen size
|
/// Calculates the ui_scale.0 depending on the default screen size
|
||||||
/// in order to make the screen responsive
|
/// in order to make the screen responsive
|
||||||
pub fn change_scaling(mut ui_scale: ResMut<UiScale>, window: Query<&Window>) {
|
pub fn change_scaling(mut ui_scale: ResMut<UiScale>, windows: Query<&Window>) {
|
||||||
let window = window.single();
|
let window = windows.get_single().expect("Main window not found");
|
||||||
let (a, b) = (
|
let (a, b) = (
|
||||||
window.resolution.width() / DEFAULT_WIDTH,
|
window.resolution.width() / DEFAULT_WIDTH,
|
||||||
window.resolution.height() / DEFAULT_HEIGHT,
|
window.resolution.height() / DEFAULT_HEIGHT,
|
||||||
|
|
Loading…
Reference in a new issue