Game Development Reference
In-Depth Information
the circle is rendered first and so it is in the background, whereas the rectangle sits on top
of the circle in the foreground.
We can use ConvexShape by specifying the number of points with the Con-
vexShape::setPointCount() function, and set those points in order with Con-
vexShape::setPoint() . Here is an example with a triangle:
After drawing it in the window, we get a nice blue triangle:
There is no support for a concave shape in SFML. However we can still draw concave
shapes by creating multiple convex ones and rendering them in the correct places. If tri-
angles are used for the job, the method is called Polygon triangulation .
Search WWH ::

Custom Search