Skip to content

Commit

Permalink
UI/text Example - Clarity Improvements (bevyengine#16302)
Browse files Browse the repository at this point in the history
# Objective

- Fixes bevyengine#16292 

## Solution

- Renames the `ColorText` marker to `AnimatedText`, which is more
distinct from the `TextColor` Bevy component.
- Changes the comment language from `A unit struct` to `Marker struct`
for better consistency with other Bevy docs.

## Testing

- Locally, example still runs just fine
  • Loading branch information
TurtIeSocks authored Nov 9, 2024
1 parent 1e3ecbe commit fb607b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/ui/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ fn main() {
.run();
}

// A unit struct to help identify the FPS UI component, since there may be many Text components
// Marker struct to help identify the FPS UI component, since there may be many Text components
#[derive(Component)]
struct FpsText;

// A unit struct to help identify the color-changing Text component
// Marker struct to help identify the color-changing Text component
#[derive(Component)]
struct ColorText;
struct AnimatedText;

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// UI camera
Expand All @@ -47,7 +47,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
right: Val::Px(5.0),
..default()
},
ColorText,
AnimatedText,
));

// Text with multiple sections
Expand Down Expand Up @@ -116,7 +116,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
));
}

fn text_color_system(time: Res<Time>, mut query: Query<&mut TextColor, With<ColorText>>) {
fn text_color_system(time: Res<Time>, mut query: Query<&mut TextColor, With<AnimatedText>>) {
for mut text_color in &mut query {
let seconds = time.elapsed_secs();

Expand Down

0 comments on commit fb607b1

Please sign in to comment.