save
Some checks failed
Rust Checks / checks (push) Failing after 3m30s

This commit is contained in:
CoCo_Sol 2024-04-05 20:53:58 +02:00
parent 69ccefd601
commit 9307223a13
2 changed files with 52 additions and 1 deletions

View file

@ -0,0 +1,48 @@
//! ToDo
use bevy::prelude::*;
use crate::CurrentScene;
pub struct GameUiPlugin;
impl Plugin for GameUiPlugin {
fn build(&self, app: &mut App) {
app.add_systems(OnEnter(CurrentScene::Game), setup_ui);
}
}
/// Sets up the UI for the game.
fn setup_ui(mut commands: Commands) {
commands.spawn(NodeBundle {
style: Style {
margin: UiRect {
left: Val::Auto,
right: Val::Auto,
top: Val::Auto,
bottom: Val::Px(25.),
},
width: Val::Px(1000.),
height: Val::Px(150.),
..Default::default()
},
background_color: Color::BLUE.into(),
..Default::default()
});
commands.spawn(NodeBundle {
style: Style {
margin: UiRect {
left: Val::Px(10.),
right: Val::Auto,
top: Val::Px(10.),
bottom: Val::Auto,
},
width: Val::Px(200.),
height: Val::Px(200.),
..Default::default()
},
background_color: Color::BLUE.into(),
..Default::default()
});
}

View file

@ -1,10 +1,12 @@
//! The file that contains the UI logic. //! The file that contains the UI logic.
pub mod game_ui;
pub mod hover; pub mod hover;
pub mod responsive_scale; pub mod responsive_scale;
use bevy::prelude::*; use bevy::prelude::*;
use self::game_ui::GameUiPlugin;
use self::hover::HoverPlugin; use self::hover::HoverPlugin;
use self::responsive_scale::ResponsiveScalingPlugin; use self::responsive_scale::ResponsiveScalingPlugin;
@ -14,6 +16,7 @@ pub struct UiPlugin;
impl Plugin for UiPlugin { impl Plugin for UiPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugins(HoverPlugin) app.add_plugins(HoverPlugin)
.add_plugins(ResponsiveScalingPlugin); .add_plugins(ResponsiveScalingPlugin)
.add_plugins(GameUiPlugin);
} }
} }