ZComponents
- a stupid component storage
I find "serious" ECS to be an overkill for turn-based game logic, so I've created this simple library that does only one thing: stores your components.
Basic Example
extern crate zcomponents;
;
;
;
zcomponents_storage!;
let mut storage = new;
let id0 = storage.alloc_id;
storage.component.insert;
let id1 = storage.alloc_id;
storage.component.insert;
storage.flag.insert;
storage.component.get_mut.0 += 1;
if let Some = storage.component.get_opt_mut
storage.flag.remove;
storage.remove;
See a more advanced example in crate's documentation.
Implementation
It's implemented as a simple macro and a bunch of naive HashMap
s
so don't expect any outstanding performance.