diff --git a/crates/bevy_dev_tools/src/fps_overlay.rs b/crates/bevy_dev_tools/src/fps_overlay.rs index c846fff492d2b..6b020910fb2da 100644 --- a/crates/bevy_dev_tools/src/fps_overlay.rs +++ b/crates/bevy_dev_tools/src/fps_overlay.rs @@ -17,7 +17,7 @@ use bevy_render::view::Visibility; use bevy_text::{Font, TextColor, TextFont, TextSpan}; use bevy_ui::{ node_bundles::NodeBundle, - widget::{Text, UiTextWriter}, + widget::{Text, TextUiWriter}, GlobalZIndex, PositionType, Style, }; use bevy_utils::default; @@ -114,7 +114,7 @@ fn setup(mut commands: Commands, overlay_config: Res) { fn update_text( diagnostic: Res, query: Query>, - mut writer: UiTextWriter, + mut writer: TextUiWriter, ) { for entity in &query { if let Some(fps) = diagnostic.get(&FrameTimeDiagnosticsPlugin::FPS) { @@ -128,7 +128,7 @@ fn update_text( fn customize_text( overlay_config: Res, query: Query>, - mut writer: UiTextWriter, + mut writer: TextUiWriter, ) { for entity in &query { writer.for_each_font(entity, |mut font| { diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index da68e5aecb3c9..9d8b664c96da5 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -63,10 +63,13 @@ pub use text_access::*; /// /// This includes the most common types in this crate, re-exported for your convenience. pub mod prelude { + #[doc(hidden)] + #[allow(deprecated)] + pub use crate::Text2dBundle; #[doc(hidden)] pub use crate::{ - Font, JustifyText, LineBreak, Text2d, TextColor, TextError, TextFont, TextLayout, - TextReader2d, TextSpan, TextWriter2d, + Font, JustifyText, LineBreak, Text2d, Text2dReader, Text2dWriter, TextColor, TextError, + TextFont, TextLayout, TextSpan, }; } diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index ad4eacd25ba3b..509108cb501e2 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -32,6 +32,18 @@ use bevy_transform::prelude::GlobalTransform; use bevy_utils::HashSet; use bevy_window::{PrimaryWindow, Window, WindowScaleFactorChanged}; +/// [`Text2dBundle`] was removed in favor of required components. +/// The core component is now [`Text2d`] which can contain a single text segment. +/// Indexed access to segments can be done with the new [`Text2dReader`] and [`Text2dWriter`] system params. +/// Additional segments can be added through children with [`TextSpan`](crate::text::TextSpan). +/// Text configuration can be done with [`TextLayout`], [`TextFont`] and [`TextColor`], +/// while sprite-related configuration uses [`TextBounds`] and [`Anchor`] components. +#[deprecated( + since = "0.15.0", + note = "Text2dBundle has been migrated to required components. Follow the documentation for more information." +)] +pub struct Text2dBundle {} + /// The top-level 2D text component. /// /// Adding `Text2d` to an entity will pull in required components for setting up 2d text. @@ -120,10 +132,10 @@ impl From for Text2d { } /// 2d alias for [`TextReader`]. -pub type TextReader2d<'w, 's> = TextReader<'w, 's, Text2d>; +pub type Text2dReader<'w, 's> = TextReader<'w, 's, Text2d>; /// 2d alias for [`TextWriter`]. -pub type TextWriter2d<'w, 's> = TextWriter<'w, 's, Text2d>; +pub type Text2dWriter<'w, 's> = TextWriter<'w, 's, Text2d>; /// This system extracts the sprites from the 2D text components and adds them to the /// "render world". @@ -239,7 +251,7 @@ pub fn update_text2d_layout( &mut TextLayoutInfo, &mut ComputedTextBlock, )>, - mut text_reader: TextReader2d, + mut text_reader: Text2dReader, mut font_system: ResMut, mut swash_cache: ResMut, ) { diff --git a/crates/bevy_text/src/text_access.rs b/crates/bevy_text/src/text_access.rs index e5699328f8233..a0c3409282770 100644 --- a/crates/bevy_text/src/text_access.rs +++ b/crates/bevy_text/src/text_access.rs @@ -45,7 +45,7 @@ impl TextIterScratch { /// System parameter for reading text spans in a text block. /// -/// `R` is the root text component, and `S` is the text span component on children. +/// `R` is the root text component. #[derive(SystemParam)] pub struct TextReader<'w, 's, R: TextRoot> { // This is a local to avoid system ambiguities when TextReaders run in parallel. diff --git a/crates/bevy_ui/src/accessibility.rs b/crates/bevy_ui/src/accessibility.rs index 69c1b824ed8fb..2a5944f40a371 100644 --- a/crates/bevy_ui/src/accessibility.rs +++ b/crates/bevy_ui/src/accessibility.rs @@ -1,6 +1,6 @@ use crate::{ prelude::{Button, Label}, - widget::UiTextReader, + widget::TextUiReader, Node, UiChildren, UiImage, }; use bevy_a11y::{ @@ -19,7 +19,7 @@ use bevy_render::{camera::CameraUpdateSystem, prelude::Camera}; use bevy_transform::prelude::GlobalTransform; fn calc_name( - text_reader: &mut UiTextReader, + text_reader: &mut TextUiReader, children: impl Iterator, ) -> Option> { let mut name = None; @@ -62,7 +62,7 @@ fn button_changed( mut commands: Commands, mut query: Query<(Entity, Option<&mut AccessibilityNode>), Changed