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
3 changed files with 10 additions and 1 deletions
Showing only changes of commit 4b3da44d65 - Show all commits

View file

@ -5,6 +5,7 @@ use bevy::prelude::*;
pub mod camera;
pub mod map;
pub mod scenes;
pub mod responsive_scale;
/// The current scene of the game.
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]

View file

@ -1,4 +1,11 @@
//! The file that contains the responsive scaling logic.
use bevy::prelude::*;
/// The default width of the main node
const DEFAULT_WIDTH: f32 = 1280.;
/// The default height of the main node
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

View file

@ -3,7 +3,8 @@
use bevy::prelude::*;
use bevy_egui::EguiPlugin;
use crate::{change_scaling, CurrentScene};
use crate::responsive_scale::change_scaling;
use crate::CurrentScene;
pub mod lobby;
pub mod menu;