I've been reading some articles on game programming using components and go that I was excited.
game engines such as Unity, TorqueX, Nebula 3 or CryEngine, can create objects from the GUI combining components, which greatly reduces the dependence on the programming and also better suited to the iterative design of the games.
This is achieved, instead of using class hierarchy, using composition.
After seeing this and analyze the code push button engine is I got the idea to create a simple library for the language C + + (believe me I've searched but can not find any out there) to handle Entities. The idea is:
As you see in the image above, we would have the following lessons: (pseudocode)
CEntityManager
class List { \u0026lt;CEntity> EntityList; Bool createEntity (char * name); CEntity getEntityByName (char * name);}
CEntity class List { \u0026lt;CComponent> ComponentList; bool addComponent (CComponent);}
CComponent class: public IUpdate {/ / occurs when the component is added to the entity OnAdd void () {
UpdateManager.add (this);}
onUpdate void () {}}
CUpdateManager class List { \u0026lt;IUpdate> componentList ; onUpdate void () {
componentList.getFirst component = (); while (component ! = Null) {
If anyone is interested in this would deliver or if you want help, you can contact me at marco_tmp.nospam @ hotmail.com. Sure, you take it. Nospam. ;) Peter Molyneaux