Macro recs::component_filter
[−]
[src]
macro_rules! component_filter { ($($x:ty),*) => { ... }; ($($x:ty,)*) => { ... }; }
Create a ComponentFilter
by type name.
If you want all entities with components Foo
and Bar
:
#[macro_use] // The macro won't be imported without this flag! extern crate recs; use recs::{Ecs, EntityId}; struct Foo; struct Bar; fn main() { let sys = Ecs::new(); // ... add some entities and components ... let mut ids: Vec<EntityId> = Vec::new(); let filter = component_filter!(Foo, Bar); sys.collect_with(&filter, &mut ids); for id in ids { // Will only iterate over entities that have been assigned both `Foo` and `Bar` // components } }