Skip to content

Commit

Permalink
Added helpful adders for systemsets (bevyengine#2366)
Browse files Browse the repository at this point in the history
# Objective

- This adds a way to add `SystemSet`s to Apps.
  • Loading branch information
CGMossa authored and ostwilkens committed Jul 27, 2021
1 parent 40ce956 commit 40f5592
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/bevy_app/src/app_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ impl AppBuilder {
self.add_startup_system_to_stage(StartupStage::Startup, system)
}

pub fn add_startup_system_set(&mut self, system_set: SystemSet) -> &mut Self {
self.add_startup_system_set_to_stage(StartupStage::Startup, system_set)
}

pub fn add_startup_system_to_stage(
&mut self,
stage_label: impl StageLabel,
Expand All @@ -245,6 +249,19 @@ impl AppBuilder {
self
}

pub fn add_startup_system_set_to_stage(
&mut self,
stage_label: impl StageLabel,
system_set: SystemSet,
) -> &mut Self {
self.app
.schedule
.stage(CoreStage::Startup, |schedule: &mut Schedule| {
schedule.add_system_set_to_stage(stage_label, system_set)
});
self
}

/// Adds a new [State] with the given `initial` value.
/// This inserts a new `State<T>` resource and adds a new "driver" to [CoreStage::Update].
/// Each stage that uses `State<T>` for system run criteria needs a driver. If you need to use
Expand Down

0 comments on commit 40f5592

Please sign in to comment.