I'm making a little IDE
and during programming activity i am facing a little difficulty that i'm trying to explain.
I have two layers (cpp
files), one for the more low level entities (entity itself, vector etc) and one for the higher level (the IDE
level, like buttons etc.):
in entities.h
struct EntityComponent{
};
struct a_component : EntityComponent{ //cannot change this
};
struct Entity{
... //entity data like childs, parent, transforms, and so on
std::vector<EntityComponent*> components;
};
in ide.h
struct GuiButton{...};
struct GuiProperty{...};
Now i wants that every entity and every component takes a pointer to a more higher type declared in the ide.h layer, for example a gui element to draw the entity or component data, so i have made:
in ide.h
struct EditorEntity : Entity{
GuiProperty* properties;
};
struct EditorEntityComponent: EntityComponent{
GuiProperty* properties;
};
I can use EditorEntity
in the IDE
in place of Entity and use properties.
Problem arises when i want to do the same with the EntityComponent
structure: every component in the low layer is declared inheriting this EntityComponent
structure, so i cannot change this value cause is statically declared in every component definition.
I need a EditorEntityComponent
: EntityComponent
that contains a more higher type Property but i don't want place an ugly pointer in the EntityComponent
repr.
Any help?