diff --git a/examples/input/text_input.rs b/examples/input/text_input.rs index 97248564d3..a1036d854f 100644 --- a/examples/input/text_input.rs +++ b/examples/input/text_input.rs @@ -34,33 +34,30 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { // sections that will hold text input. let font = asset_server.load("fonts/FiraMono-Medium.ttf"); - commands - .spawn(( - Text::default(), - Node { - position_type: PositionType::Absolute, - top: Val::Px(12.0), - left: Val::Px(12.0), - ..default() - }, - )) - .with_children(|p| { - p.spawn(TextSpan::new( - "Click to toggle IME. Press return to start a new line.\n\n", - )); - p.spawn(TextSpan::new("IME Enabled: ")); - p.spawn(TextSpan::new("false\n")); - p.spawn(TextSpan::new("IME Active: ")); - p.spawn(TextSpan::new("false\n")); - p.spawn(TextSpan::new("IME Buffer: ")); - p.spawn(( + commands.spawn(( + Text::default(), + Node { + position_type: PositionType::Absolute, + top: Val::Px(12.0), + left: Val::Px(12.0), + ..default() + }, + children![ + TextSpan::new("Click to toggle IME. Press return to start a new line.\n\n",), + TextSpan::new("IME Enabled: "), + TextSpan::new("false\n"), + TextSpan::new("IME Active: "), + TextSpan::new("false\n"), + TextSpan::new("IME Buffer: "), + ( TextSpan::new("\n"), TextFont { font: font.clone(), ..default() }, - )); - }); + ), + ], + )); commands.spawn(( Text2d::new(""), diff --git a/examples/time/virtual_time.rs b/examples/time/virtual_time.rs index 1139ee6d2f..09923da7b7 100644 --- a/examples/time/virtual_time.rs +++ b/examples/time/virtual_time.rs @@ -76,8 +76,8 @@ fn setup(mut commands: Commands, asset_server: Res, mut time: ResMu // info UI let font_size = 33.; - commands - .spawn(Node { + commands.spawn(( + Node { display: Display::Flex, justify_content: JustifyContent::SpaceBetween, width: Val::Percent(100.), @@ -85,20 +85,17 @@ fn setup(mut commands: Commands, asset_server: Res, mut time: ResMu top: Val::Px(0.), padding: UiRect::all(Val::Px(20.0)), ..default() - }) - .with_children(|builder| { - // real time info - builder.spawn(( + }, + children![ + ( Text::default(), TextFont { font_size, ..default() }, RealTime, - )); - - // keybindings - builder.spawn(( + ), + ( Text::new("CONTROLS\nUn/Pause: Space\nSpeed+: Up\nSpeed-: Down"), TextFont { font_size, @@ -106,10 +103,8 @@ fn setup(mut commands: Commands, asset_server: Res, mut time: ResMu }, TextColor(Color::srgb(0.85, 0.85, 0.85)), TextLayout::new_with_justify(JustifyText::Center), - )); - - // virtual time info - builder.spawn(( + ), + ( Text::default(), TextFont { font_size, @@ -118,8 +113,9 @@ fn setup(mut commands: Commands, asset_server: Res, mut time: ResMu TextColor(virtual_color), TextLayout::new_with_justify(JustifyText::Right), VirtualTime, - )); - }); + ), + ], + )); } /// Move sprites using `Real` (unscaled) time