Skip to content

Commit

Permalink
Add dynamic reference methods
Browse files Browse the repository at this point in the history
  • Loading branch information
james-j-obrien committed Sep 12, 2023
1 parent f6382c1 commit 25623dc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/bevy_ecs/src/term_query/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ impl<'w, Q: QueryTermGroup> QueryBuilder<'w, Q> {
self
}

pub fn ref_id(&mut self, id: ComponentId) -> &mut Self {
self.terms.push(Term::Component(ComponentTerm::read_id(id)));
self
}

pub fn mut_id(&mut self, id: ComponentId) -> &mut Self {
self.terms
.push(Term::Component(ComponentTerm::write_id(id)));
self
}

pub fn set<T: Component>(&mut self) -> &mut Self {
let id = self.world.init_component::<T>();
self.set_id(id);
Expand Down

0 comments on commit 25623dc

Please sign in to comment.