Added helpful adders for systemsets (#2366)

# Objective

- This adds a way to add `SystemSet`s to Apps.
This commit is contained in:
CGMossa 2021-06-23 16:47:08 +00:00
parent f71f93c843
commit 3106dc4937

View file

@ -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,
@ -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