mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
Merge pull request #181 from BafDyce/169-scene-example-ui-info-msg
Add info message in UI for scene example
This commit is contained in:
commit
9d7981607f
1 changed files with 23 additions and 0 deletions
|
@ -13,6 +13,7 @@ fn main() {
|
|||
.register_component::<ComponentB>()
|
||||
.add_startup_system(save_scene_system.thread_local_system())
|
||||
.add_startup_system(load_scene_system.system())
|
||||
.add_startup_system(infotext_system.system())
|
||||
.add_system(print_system.system())
|
||||
.run();
|
||||
}
|
||||
|
@ -128,3 +129,25 @@ fn save_scene_system(_world: &mut World, resources: &mut Resources) {
|
|||
|
||||
// TODO: save scene
|
||||
}
|
||||
|
||||
// This is only necessary for the info message in the UI. See examples/ui/text.rs for a standalone text example.
|
||||
fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
let font_handle = asset_server.load("assets/fonts/FiraSans-Bold.ttf").unwrap();
|
||||
commands
|
||||
.spawn(UiCameraComponents::default())
|
||||
.spawn(TextComponents {
|
||||
style: Style {
|
||||
align_self: AlignSelf::FlexEnd,
|
||||
..Default::default()
|
||||
},
|
||||
text: Text {
|
||||
value: "Nothing to see in this window! Check the console output!".to_string(),
|
||||
font: font_handle,
|
||||
style: TextStyle {
|
||||
font_size: 50.0,
|
||||
color: Color::WHITE,
|
||||
},
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue