mirror of
https://codeberg.org/schrottkatze/mgd2-tram-championships.git
synced 2025-06-11 02:27:39 +00:00
menu system: system dispatching (and the menus can now be closed)
This commit is contained in:
parent
acbcfe5956
commit
fc83ab8452
7 changed files with 202 additions and 132 deletions
37
src/menus/lib/plugin/components.rs
Normal file
37
src/menus/lib/plugin/components.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
use crate::menus::lib::OnPressAction;
|
||||
|
||||
use super::Action;
|
||||
|
||||
pub fn text(t: String) -> impl Bundle {
|
||||
(
|
||||
Text::new(t),
|
||||
TextFont {
|
||||
// font: asset_server.load("fonts/FiraSans-Bold.ttf"),
|
||||
font_size: 33.0,
|
||||
..default()
|
||||
},
|
||||
TextColor(Color::srgb(0.9, 0.9, 0.9)),
|
||||
TextShadow::default(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn button(t: String) -> impl Bundle {
|
||||
(
|
||||
Button,
|
||||
Node {
|
||||
border: UiRect::all(Val::Px(5.0)),
|
||||
// horizontally center child text
|
||||
justify_content: JustifyContent::Center,
|
||||
// vertically center child text
|
||||
align_items: AlignItems::Center,
|
||||
padding: UiRect::all(Val::Px(10.0)),
|
||||
..default()
|
||||
},
|
||||
BorderColor(Color::BLACK),
|
||||
BorderRadius::MAX,
|
||||
BackgroundColor(Color::srgb(0.2, 0.2, 0.2)),
|
||||
children![text(t)],
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue