Compare commits

...

2 commits
main ... add-ui

Author SHA1 Message Date
CoCo_Sol 26acb61a9f add docs
All checks were successful
Rust Checks / checks (push) Successful in 3m14s
2024-04-05 21:49:32 +02:00
CoCo_Sol 9307223a13 save
Some checks failed
Rust Checks / checks (push) Failing after 3m30s
2024-04-05 20:53:58 +02:00
2 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,49 @@
//! ToDo
use bevy::prelude::*;
use crate::CurrentScene;
/// The plugin that sets up the UI for the game.
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.
pub mod game_ui;
pub mod hover;
pub mod responsive_scale;
use bevy::prelude::*;
use self::game_ui::GameUiPlugin;
use self::hover::HoverPlugin;
use self::responsive_scale::ResponsiveScalingPlugin;
@ -14,6 +16,7 @@ pub struct UiPlugin;
impl Plugin for UiPlugin {
fn build(&self, app: &mut App) {
app.add_plugins(HoverPlugin)
.add_plugins(ResponsiveScalingPlugin);
.add_plugins(ResponsiveScalingPlugin)
.add_plugins(GameUiPlugin);
}
}