From 81c4ee562480cb4847ad4a66ca822b34306cb769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= Date: Sun, 12 Nov 2023 16:22:25 +0100 Subject: [PATCH] reduce changelog in examples --- examples/2d/text2d.rs | 4 ++-- examples/games/contributors.rs | 4 ++-- examples/input/text_input.rs | 14 +++++++------- examples/stress_tests/text_pipeline.rs | 4 ++-- examples/ui/button.rs | 2 +- examples/ui/flex_layout.rs | 2 +- examples/ui/font_atlas_debug.rs | 2 +- examples/ui/grid.rs | 6 +++--- examples/ui/overflow.rs | 2 +- examples/ui/overflow_debug.rs | 4 ++-- examples/ui/relative_cursor_position.rs | 2 +- examples/ui/size_constraints.rs | 2 +- examples/ui/text.rs | 2 +- examples/ui/text_debug.rs | 18 +++++++++--------- examples/ui/text_wrap_debug.rs | 2 +- examples/ui/transparency_ui.rs | 4 ++-- examples/ui/ui.rs | 7 +++---- examples/ui/ui_scaling.rs | 2 +- examples/ui/window_fallthrough.rs | 2 +- 19 files changed, 42 insertions(+), 43 deletions(-) diff --git a/examples/2d/text2d.rs b/examples/2d/text2d.rs index aa7786264b5e6a..18a959bef1c2a5 100644 --- a/examples/2d/text2d.rs +++ b/examples/2d/text2d.rs @@ -34,7 +34,7 @@ struct AnimateScale; fn setup(mut commands: Commands, asset_server: Res) { 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, }; @@ -68,7 +68,7 @@ fn setup(mut commands: Commands, asset_server: Res) { )); // Demonstrate text wrapping let slightly_smaller_text_style = TextStyle { - font: font.into(), + font, font_size: 42.0, color: Color::WHITE, }; diff --git a/examples/games/contributors.rs b/examples/games/contributors.rs index bdb97e83d20522..4fd8309a2f8f51 100644 --- a/examples/games/contributors.rs +++ b/examples/games/contributors.rs @@ -147,13 +147,13 @@ fn setup(mut commands: Commands, asset_server: Res) { 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() }), diff --git a/examples/input/text_input.rs b/examples/input/text_input.rs index c2fc799d70a296..b6e9ad5b04735d 100644 --- a/examples/input/text_input.rs +++ b/examples/input/text_input.rs @@ -37,7 +37,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { TextSection { value: "IME Enabled: ".to_string(), style: TextStyle { - font: font.clone_weak().into(), + font: font.clone_weak(), font_size: 20.0, ..default() }, @@ -45,7 +45,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { TextSection { value: "false\n".to_string(), style: TextStyle { - font: font.clone_weak().into(), + font: font.clone_weak(), font_size: 30.0, ..default() }, @@ -53,7 +53,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { TextSection { value: "IME Active: ".to_string(), style: TextStyle { - font: font.clone_weak().into(), + font: font.clone_weak(), font_size: 20.0, ..default() }, @@ -61,7 +61,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { TextSection { value: "false\n".to_string(), style: TextStyle { - font: font.clone_weak().into(), + font: font.clone_weak(), font_size: 30.0, ..default() }, @@ -69,7 +69,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { 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() }, @@ -77,7 +77,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { TextSection { value: "".to_string(), style: TextStyle { - font: font.into(), + font, font_size: 25.0, ..default() }, @@ -95,7 +95,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { 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() }, diff --git a/examples/stress_tests/text_pipeline.rs b/examples/stress_tests/text_pipeline.rs index 38b9b20a29e42a..c4781294a4dab5 100644 --- a/examples/stress_tests/text_pipeline.rs +++ b/examples/stress_tests/text_pipeline.rs @@ -39,7 +39,7 @@ fn spawn(mut commands: Commands, asset_server: Res) { 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, }, @@ -47,7 +47,7 @@ fn spawn(mut commands: Commands, asset_server: Res) { 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, }, diff --git a/examples/ui/button.rs b/examples/ui/button.rs index 4903b6f95e04f9..5e37068572b6ae 100644 --- a/examples/ui/button.rs +++ b/examples/ui/button.rs @@ -90,7 +90,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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), }, diff --git a/examples/ui/flex_layout.rs b/examples/ui/flex_layout.rs index a169bd27d4332d..3b597ebeaa0ca6 100644 --- a/examples/ui/flex_layout.rs +++ b/examples/ui/flex_layout.rs @@ -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, }, diff --git a/examples/ui/font_atlas_debug.rs b/examples/ui/font_atlas_debug.rs index c05cee721940f6..04da0f848268a2 100644 --- a/examples/ui/font_atlas_debug.rs +++ b/examples/ui/font_atlas_debug.rs @@ -92,7 +92,7 @@ fn setup(mut commands: Commands, asset_server: Res, mut state: ResM parent.spawn(TextBundle::from_section( "a", TextStyle { - font: font_handle.into(), + font: font_handle, font_size: 60.0, color: Color::YELLOW, }, diff --git a/examples/ui/grid.rs b/examples/ui/grid.rs index dc78e1c9cf4d3d..12a2efba165766 100644 --- a/examples/ui/grid.rs +++ b/examples/ui/grid.rs @@ -142,7 +142,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res) { builder.spawn(TextBundle::from_section( "Sidebar", TextStyle { - font: font.clone().into(), + font: font.clone(), font_size: 24.0, ..default() }, @@ -150,7 +150,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res) { 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() }, @@ -222,7 +222,7 @@ fn spawn_nested_text_bundle(builder: &mut ChildBuilder, font: Handle, text builder.spawn(TextBundle::from_section( text, TextStyle { - font: font.into(), + font, font_size: 24.0, color: Color::BLACK, }, diff --git a/examples/ui/overflow.rs b/examples/ui/overflow.rs index b4cefd356d4bae..433456f6a9d0e3 100644 --- a/examples/ui/overflow.rs +++ b/examples/ui/overflow.rs @@ -15,7 +15,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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() }; diff --git a/examples/ui/overflow_debug.rs b/examples/ui/overflow_debug.rs index 5dc69ed1625300..2cf1470c70f054 100644 --- a/examples/ui/overflow_debug.rs +++ b/examples/ui/overflow_debug.rs @@ -108,7 +108,7 @@ fn setup(mut commands: Commands, asset_server: Res) { ] .join(" ยท "), TextStyle { - font: asset_server.load("fonts/FiraSans-Bold.ttf").into(), + font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 18.0, ..default() }, @@ -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() }, diff --git a/examples/ui/relative_cursor_position.rs b/examples/ui/relative_cursor_position.rs index 84e3a840e60f92..84b9fa2fe19d4a 100644 --- a/examples/ui/relative_cursor_position.rs +++ b/examples/ui/relative_cursor_position.rs @@ -45,7 +45,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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), }, diff --git a/examples/ui/size_constraints.rs b/examples/ui/size_constraints.rs index 7402f2b2ace825..72daae989dee38 100644 --- a/examples/ui/size_constraints.rs +++ b/examples/ui/size_constraints.rs @@ -43,7 +43,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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), }; diff --git a/examples/ui/text.rs b/examples/ui/text.rs index b49ebd3eddae83..dc565756531417 100644 --- a/examples/ui/text.rs +++ b/examples/ui/text.rs @@ -34,7 +34,7 @@ fn setup(mut commands: Commands, asset_server: Res) { // 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() }, diff --git a/examples/ui/text_debug.rs b/examples/ui/text_debug.rs index a2041d727106ac..15229bb2820b13 100644 --- a/examples/ui/text_debug.rs +++ b/examples/ui/text_debug.rs @@ -33,7 +33,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res) { 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() }, @@ -48,7 +48,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res) { 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), }, @@ -67,7 +67,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res) { TextSection::new( "This text changes in the bottom right", TextStyle { - font: font.clone().into(), + font: font.clone(), font_size: 30.0, color: Color::WHITE, }, @@ -75,33 +75,33 @@ fn infotext_system(mut commands: Commands, asset_server: Res) { 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, }, @@ -119,7 +119,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res) { 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, }, diff --git a/examples/ui/text_wrap_debug.rs b/examples/ui/text_wrap_debug.rs index 3c718ab1bc1319..d1d9c1af40d5de 100644 --- a/examples/ui/text_wrap_debug.rs +++ b/examples/ui/text_wrap_debug.rs @@ -44,7 +44,7 @@ fn spawn(mut commands: Commands, asset_server: Res) { 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() }; diff --git a/examples/ui/transparency_ui.rs b/examples/ui/transparency_ui.rs index 0ab98cc7b1d506..2aabe43dc85d0e 100644 --- a/examples/ui/transparency_ui.rs +++ b/examples/ui/transparency_ui.rs @@ -44,7 +44,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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), @@ -70,7 +70,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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), diff --git a/examples/ui/ui.rs b/examples/ui/ui.rs index c8ca9e16335138..21817b62e7f76d 100644 --- a/examples/ui/ui.rs +++ b/examples/ui/ui.rs @@ -64,7 +64,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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() }, @@ -99,7 +99,7 @@ fn setup(mut commands: Commands, asset_server: Res) { 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() }, @@ -142,8 +142,7 @@ fn setup(mut commands: Commands, asset_server: Res) { format!("Item {i}"), TextStyle { font: asset_server - .load("fonts/FiraSans-Bold.ttf") - .into(), + .load("fonts/FiraSans-Bold.ttf"), font_size: 20., ..default() }, diff --git a/examples/ui/ui_scaling.rs b/examples/ui/ui_scaling.rs index fbcf8619f7993f..a07f54f013a73d 100644 --- a/examples/ui/ui_scaling.rs +++ b/examples/ui/ui_scaling.rs @@ -28,7 +28,7 @@ fn setup(mut commands: Commands, asset_server: ResMut) { 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, }; diff --git a/examples/ui/window_fallthrough.rs b/examples/ui/window_fallthrough.rs index 853f16150dde74..5fbd7eadce8098 100644 --- a/examples/ui/window_fallthrough.rs +++ b/examples/ui/window_fallthrough.rs @@ -32,7 +32,7 @@ fn setup(mut commands: Commands, asset_server: Res) { // 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() },