CURBL-ECS
curbl-ecs is an lightweight Entity Component System using decorator magic for Components, Entities and Systems. There is also a simple web worker support.
Example
- Creating a Component
@ECS public x: number; public y: number; { thisx = configx; thisy = configy; }
- Creating an Entity with components
@ECS {}
- Adding a Entity with predefined Components
const entity = ECS;
- Create entity and add Component
const entity = ECS;entity;
- Get Component from Entity
entityx = 42;entityx = 42;
- Creating a System
//All Entities with a PositionComponent will be added to the System@ECS : void //Called when the System is created/added to the ECS : void //Called when the System is removed from the ECS : void forlet i = 0 entity: Entity; entity = thisentitiesi; i++ //Do stuff with the entities
- Using Web Workers by adding the WebWorker to the main-thread. All Entities are automatically shared between all workers.
@ECS {} ECS; const readWorker = ;ECS; const writeWorker = ;ECS; ECS;