From 6cd5af6f74620464dd6a93c70cf41c27ef169320 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Mon, 22 Jun 2020 12:55:00 -0700 Subject: [PATCH] app: move startup stages to their own module --- crates/bevy_app/src/app_builder.rs | 10 +++++----- crates/bevy_app/src/lib.rs | 1 + crates/bevy_app/src/stage.rs | 6 ------ crates/bevy_app/src/startup_stage.rs | 5 +++++ 4 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 crates/bevy_app/src/startup_stage.rs diff --git a/crates/bevy_app/src/app_builder.rs b/crates/bevy_app/src/app_builder.rs index d7715afb1a..9d63f5020c 100644 --- a/crates/bevy_app/src/app_builder.rs +++ b/crates/bevy_app/src/app_builder.rs @@ -1,7 +1,7 @@ use crate::{ plugin::{load_plugin, AppPlugin}, schedule_plan::SchedulePlan, - stage, App, AppExit, Events, FromResources, System, + stage, App, AppExit, Events, FromResources, System, startup_stage, }; use legion::prelude::{IntoSystem, Resources, World}; @@ -139,7 +139,7 @@ impl AppBuilder { pub fn add_startup_system(&mut self, system: impl Into) -> &mut Self { self.startup_schedule_plan - .add_system_to_stage(stage::STARTUP, system); + .add_system_to_stage(startup_stage::STARTUP, system); self } @@ -147,7 +147,7 @@ impl AppBuilder { where T: Into, { - self.init_startup_system_to_stage(stage::STARTUP, build) + self.init_startup_system_to_stage(startup_stage::STARTUP, build) } pub fn init_startup_system_to_stage( @@ -163,8 +163,8 @@ impl AppBuilder { } pub fn add_default_stages(&mut self) -> &mut Self { - self.add_startup_stage(stage::STARTUP) - .add_startup_stage(stage::POST_STARTUP) + self.add_startup_stage(startup_stage::STARTUP) + .add_startup_stage(startup_stage::POST_STARTUP) .add_stage(stage::FIRST) .add_stage(stage::EVENT_UPDATE) .add_stage(stage::PRE_UPDATE) diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index 685db29571..dae36d2310 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -7,6 +7,7 @@ mod resources; pub mod schedule_plan; pub mod schedule_runner; pub mod stage; +pub mod startup_stage; mod system; pub use app::*; diff --git a/crates/bevy_app/src/stage.rs b/crates/bevy_app/src/stage.rs index 611bc956b7..85f9f1f1ad 100644 --- a/crates/bevy_app/src/stage.rs +++ b/crates/bevy_app/src/stage.rs @@ -1,9 +1,3 @@ -/// Name of app stage that runs once when an app starts up -pub const STARTUP: &str = "startup"; - -/// Name of app stage that runs once after startup -pub const POST_STARTUP: &str = "post_startup"; - /// Name of app stage that runs before all other app stages pub const FIRST: &str = "first"; diff --git a/crates/bevy_app/src/startup_stage.rs b/crates/bevy_app/src/startup_stage.rs new file mode 100644 index 0000000000..3b07ce301a --- /dev/null +++ b/crates/bevy_app/src/startup_stage.rs @@ -0,0 +1,5 @@ +/// Name of app stage that runs once when an app starts up +pub const STARTUP: &str = "startup"; + +/// Name of app stage that runs once after startup +pub const POST_STARTUP: &str = "post_startup"; \ No newline at end of file