forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreturn_after_run.rs
27 lines (24 loc) · 890 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
//! Shows how to return to the calling function after a windowed Bevy app has exited.
//!
//! In windowed *Bevy* applications, executing code below a call to `App::run()` is
//! not recommended because:
//! - `App::run()` will never return on iOS and Web.
//! - It is not possible to recreate a window afer the event loop has been terminated.
use bevy::{prelude::*, window::WindowPlugin};
fn main() {
println!("Running Bevy App");
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "Close the window to return to the main function".into(),
..default()
}),
..default()
}))
.add_systems(Update, system)
.run();
println!("Bevy App has exited. We are back in our main function.");
}
fn system() {
info!("Logging from Bevy App");
}