3 ms·
I've written an entity/component "system", but it's mostly just a macro that generates structs and some useful functions on them :) Basically, I started out ju
by wtetzner 10y ago
I've written an entity/component "system", but it's mostly just a macro that generates structs and some useful functions on them :)
Basically, I started out just writing structs, then realized I was writing a lot of boilerplate, and now I can specify components like this, and use a custom derive to generate the actual structs and helper functions:
#[derive(Entities)]
pub enum Component {
Position { x: f64, y: f64, z: f64 },
Direction { x: f64, y: f64, z: f64 },
Velocity { x: f64, y: f64, z: f64 },
PlayerControlled
}