Specialized shape representing a convex polygon.
1 auto polygon = new ConvexShape(); 2 polygon.pointCount = 3; 3 polygon.setPoint(0, Vector2f(0, 0)); 4 polygon.setPoint(1, Vector2f(0, 10)); 5 polygon.setPoint(2, Vector2f(25, 5)); 6 polygon.outlineColor = Color.Red; 7 polygon.outlineThickness = 5; 8 polygon.position = Vector2f(10, 20); 9 ... 10 window.draw(polygon);
$(SHAPE_LINK), $(RECTANGLESHAPE_LINK), $(CIRCLESHAPE_LINK)
This class inherits all the functions of $(TRANSFORMABLE_LINK) (position, rotation, scale, bounds, ...) as well as the functions of $(SHAPE_LINK) (outline, color, texture, ...).
It is important to keep in mind that a convex shape must always be... convex, otherwise it may not be drawn correctly. Moreover, the points must be defined in order; using a random order would result in an incorrect shape.