mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 13:13:49 +00:00
UI/text Example - Clarity Improvements (#16302)
# Objective - Fixes #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
This commit is contained in:
parent
1e3ecbefdb
commit
fb607b1bd1
1 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue