mirror of
https://github.com/bevyengine/bevy
synced 2025-01-03 00:38:56 +00:00
33a4df8008
# Objective - Fix https://github.com/bevyengine/bevy/issues/4688 ## Solution - Fixes https://github.com/bevyengine/bevy/issues/4688 - This raises an interesting question about our change detection system - is filtered queries actually a good UX for this? They're ergonomic in the easy case, but what do we recommend when it's not so. - In this case, the system should have been migrated similary to https://github.com/bevyengine/bevy/pull/4180 anyway, so I've done that.
62 lines
1.6 KiB
Rust
62 lines
1.6 KiB
Rust
mod error;
|
|
mod font;
|
|
mod font_atlas;
|
|
mod font_atlas_set;
|
|
mod font_loader;
|
|
mod glyph_brush;
|
|
mod pipeline;
|
|
mod text;
|
|
mod text2d;
|
|
|
|
pub use error::*;
|
|
pub use font::*;
|
|
pub use font_atlas::*;
|
|
pub use font_atlas_set::*;
|
|
pub use font_loader::*;
|
|
pub use glyph_brush::*;
|
|
pub use pipeline::*;
|
|
pub use text::*;
|
|
pub use text2d::*;
|
|
|
|
pub mod prelude {
|
|
#[doc(hidden)]
|
|
pub use crate::{
|
|
Font, HorizontalAlign, Text, Text2dBundle, TextAlignment, TextError, TextSection,
|
|
TextStyle, VerticalAlign,
|
|
};
|
|
}
|
|
|
|
use bevy_app::prelude::*;
|
|
use bevy_asset::AddAsset;
|
|
use bevy_ecs::{entity::Entity, schedule::ParallelSystemDescriptorCoercion};
|
|
use bevy_render::{RenderApp, RenderStage};
|
|
use bevy_sprite::SpriteSystem;
|
|
use bevy_window::ModifiesWindows;
|
|
|
|
pub type DefaultTextPipeline = TextPipeline<Entity>;
|
|
|
|
#[derive(Default)]
|
|
pub struct TextPlugin;
|
|
|
|
impl Plugin for TextPlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_asset::<Font>()
|
|
.add_asset::<FontAtlasSet>()
|
|
.register_type::<Text>()
|
|
.register_type::<VerticalAlign>()
|
|
.register_type::<HorizontalAlign>()
|
|
.init_asset_loader::<FontLoader>()
|
|
.insert_resource(DefaultTextPipeline::default())
|
|
.add_system_to_stage(
|
|
CoreStage::PostUpdate,
|
|
update_text2d_layout.after(ModifiesWindows),
|
|
);
|
|
|
|
if let Ok(render_app) = app.get_sub_app_mut(RenderApp) {
|
|
render_app.add_system_to_stage(
|
|
RenderStage::Extract,
|
|
extract_text2d_sprite.after(SpriteSystem::ExtractSprites),
|
|
);
|
|
}
|
|
}
|
|
}
|