menu system: system dispatching (and the menus can now be closed)

This commit is contained in:
Schrottkatze 2025-06-02 22:20:25 +02:00
parent acbcfe5956
commit fc83ab8452
Signed by: schrottkatze
SSH key fingerprint: SHA256:FPOYVeBy3QP20FEM42uWF1Wa/Qhlk+L3S2+Wuau/Auo
7 changed files with 202 additions and 132 deletions

View 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)],
)
}