Simple entity-component system in pure Rust. Type reflection - no macros!
Using Cargo, just add the following to your Cargo.toml
:
[dependencies.recs]
git = "https://github.com/andybarron/rustic-ecs"
(Coming soon to crates.io!)
``` extern crate recs; use recs::{Ecs, EntityId};
struct Age{years: u32}
struct Brain{iq: i32}
fn main() {
// Create an ECS instance
let mut ecs: Ecs = Ecs::new();
// Add entity to the system
let me: EntityId = ecs.create_entity();
// Attach component to the entity
ecs.set(me, &Age{years: 22});
// Get attached component data from entity
let older = ecs.get::