Hi!
Firstly, Sorry for my bad english. I have a big problem. I am creating game which look and is like Mamba. My character moves in 4 directions. To create shape, i have X,Y coordinates, and number of points. I need to create shapes which consist only from rectangles. So, some of them will be concave.
shape.setPointCount(6);
shape.setPoint(0, sf::Vector2f(60, 60));
shape.setPoint(1, sf::Vector2f(120, 60));
shape.setPoint(2, sf::Vector2f(120, 120));
shape.setPoint(3, sf::Vector2f(200, 120));
shape.setPoint(4, sf::Vector2f(200, 150));
shape.setPoint(5, sf::Vector2f(60, 150));
shape.setPosition(50, 50);
shape.setOutlineThickness(1);
shape.setFillColor(Color::Red);
shape.setOutlineColor(Color::Black);
and the result:
SFML not support Concave Shapes, only COnvex, but i read documentation of SFML that TrianglesFan can do it, but not exactly. Not all shapes, can be make from triangles. For Example
or
So, i found, that Thor supports Concave Shapes. Yes, but i have another problem. It not supports GetingGlobalBounds function , which i must use to detect Collision.
Any ideas? Or algorithm making from these shapes multiple triangles, when we only have coordinates in specific order(0 to 6)?