forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
return_after_run.rs
37 lines (33 loc) · 978 Bytes
/
return_after_run.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Shows how to return to the calling function after a windowed Bevy app has exited.
use bevy::{prelude::*, winit::WinitSettings};
fn main() {
println!("Running first App.");
App::new()
.insert_resource(WinitSettings {
return_from_run: true,
..default()
})
.insert_resource(ClearColor(Color::rgb(0.2, 0.2, 0.8)))
.add_plugins(DefaultPlugins)
.add_system(system1)
.run();
println!("Running another App.");
App::new()
.insert_resource(WinitSettings {
return_from_run: true,
..default()
})
.insert_resource(ClearColor(Color::rgb(0.2, 0.8, 0.2)))
.add_plugins_with(DefaultPlugins, |group| {
group.disable::<bevy::log::LogPlugin>()
})
.add_system(system2)
.run();
println!("Done.");
}
fn system1() {
info!("logging from first app");
}
fn system2() {
info!("logging from second app");
}