Ketepincho's Unbelievable(Useless) Game Engine.
Heavily based in Austin Morlan's ECS.
Usage instructions:
- Create a
Manager
object. It will automatically create the other sub-managers:ComponentManager
,EntityManager
andSystemManager
.
kuge::ECS::Manager manager {};
- Register your Systems:
manager.registerSystem<PhysicsSystem>();
manager.registerSystem<RenderSystem>();
- Register your Components:
manager.registerComponent<Transform>();
manager.registerComponent<RigidBody>();
- Generate a signature for each of your Systems. The signature is a
std::bitfield
that informs which Components needs a System to perform it's task. For example:
kuge::ECS::Signature signature {};
signature.set(manager.componentID<Gravity>(), true);
signature.set(manager.componentID<Transform>(), true);
signature.set(manager.componentID<RigidBody>(), true);
manager.setSystemSignature<PhysicsSystem>(signature);
Pro tip: use Manager's
systemSignature<T>()
to retrieve a System's signature.
- Create some entities:
auto entity {manager.createEntity()};
- Add the desired Components to your Entities :
manager.addComponent(entity, Transform{});
- On your update loop
update()
the Systems:
manager.system<PhysicsSystem>()->update();
- Hopefully enjoy!