mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Runners explicitly call App.initialize() (#690)
This commit is contained in:
parent
a80469bd13
commit
149c39950a
3 changed files with 7 additions and 1 deletions
|
@ -63,7 +63,7 @@ impl App {
|
|||
.run(&mut self.schedule, &mut self.world, &mut self.resources);
|
||||
}
|
||||
|
||||
pub fn run(mut self) {
|
||||
pub fn initialize(&mut self) {
|
||||
self.startup_schedule
|
||||
.initialize(&mut self.world, &mut self.resources);
|
||||
self.startup_executor.initialize(&mut self.resources);
|
||||
|
@ -72,7 +72,9 @@ impl App {
|
|||
&mut self.world,
|
||||
&mut self.resources,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn run(mut self) {
|
||||
self.executor.initialize(&mut self.resources);
|
||||
let runner = std::mem::replace(&mut self.runner, Box::new(run_once));
|
||||
(runner)(self);
|
||||
|
|
|
@ -55,6 +55,8 @@ impl Plugin for ScheduleRunnerPlugin {
|
|||
fn build(&self, app: &mut AppBuilder) {
|
||||
let run_mode = self.run_mode;
|
||||
app.set_runner(move |mut app: App| {
|
||||
app.initialize();
|
||||
|
||||
let mut app_exit_event_reader = EventReader::<AppExit>::default();
|
||||
match run_mode {
|
||||
RunMode::Once => {
|
||||
|
|
|
@ -157,6 +157,8 @@ pub fn winit_runner(mut app: App) {
|
|||
&mut create_window_event_reader,
|
||||
);
|
||||
|
||||
app.initialize();
|
||||
|
||||
log::debug!("Entering winit event loop");
|
||||
|
||||
let should_return_from_run = app
|
||||
|
|
Loading…
Reference in a new issue