Skip to content

Commit

Permalink
Updated text2d example to include multiple text spans.
Browse files Browse the repository at this point in the history
  • Loading branch information
ickshonpe committed Jan 11, 2025
1 parent 10dfec4 commit c670e19
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions examples/2d/text2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
(Anchor::BottomRight, Color::Srgba(BLUE)),
(Anchor::BottomLeft, Color::Srgba(YELLOW)),
] {
commands.spawn((
Text2d::new(format!(" Anchor::{text_anchor:?} ")),
slightly_smaller_text_font.clone(),
TextColor(color),
Transform::from_translation(250. * Vec3::Y),
text_anchor,
));
commands
.spawn((
Text2d::new(" Anchor::".to_string()),
slightly_smaller_text_font.clone(),
Transform::from_translation(250. * Vec3::Y),
text_anchor,
))
.with_child((
TextSpan(format!("{text_anchor:?} ")),
slightly_smaller_text_font.clone(),
TextColor(color),
));
}
}

Expand Down

0 comments on commit c670e19

Please sign in to comment.