2024-02-03 21:15:30 -06:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
|
|
|
#[derive(Component, Debug)]
|
|
|
|
pub struct MainMenu;
|
|
|
|
|
2024-07-31 15:37:11 -05:00
|
|
|
pub fn startup(mut commands: Commands) {
|
2024-02-03 21:15:30 -06:00
|
|
|
commands
|
2024-07-29 16:29:39 -05:00
|
|
|
.spawn((
|
|
|
|
MainMenu,
|
|
|
|
NodeBundle {
|
|
|
|
style: Style {
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
height: Val::Percent(100.0),
|
|
|
|
justify_content: JustifyContent::SpaceBetween,
|
|
|
|
..default()
|
|
|
|
},
|
2024-02-03 21:15:30 -06:00
|
|
|
..default()
|
|
|
|
},
|
2024-07-29 16:29:39 -05:00
|
|
|
))
|
2024-02-03 21:15:30 -06:00
|
|
|
.with_children(|parent| {
|
|
|
|
// text
|
|
|
|
parent.spawn((
|
|
|
|
TextBundle::from_section(
|
2024-07-29 16:36:16 -05:00
|
|
|
"Text Example\nPress ENTER to play",
|
2024-02-03 21:15:30 -06:00
|
|
|
TextStyle {
|
2024-07-29 17:03:26 -05:00
|
|
|
font_size: 100.0,
|
2024-02-03 21:15:30 -06:00
|
|
|
..default()
|
|
|
|
},
|
|
|
|
)
|
|
|
|
.with_style(Style {
|
|
|
|
margin: UiRect::all(Val::Px(12.)),
|
|
|
|
..default()
|
|
|
|
}),
|
|
|
|
// Because this is a distinct label widget and
|
|
|
|
// not button/list item text, this is necessary
|
|
|
|
// for accessibility to treat the text accordingly.
|
|
|
|
Label,
|
|
|
|
));
|
|
|
|
|
|
|
|
parent.spawn(NodeBundle {
|
|
|
|
style: Style {
|
|
|
|
width: Val::Px(200.0),
|
|
|
|
height: Val::Px(200.0),
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
left: Val::Px(210.),
|
|
|
|
bottom: Val::Px(10.),
|
|
|
|
border: UiRect::all(Val::Px(20.)),
|
|
|
|
..default()
|
|
|
|
},
|
2024-07-30 11:16:36 -05:00
|
|
|
border_color: Color::srgb(0., 1., 0.).into(),
|
|
|
|
background_color: Color::srgb(0.4, 0.4, 1.).into(),
|
2024-02-03 21:15:30 -06:00
|
|
|
..default()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2024-07-29 16:29:39 -05:00
|
|
|
|
|
|
|
pub fn exit(mut commands: Commands, q: Query<Entity, With<MainMenu>>) {
|
|
|
|
for id in q.iter() {
|
|
|
|
commands.entity(id).despawn_recursive();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-31 15:37:11 -05:00
|
|
|
pub fn update() {}
|