generated from tipragot/rust
Add a responsive scaling for ui #73
|
@ -1,5 +1,5 @@
|
||||||
const DEFAULT_WIDTH = 1280.
|
const DEFAULT_WIDTH: f32 = 1280.;
|
||||||
const DEFAULT_HEIGHT = 720.
|
const DEFAULT_HEIGHT: f32 = 720.;
|
||||||
|
|
||||||
/// Calculates the ui_scale.0 depending on the size of the main node
|
/// Calculates the ui_scale.0 depending on the size of the main node
|
||||||
/// in order to make the screen responsive
|
/// 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,
|
window.resolution.height() / DEFAULT_HEIGHT,
|
||||||
);
|
);
|
||||||
ui_scale.0 = if a < b { a } else { b } as f64
|
ui_scale.0 = if a < b { a } else { b } as f64
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue