Renaming UIWindowSize to UILayoutSize
Some checks failed
Rust Checks / checks (push) Has been cancelled
Rust Checks / checks (pull_request) Successful in 2m43s

This commit is contained in:
Raphaël 2024-03-09 18:48:48 +01:00
parent 285b75fe1a
commit 49fd625e97

View file

@ -12,21 +12,21 @@ impl Plugin for ResponsiveScalingPlugin {
} }
} }
/// The default ui window size. /// The default ui layout size.
#[derive(Resource)] #[derive(Resource)]
pub struct UIWindowSize(pub Vec2); pub struct UILayoutSize(pub Vec2);
/// Initializes [UIWindowSize]. /// Initializes [UILayoutSize].
pub fn init_window_size(mut command: Commands) { pub fn init_window_size(mut command: Commands) {
command.insert_resource(UIWindowSize(Vec2::new(1280., 720.))); command.insert_resource(UILayoutSize(Vec2::new(1280., 720.)));
} }
/// Calculates the ui_scale.0 depending on the [UIWindowSize] /// Calculates the ui_scale.0 depending on the [UILayoutSize]
/// in order to make the screen responsive. /// in order to make the screen responsive.
pub fn change_scaling( pub fn change_scaling(
mut ui_scale: ResMut<UiScale>, mut ui_scale: ResMut<UiScale>,
windows: Query<&Window>, windows: Query<&Window>,
size: Res<UIWindowSize>, size: Res<UILayoutSize>,
) { ) {
let window = windows.get_single().expect("Main window not found"); let window = windows.get_single().expect("Main window not found");
let (a, b) = ( let (a, b) = (