Specialized shape representing a convex polygon.
auto polygon = new ConvexShape(); polygon.pointCount = 3; polygon.setPoint(0, Vector2f(0, 0)); polygon.setPoint(1, Vector2f(0, 10)); polygon.setPoint(2, Vector2f(25, 5)); polygon.outlineColor = Color.Red; polygon.outlineThickness = 5; polygon.position = Vector2f(10, 20); ... 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.