kgorking / ecs

A header-only/importable c++20 implementation of an entity-component-system (ecs), with focus on a simple interface and speed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for hierarchies

kgorking opened this issue · comments

Flattened trees = sorted entities.

using specific_parent = ecs::parent<Type1, Type2>;
ecs::add_component({0,1}, specific_parent{parent_id});
// ...
[](specific_parent parent, Type1 &t1, Type2 const& t2) {
    t1 = parent.get<Type1>() * t2 + parent.get<Type2>();
};