Nano-ECS
A bare-bones macro-based Entity-Component-System
- Maximum 64 components per entity
- Stores components sequentially in same array
- Masks for enabled/disabled components
use *;
;
;
ecs!
Design
The ecs!
macro generates a World
and Component
object.
Can be used with any Rust data structure that implements Clone
.
The order of declared components is used to assign every component an index. This index is used in the mask per entity and to handle slice memory correctly.
- All components are stored in one array inside
World
. - All entities have a slice refering to components
- All entities have a mask that enable/disable components