Skip to content

Commit

Permalink
reduce changelog in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
TotalKrill committed Nov 12, 2023
1 parent 4da3a40 commit 81c4ee5
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 43 deletions.
4 changes: 2 additions & 2 deletions examples/2d/text2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct AnimateScale;
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let font = asset_server.load("fonts/FiraSans-Bold.ttf");
let text_style = TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 60.0,
color: Color::WHITE,
};
Expand Down Expand Up @@ -68,7 +68,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
));
// Demonstrate text wrapping
let slightly_smaller_text_style = TextStyle {
font: font.into(),
font,
font_size: 42.0,
color: Color::WHITE,
};
Expand Down
4 changes: 2 additions & 2 deletions examples/games/contributors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextSection::new(
"Contributor showcase",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 60.0,
..default()
},
),
TextSection::from_style(TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 60.0,
..default()
}),
Expand Down
14 changes: 7 additions & 7 deletions examples/input/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,47 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
TextSection {
value: "IME Enabled: ".to_string(),
style: TextStyle {
font: font.clone_weak().into(),
font: font.clone_weak(),
font_size: 20.0,
..default()
},
},
TextSection {
value: "false\n".to_string(),
style: TextStyle {
font: font.clone_weak().into(),
font: font.clone_weak(),
font_size: 30.0,
..default()
},
},
TextSection {
value: "IME Active: ".to_string(),
style: TextStyle {
font: font.clone_weak().into(),
font: font.clone_weak(),
font_size: 20.0,
..default()
},
},
TextSection {
value: "false\n".to_string(),
style: TextStyle {
font: font.clone_weak().into(),
font: font.clone_weak(),
font_size: 30.0,
..default()
},
},
TextSection {
value: "click to toggle IME, press return to start a new line\n\n".to_string(),
style: TextStyle {
font: font.clone_weak().into(),
font: font.clone_weak(),
font_size: 18.0,
..default()
},
},
TextSection {
value: "".to_string(),
style: TextStyle {
font: font.into(),
font,
font_size: 25.0,
..default()
},
Expand All @@ -95,7 +95,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
text: Text::from_section(
"".to_string(),
TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf").into(),
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 100.0,
..default()
},
Expand Down
4 changes: 2 additions & 2 deletions examples/stress_tests/text_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ fn spawn(mut commands: Commands, asset_server: Res<AssetServer>) {
TextSection {
value: "text".repeat(i),
style: TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf").into(),
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: (4 + i % 10) as f32,
color: Color::BLUE,
},
},
TextSection {
value: "pipeline".repeat(i),
style: TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: (4 + i % 11) as f32,
color: Color::YELLOW,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
parent.spawn(TextBundle::from_section(
"Button",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0,
color: Color::rgb(0.9, 0.9, 0.9),
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/flex_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ fn spawn_nested_text_bundle(
builder.spawn(TextBundle::from_section(
text,
TextStyle {
font: font.into(),
font,
font_size: 24.0,
color: Color::BLACK,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/font_atlas_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut state: ResM
parent.spawn(TextBundle::from_section(
"a",
TextStyle {
font: font_handle.into(),
font: font_handle,
font_size: 60.0,
color: Color::YELLOW,
},
Expand Down
6 changes: 3 additions & 3 deletions examples/ui/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ fn spawn_layout(mut commands: Commands, asset_server: Res<AssetServer>) {
builder.spawn(TextBundle::from_section(
"Sidebar",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 24.0,
..default()
},
));
builder.spawn(TextBundle::from_section(
"A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely. A paragraph of text which ought to wrap nicely.",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 16.0,
..default()
},
Expand Down Expand Up @@ -222,7 +222,7 @@ fn spawn_nested_text_bundle(builder: &mut ChildBuilder, font: Handle<Font>, text
builder.spawn(TextBundle::from_section(
text,
TextStyle {
font: font.into(),
font,
font_size: 24.0,
color: Color::BLACK,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());

let text_style = TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf").into(),
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 20.0,
..default()
};
Expand Down
4 changes: 2 additions & 2 deletions examples/ui/overflow_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
]
.join(" · "),
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 18.0,
..default()
},
Expand Down Expand Up @@ -183,7 +183,7 @@ fn spawn_text(
parent.spawn(TextBundle::from_section(
"Bevy",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 120.0,
..default()
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/relative_cursor_position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
text: Text::from_section(
"(0.0, 0.0)",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0,
color: Color::rgb(0.9, 0.9, 0.9),
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/size_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());

let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 40.0,
color: Color::rgb(0.9, 0.9, 0.9),
};
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// Accepts a `String` or any type that converts into a `String`, such as `&str`
"hello\nbevy!",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 100.0 / 1.2,
..default()
},
Expand Down
18 changes: 9 additions & 9 deletions examples/ui/text_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
TextBundle::from_section(
"This is\ntext with\nline breaks\nin the top left",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 50.0,
..default()
},
Expand All @@ -48,7 +48,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(TextBundle::from_section(
"This text is very long, has a limited width, is centered, is positioned in the top right and is also colored pink.",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 50.0,
color: Color::rgb(0.8, 0.2, 0.7),
},
Expand All @@ -67,41 +67,41 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
TextSection::new(
"This text changes in the bottom right",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 30.0,
color: Color::WHITE,
},
),
TextSection::new(
"\nThis text changes in the bottom right - ",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 30.0,
color: Color::RED,
},
),
TextSection::from_style(TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 30.0,
color: Color::ORANGE_RED,
}),
TextSection::new(
" fps, ",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 30.0,
color: Color::YELLOW,
},
),
TextSection::from_style(TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 30.0,
color: Color::GREEN,
}),
TextSection::new(
" ms/frame",
TextStyle {
font: font.clone().into(),
font: font.clone(),
font_size: 30.0,
color: Color::BLUE,
},
Expand All @@ -119,7 +119,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
TextBundle::from_section(
"This\ntext has\nline breaks and also a set width in the bottom left",
TextStyle {
font: font.into(),
font,
font_size: 50.0,
color: Color::WHITE,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/text_wrap_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn spawn(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());

let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 14.0,
..default()
};
Expand Down
4 changes: 2 additions & 2 deletions examples/ui/transparency_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
parent.spawn(TextBundle::from_section(
"Button 1",
TextStyle {
font: font_handle.clone().into(),
font: font_handle.clone(),
font_size: 40.0,
// Alpha channel of the color controls transparency.
color: Color::rgba(1.0, 1.0, 1.0, 0.2),
Expand All @@ -70,7 +70,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
parent.spawn(TextBundle::from_section(
"Button 2",
TextStyle {
font: font_handle.clone().into(),
font: font_handle.clone(),
font_size: 40.0,
// Alpha channel of the color controls transparency.
color: Color::rgba(1.0, 1.0, 1.0, 0.2),
Expand Down
7 changes: 3 additions & 4 deletions examples/ui/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextBundle::from_section(
"Text Example",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 30.0,
..default()
},
Expand Down Expand Up @@ -99,7 +99,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextBundle::from_section(
"Scrolling list",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 25.,
..default()
},
Expand Down Expand Up @@ -142,8 +142,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
format!("Item {i}"),
TextStyle {
font: asset_server
.load("fonts/FiraSans-Bold.ttf")
.into(),
.load("fonts/FiraSans-Bold.ttf"),
font_size: 20.,
..default()
},
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/ui_scaling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn setup(mut commands: Commands, asset_server: ResMut<AssetServer>) {
commands.spawn(Camera2dBundle::default());

let text_style = TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf").into(),
font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 16.,
color: Color::BLACK,
};
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/window_fallthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// Accepts a `String` or any type that converts into a `String`, such as `&str`
"Hit 'P' then scroll/click around!",
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf").into(),
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 100.0, // Nice and big so you can see it!
..default()
},
Expand Down

0 comments on commit 81c4ee5

Please sign in to comment.