ecx
ECX is Entity Component System framework for Haxe
System
Injection
For example we need to inject TimeSystem system to our MovementSystem
class MovementSystem extends System {
var _time:Wire<TimeSystem>;
...
override function update() {
var dt = _time.dt;
...
}
}
Family
For example we need to track all active(live) entities with components: Transform, Node and Renderable
class MovementSystem extends System {
var _entities:Family<Transform, Node, Renderable>;
...
override function update() {
// Note: typeof _entities is Array<Entity>
for(entity in _entities) {
// only entities with required component will be displayed
trace(entity.id);
}
}
}
EntityView
EntityView is the utility class. It provides shortcut to edit entity using object-wrapper.
System Flags
IDLE: System doesn't overrideupdatemethod. Should not be updated.CONFIG: System is defined with@:configmeta. This system is just configurator. It will be deleted after World initialization phase.PROCESSOR: System has at least one entity Family to process.
Component
World
Initialization
var config = new WorldConfig([...]);
var world = Engine.initialize().createWorld(config, ?potCapacity);
CTTI
ClassMacroTools
RTTI
TypeManager
TODO
- List of entities should be target-optimized
EntityVector - CBitArray target-optimized underlying data
- Examples
- Unit tests
- README