Skip to content

Commit 9d79816

Browse files
authored
Merge pull request #181 from BafDyce/169-scene-example-ui-info-msg
Add info message in UI for scene example
2 parents 95dce3a + 4a119dd commit 9d79816

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

examples/scene/scene.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fn main() {
1313
.register_component::<ComponentB>()
1414
.add_startup_system(save_scene_system.thread_local_system())
1515
.add_startup_system(load_scene_system.system())
16+
.add_startup_system(infotext_system.system())
1617
.add_system(print_system.system())
1718
.run();
1819
}
@@ -128,3 +129,25 @@ fn save_scene_system(_world: &mut World, resources: &mut Resources) {
128129

129130
// TODO: save scene
130131
}
132+
133+
// This is only necessary for the info message in the UI. See examples/ui/text.rs for a standalone text example.
134+
fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
135+
let font_handle = asset_server.load("assets/fonts/FiraSans-Bold.ttf").unwrap();
136+
commands
137+
.spawn(UiCameraComponents::default())
138+
.spawn(TextComponents {
139+
style: Style {
140+
align_self: AlignSelf::FlexEnd,
141+
..Default::default()
142+
},
143+
text: Text {
144+
value: "Nothing to see in this window! Check the console output!".to_string(),
145+
font: font_handle,
146+
style: TextStyle {
147+
font_size: 50.0,
148+
color: Color::WHITE,
149+
},
150+
},
151+
..Default::default()
152+
});
153+
}

0 commit comments

Comments
 (0)