View on GitHub

DSFML

dsfml.graphics.convexshape



class ConvexShape: dsfml.graphics.shape.Shape;
Specialized shape representing a convex polygon.

This class inherits all the functions of Transformable (position, rotation, scale, bounds, ...) as well as the functions of Shape (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.

Authors:
Laurent Gomila, Jeremy DeHaan

See Also:


http:
//www.sfml-dev.org/documentation/2.0/classsf_1_1ConvexShape.php#a4f4686f57622bfbbe419ac1420b1432a

this(uint thePointCount = 0);
Params:
pointCount Number of points on the polygon

@property uint pointCount(uint newPointCount);
The number of points on the polygon

@property uint pointCount();
The number of points on the polygon

const Vector2f getPoint(uint index);
Get the position of a point.

The result is undefined if index is out of the valid range.

Params:
uint index Index of the point to get, in range [0 .. pointCount - 1].

Returns:
Index-th point of the shape.

void setPoint(uint index, Vector2f point);
Set the position of a point.

Don't forget that the polygon must remain convex, and the points need to stay ordered! pointCount must be changed first in order to set the total number of points. The result is undefined if index is out of the valid range.

Params:
uint index Index of the point to change, in range [0 .. pointCount - 1].
Vector2f point New position of the point

void addPoint(Vector2f point);
Add a point to the polygon.

Don't forget that the polygon must remain convex, and the points need to stay ordered!

Params:
Vector2f point Position of the new point.