I'm trying to implement this systems, because inheritance has bored... I have done this in C# by finding code and changing for my needs. But on C++ I can't find any good example what I want.
I created basic Component class. Made some new class from it (SpriteComponent and MovementComponent). Now in Entity I want create list of components. But just don't know how to find it.
What I looking for is 3 methods and data structure for holding components .
- AddComponent(Component * component); would use it like player.AddComponent(new SpriteComponent(20,30));
- GetComponent(...); would use it like player.GetComponent<SpriteComponent>();
- RemoveComponent(...); would use it like player.RemoveComponent<SpriteComponent>();
Could anybody say how to implement this thing?