2020-06-15 19:47:35 +00:00
|
|
|
mod draw;
|
2020-11-13 00:21:48 +00:00
|
|
|
mod error;
|
2020-05-13 20:09:32 +00:00
|
|
|
mod font;
|
2020-06-14 01:53:31 +00:00
|
|
|
mod font_atlas;
|
|
|
|
mod font_atlas_set;
|
2020-06-15 19:47:35 +00:00
|
|
|
mod font_loader;
|
2020-11-13 00:21:48 +00:00
|
|
|
mod glyph_brush;
|
|
|
|
mod pipeline;
|
2020-12-27 19:19:03 +00:00
|
|
|
mod text;
|
|
|
|
mod text2d;
|
2020-05-13 20:09:32 +00:00
|
|
|
|
2020-06-15 19:47:35 +00:00
|
|
|
pub use draw::*;
|
2020-11-13 00:21:48 +00:00
|
|
|
pub use error::*;
|
2020-05-13 20:09:32 +00:00
|
|
|
pub use font::*;
|
2020-06-14 01:53:31 +00:00
|
|
|
pub use font_atlas::*;
|
|
|
|
pub use font_atlas_set::*;
|
2020-06-15 19:47:35 +00:00
|
|
|
pub use font_loader::*;
|
2020-11-13 00:21:48 +00:00
|
|
|
pub use glyph_brush::*;
|
|
|
|
pub use pipeline::*;
|
2020-12-27 19:19:03 +00:00
|
|
|
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 {
|
2021-04-27 18:29:33 +00:00
|
|
|
#[doc(hidden)]
|
2021-01-25 01:07:43 +00:00
|
|
|
pub use crate::{Font, Text, Text2dBundle, TextAlignment, TextError, TextSection, TextStyle};
|
2021-04-27 18:29:33 +00:00
|
|
|
#[doc(hidden)]
|
2020-11-13 00:21:48 +00:00
|
|
|
pub use glyph_brush_layout::{HorizontalAlign, 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;
|
2021-07-27 23:42:36 +00:00
|
|
|
use bevy_ecs::entity::Entity;
|
2021-02-18 21:20:37 +00:00
|
|
|
use bevy_render::RenderStage;
|
2020-11-13 00:21:48 +00:00
|
|
|
|
|
|
|
pub type DefaultTextPipeline = TextPipeline<Entity>;
|
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 {
|
2021-07-27 20:21:06 +00:00
|
|
|
fn build(&self, app: &mut App) {
|
2020-05-22 00:21:33 +00:00
|
|
|
app.add_asset::<Font>()
|
2020-06-14 01:53:31 +00:00
|
|
|
.add_asset::<FontAtlasSet>()
|
2020-11-13 00:21:48 +00:00
|
|
|
.init_asset_loader::<FontLoader>()
|
2021-09-13 14:02:28 +00:00
|
|
|
.init_resource::<DefaultTextPipeline>()
|
2021-07-27 23:42:36 +00:00
|
|
|
.add_system_to_stage(CoreStage::PostUpdate, text2d_system)
|
|
|
|
.add_system_to_stage(RenderStage::Draw, text2d::draw_text2d_system);
|
2020-05-16 02:46:09 +00:00
|
|
|
}
|
2020-06-04 03:08:20 +00:00
|
|
|
}
|