I'm working on a little 3D project of mine using an Entity Component System framework (specifically, a modified version of Artemis). It's working fairly well for me, but I'm having some issues with regular "entity assembling".
As a note, its a very "textbook" implementation of an ECS. Entities are just IDs with Components, Components have just data, and Systems iterate over all Entities that have the components they're interested in. Everything is held by a "World" instance, there is where you hook up your Systems.
So, Entities are assembled out of Components, this example below is for creating a simple quad that has texture:
Entity e = world.createEntity() .addComponent( new Orientation() ) .addComponent( new WorldTransform() ) .addComponent( new MVPTransform() ) .addComponent( new RenderState() ); .addComponent( quadGeometry ) .addComponent( new AABSquare( OpsMesh.getMinAABS( quadGeometry.vertexBuffer.view ) ) ) .addComponent( resourceManager.get( Texture.class, "testTexture.dds" ) ) .addComponent( Material.TEXTURED_NO_SHADING ) .addComponent( Tags.Static.VALUE ) .addComponent( Tags.Textured.VALUE ); e.addToWorld();
After those lines, the entity is already in the world and it will be processed by the systems that are interested in it.