When I add points to sf::ConvexShape, do they have to be oriented clockwisely? The documentation only speaks about "ordered", the following example doesn't create a line as expected. What do I do wrong?
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
sf::ConvexShape cs;
cs.SetPointsCount(4);
cs.SetFillColor(sf::Color::Cyan);
cs.SetPoint(0, sf::Vector2f(20.f, 20.f));
cs.SetPoint(1, sf::Vector2f(20.f, 21.f));
cs.SetPoint(2, sf::Vector2f(140.f, 21.f));
cs.SetPoint(3, sf::Vector2f(140.f, 20.f));
while (window.IsOpened())
{
sf::Event event;
while (window.PollEvent(event))
{
if (event.Type == sf::Event::Closed)
window.Close();
}
window.Clear();
window.Draw(cs);
window.Display();
}
}
And concerning the new semantics of SetPointsCount() and SetPoint() vs. the old AddPoint(): Is it always defined what happens when resizing? The problem is, there may now be invalid situations, when the amount of points is increased, but no new points are specified. Do these points get valid default values?