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 11e4aef80d - Show all commits

View file

@ -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.;

You should put these constants in bevy's resources instead.
this can be changed in future settings.

You should put these constants in bevy's resources instead. this can be changed in future settings.
/// 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();