tecs 1.1.0

TeaECS, a simple ECS
Documentation
  • Coverage
  • 54.55%
    18 out of 33 items documented6 out of 28 items with examples
  • Size
  • Source code size: 26.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.51 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Lisible

tecs

TeaECS is a simple Rust ECS. I'm building this project for learning purposes.

This project doesn't have the ambition to be as good or better than popular ECS libraries such as Legion or Specs. It is however heavily inspired by them.

The entities' data are stored in unique Vecs (one for each component type).

tecs doesn't provide parallel processing features.

Using tecs

Creating entities

let mut ecs = Ecs::new();
let entity_id = ecs.new_entity()
    .with_component(Position { x: 0.5, y: 0.3 })
    .with_component(Speed { x: 1.0, y: 2.0 })
    .build();

Removing entities

ecs.remove_entity(1);

Querying the Ecs

let mut ecs = Ecs::new();
ecs.new_entity()
    .with_component(Position { x: 0.5, y: 0.3 })
    .with_component(Speed { x: 1.0, y: 2.0 })
    .build();
ecs.new_entity()
    .with_component(Position { x: 1.2, y: 2.2 })
    .with_component(Speed { x: 0.5, y: 0.1 })
    .build();

for (position, speed) in <(Mut<Position>, Imm<Speed>)>::iter(&mut ecs) {
    position.x += speed.x;
    position.y += speed.y;
}

Contributing

Feel free to create issues and pull requests to the project.