I'm implementing my own collision sistem with collision shapes, and I'm using sf::ConvexShape, sf::CircleShape and own clases for this.
I use a vector to hold all shapes and then check for collision. So I use a base class type, CollisionShape.
std::vector<CollisionShape*> m_shapeList;
I have my own shape classes like Box, Circle, Polygon... and some of them inherit sf::ConvexShape and use its methods. I have something like this.
Note that there are more shapes inheriting CollisionShape class.
I have a problem when I do this:
Polygon* polygon = new Polygon();
addShape(polygon);
...
void addShape( CollisionShape* shape )
{
shape->SetOutlineColor(...); <----------------------
m_shapeList.push_back(shape);
}
I can't use sf::ConvexShape 's methods, so I could change CollisionShape pointer to sf::ConvexShape pointer. But I have more shapes inheriting other classes (a.s.a sf::CircleShape).
Any OOP idea for solving this? A better design?
Hope someone can understand my problem,
Thanks!