xecs is a rust Entity-Component-System library
XECS is a Grouped ECS library.
no_run
let mut world = World::new();
Component is T : Send + Sync + 'static
no_run
struct Position(f64,f64,f64);
struct Particle;
world.register::<Position>();
world.register::<Particle>();
```norun for _ in 0..100 { world .createentity() .attach(Position(1.0,2.0,1.2)) .attach(Particle); }
```
no_run
world.make_group::<(Particle,Position)>(true,true);
```no_run
struct UpdatePosition; impl<'a> System<'a> for UpdatePosition { type Resource = (&'a mut World); type Dependencies = ();
fn update(&'a mut self, world : RefMut<'a,World>) {
for (pos,_tag) in world.query::<(&mut Position,&Particle)>() {
pos.0 += 1.1;
pos.1 += 1.2;
pos.3 += 1.4;
}
}
} ```
```no_run
let mut stage = Stage::fromworld(world); stage.addsystem(UpdatePosition); stage.run(); ```