generated from tipragot/rust
Add a responsive scaling for ui #73
|
@ -2,13 +2,13 @@
|
|||
|
||||
use bevy::prelude::*;
|
||||
|
||||
/// The default width of the main node
|
||||
/// The default width of the screen
|
||||
const DEFAULT_WIDTH: f32 = 1280.;
|
||||
|
||||
/// The default height of the main node
|
||||
/// The default height of the screen
|
||||
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 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();
|
||||
|
|
Loading…
Reference in a new issue
You should put these constants in bevy's resources instead.
this can be changed in future settings.