app: move startup stages to their own module

This commit is contained in:
Carter Anderson 2020-06-22 12:55:00 -07:00
parent e921ae0199
commit 6cd5af6f74
4 changed files with 11 additions and 11 deletions

View file

@ -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<System>) -> &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<System>,
{
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<T>(
@ -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)

View file

@ -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::*;

View file

@ -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";

View file

@ -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";