bevy/crates/bevy_text/src/lib.rs

63 lines
1.6 KiB
Rust
Raw Normal View History

mod error;
2020-05-13 20:09:32 +00:00
mod font;
mod font_atlas;
mod font_atlas_set;
2020-06-15 19:47:35 +00:00
mod font_loader;
mod glyph_brush;
mod pipeline;
mod text;
mod text2d;
2020-05-13 20:09:32 +00:00
pub use error::*;
2020-05-13 20:09:32 +00:00
pub use font::*;
pub use font_atlas::*;
pub use font_atlas_set::*;
2020-06-15 19:47:35 +00:00
pub use font_loader::*;
pub use glyph_brush::*;
pub use pipeline::*;
pub use text::*;
pub use text2d::*;
2020-05-16 02:46:09 +00:00
2020-07-17 02:34:18 +00:00
pub mod prelude {
#[doc(hidden)]
pub use crate::{
Font, HorizontalAlign, Text, Text2dBundle, TextAlignment, TextError, TextSection,
TextStyle, VerticalAlign,
};
2020-07-17 02:34:18 +00:00
}
2020-07-17 01:47:51 +00:00
use bevy_app::prelude::*;
2020-05-16 02:46:09 +00:00
use bevy_asset::AddAsset;
use bevy_ecs::schedule::ParallelSystemDescriptorCoercion;
use bevy_render::{RenderApp, RenderStage};
use bevy_sprite::SpriteSystem;
use bevy_window::ModifiesWindows;
2020-05-16 02:46:09 +00:00
#[derive(Default)]
pub struct TextPlugin;
2020-08-08 03:22:17 +00:00
impl Plugin for TextPlugin {
fn build(&self, app: &mut App) {
2020-05-22 00:21:33 +00:00
app.add_asset::<Font>()
.add_asset::<FontAtlasSet>()
.register_type::<Text>()
.register_type::<TextSection>()
.register_type::<TextAlignment>()
.register_type::<VerticalAlign>()
.register_type::<HorizontalAlign>()
.init_asset_loader::<FontLoader>()
.insert_resource(TextPipeline::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),
);
}
2020-05-16 02:46:09 +00:00
}
2020-06-04 03:08:20 +00:00
}