Extend AppBuilder api with add_system_set
and similar methods (#1453)
Extend AppBuilder api with `add_system_set` and similar methods
This commit is contained in:
parent
884dc46ffe
commit
fa73036f9d
@ -6,7 +6,8 @@ use crate::{
|
||||
};
|
||||
use bevy_ecs::{
|
||||
clear_trackers_system, FromResources, IntoExclusiveSystem, IntoSystem, Resource, Resources,
|
||||
RunOnce, Schedule, Stage, StageLabel, StateStage, SystemDescriptor, SystemStage, World,
|
||||
RunOnce, Schedule, Stage, StageLabel, StateStage, SystemDescriptor, SystemSet, SystemStage,
|
||||
World,
|
||||
};
|
||||
use bevy_utils::tracing::debug;
|
||||
|
||||
@ -129,6 +130,10 @@ impl AppBuilder {
|
||||
self.add_system_to_stage(CoreStage::Update, system)
|
||||
}
|
||||
|
||||
pub fn add_system_set(&mut self, system_set: SystemSet) -> &mut Self {
|
||||
self.add_system_set_to_stage(CoreStage::Update, system_set)
|
||||
}
|
||||
|
||||
pub fn add_system_to_stage(
|
||||
&mut self,
|
||||
stage_label: impl StageLabel,
|
||||
@ -138,6 +143,17 @@ impl AppBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_system_set_to_stage(
|
||||
&mut self,
|
||||
stage_label: impl StageLabel,
|
||||
system_set: SystemSet,
|
||||
) -> &mut Self {
|
||||
self.app
|
||||
.schedule
|
||||
.add_system_set_to_stage(stage_label, system_set);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_startup_system(&mut self, system: impl Into<SystemDescriptor>) -> &mut Self {
|
||||
self.add_startup_system_to_stage(StartupStage::Startup, system)
|
||||
}
|
||||
|
@ -153,6 +153,16 @@ impl Schedule {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn add_system_set_to_stage(
|
||||
&mut self,
|
||||
stage_label: impl StageLabel,
|
||||
system_set: SystemSet,
|
||||
) -> &mut Self {
|
||||
self.stage(stage_label, |stage: &mut SystemStage| {
|
||||
stage.add_system_set(system_set)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn stage<T: Stage, F: FnOnce(&mut T) -> &mut T>(
|
||||
&mut self,
|
||||
label: impl StageLabel,
|
||||
|
Loading…
Reference in New Issue
Block a user