If I have a interface represent the graphics of an entity.
interface RenderComponent {
function getDrawable():IBitmapDrawable;
}
and this implement:
class SpriteRenderComponent implements RenderComponent
{
public var target:Sprite;
public function new() {
target = new Sprite();
}
public function getDrawable():IBitmapDrawable {
return target;
}
}
and I create a view:
var v:View = new View([RenderComponent],null,context);
add an entity:
var e:Entity = context.entities.create();
e.set(new SpriteRenderComponent ());
But I can't get the SpriteRenderComponent using context.entities.
Also, this doesn't work either:
var e:Entity = context.entities.create();
e.set(cast (a,RenderComponent));
I found that it is related to some methods in ComponentManager.hx.
Anyway, am I supposed to do this, does it volatile the concept of ECS?
If I have a interface represent the graphics of an entity.
and this implement:
and I create a view:
add an entity:
But I can't get the
SpriteRenderComponentusingcontext.entities.Also, this doesn't work either:
I found that it is related to some methods in
ComponentManager.hx.Anyway, am I supposed to do this, does it volatile the concept of ECS?