ArtemisD: A D port of Artemis Entity System Framework for games.
develop32
develop32 at gmail.com
Tue Oct 8 09:24:19 PDT 2013
On Tuesday, 8 October 2013 at 10:35:53 UTC, Kiith-Sa wrote:
> In my implementation I don't even use a getComponent
> equivalent; a process()
> (or opApply() in the older version I linked) function directly
> takes component
> references, and all components are in plain arrays. Processing
> of a System
> is done (in generated code) by iterating over the components
> the System specifies in its signature, which is cache-friendly,
> and means the components needed are always available directly
> to the process() function without any lookup. However, this is
> a less flexible approach than what you're doing (although
> intentional, again, to eventually enable very easy threading).
Looks similar to what I do in my engine, although entities and
components are not classes.
Basic example:
struct State2D
{
Vector2 position;
float rotation;
}
struct BoundKill {} // Acts as a tag
class BoundManager : Manager!(State2D, BoundKill)
{
override void process(Entity entity, State2D state, BoundKill
tag)
{
if (state.y < 0)
world.remove(entity);
}
}
And entity is just a struct containing size_t id
More information about the Digitalmars-d-announce
mailing list