Skip to content

Added move_sprite example #2391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d63f6e1
Add SystemSet::as_sequential
james7132 Jun 23, 2021
f8ea0a9
Update crates/bevy_ecs/src/schedule/system_set.rs
james7132 Jun 23, 2021
ee6617b
Fix formatting and use wrapping_add
james7132 Jun 23, 2021
6a6a49d
Add unit test
james7132 Jun 23, 2021
1be9aa6
Add SystemGraph implementation
james7132 Jun 24, 2021
70a45e9
Revert SystemSet::as_sequential
james7132 Jun 24, 2021
08a6f1a
Remove extra space
james7132 Jun 24, 2021
d0632ec
Review changes + doc comments
james7132 Jun 24, 2021
a3108f7
Use Rc/RefCell instead of Arc/Mutex
james7132 Jun 24, 2021
cdbfea9
Support split_into as a utilty function for fan-out topologies
james7132 Jun 24, 2021
6237c9f
Use separate graph and node counters
james7132 Jun 25, 2021
27d8f1f
Add tuple implementations for SystemJoin
james7132 Jun 25, 2021
1123903
Use IntoSystemDescriptor instead of Into<SystemDescriptor>
james7132 Jun 27, 2021
cd47df4
Use impl Into<SystemSet> instead of SystemSet to simply addition
james7132 Jun 27, 2021
a2bd328
Add SystemGraph example
james7132 Jun 27, 2021
7f34ffc
Use a more descriptive comment in SystemGraph example
james7132 Jun 27, 2021
68e1a20
added move_sprite example
jak6jak Jun 29, 2021
e1f8a1f
added move_sprite example
jak6jak Jun 24, 2021
d44e2e4
fixed line endings
jak6jak Jun 24, 2021
c064714
added space for CI
jak6jak Jun 24, 2021
f8e24eb
changed to enum
jak6jak Jun 25, 2021
190cc8f
fixed formating
jak6jak Jun 28, 2021
4ae959e
fix formating again
jak6jak Jun 28, 2021
349aeaf
added transform to start.
jak6jak Jun 29, 2021
9aa01c8
removed .System()
jak6jak Jun 29, 2021
275a802
Merge branch 'tmp' into move-sprite-example
jak6jak Jun 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ path = "examples/2d/contributors.rs"
name = "mesh"
path = "examples/2d/mesh.rs"

[[example]]
name = "move_sprite"
path = "examples/2d/move_sprite.rs"

[[example]]
name = "many_sprites"
path = "examples/2d/many_sprites.rs"
Expand Down Expand Up @@ -299,6 +303,13 @@ name = "system_chaining"
path = "examples/ecs/system_chaining.rs"

[[example]]
<<<<<<< refs/remotes/bevyengine/trying
name = "system_graph"
path = "examples/ecs/system_graph.rs"

[[example]]
=======
>>>>>>> fixed line endings
name = "system_param"
path = "examples/ecs/system_param.rs"

Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_app/src/app_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl AppBuilder {
self.add_system_to_stage(CoreStage::Update, system)
}

pub fn add_system_set(&mut self, system_set: SystemSet) -> &mut Self {
pub fn add_system_set(&mut self, system_set: impl Into<SystemSet>) -> &mut Self {
self.add_system_set_to_stage(CoreStage::Update, system_set)
}

Expand All @@ -200,7 +200,7 @@ impl AppBuilder {
pub fn add_system_set_to_stage(
&mut self,
stage_label: impl StageLabel,
system_set: SystemSet,
system_set: impl Into<SystemSet>,
) -> &mut Self {
self.app
.schedule
Expand Down Expand Up @@ -235,7 +235,7 @@ impl AppBuilder {
self.add_startup_system_to_stage(StartupStage::Startup, system)
}

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

Expand All @@ -255,7 +255,7 @@ impl AppBuilder {
pub fn add_startup_system_set_to_stage(
&mut self,
stage_label: impl StageLabel,
system_set: SystemSet,
system_set: impl Into<SystemSet>,
) -> &mut Self {
self.app
.schedule
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ impl Parse for AllTuples {
#[proc_macro]
pub fn all_tuples(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as AllTuples);
let len = (input.start..=input.end).count();
let len = (0..=input.end).count();
let mut ident_tuples = Vec::with_capacity(len);
for i in input.start..=input.end {
for i in 0..=input.end {
let idents = input
.idents
.iter()
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pub mod prelude {
schedule::{
AmbiguitySetLabel, ExclusiveSystemDescriptorCoercion, ParallelSystemDescriptorCoercion,
RunCriteria, RunCriteriaDescriptorCoercion, RunCriteriaLabel, RunCriteriaPiping,
Schedule, Stage, StageLabel, State, SystemLabel, SystemSet, SystemStage,
Schedule, Stage, StageLabel, State, SystemGraph, SystemGroup, SystemJoin, SystemLabel,
SystemSet, SystemStage,
},
system::{
Commands, In, IntoChainSystem, IntoExclusiveSystem, IntoSystem, Local, NonSend,
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_ecs/src/schedule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod stage;
mod state;
mod system_container;
mod system_descriptor;
mod system_graph;
mod system_set;

pub use executor::*;
Expand All @@ -18,6 +19,7 @@ pub use stage::*;
pub use state::*;
pub use system_container::*;
pub use system_descriptor::*;
pub use system_graph::*;
pub use system_set::*;

use std::fmt::Debug;
Expand Down Expand Up @@ -166,7 +168,7 @@ impl Schedule {
pub fn add_system_set_to_stage(
&mut self,
stage_label: impl StageLabel,
system_set: SystemSet,
system_set: impl Into<SystemSet>,
) -> &mut Self {
self.stage(stage_label, |stage: &mut SystemStage| {
stage.add_system_set(system_set)
Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_ecs/src/schedule/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,13 @@ impl SystemStage {
&self.exclusive_before_commands
}

pub fn with_system_set(mut self, system_set: SystemSet) -> Self {
pub fn with_system_set(mut self, system_set: impl Into<SystemSet>) -> Self {
self.add_system_set(system_set);
self
}

pub fn add_system_set(&mut self, system_set: SystemSet) -> &mut Self {
pub fn add_system_set(&mut self, system_set: impl Into<SystemSet>) -> &mut Self {
let system_set = system_set.into();
self.systems_modified = true;
let (run_criteria, mut systems) = system_set.bake();
let set_run_criteria_index = run_criteria.and_then(|criteria| {
Expand Down
Loading