SF::CircleShape
Inherits SF::Shape < SF::Drawable < SF::Transformable < Reference < Object
Specialized shape representing a circle
This class inherits all the functions of SF::Transformable
(position, rotation, scale, bounds, ...) as well as the
functions of SF::Shape (outline, color, texture, ...).
Usage example:
circle = SF::CircleShape.new
circle.radius = 150
circle.outline_color = SF::Color::Red
circle.outline_thickness = 5
circle.position = {10, 20}
# [...]
window.draw circle
Since the graphics card can't draw perfect circles, we have to
fake them with multiple triangles connected to each other. The
"points count" property of SF::CircleShape defines how many of these
triangles to use, and therefore defines the quality of the circle.
The number of points can also be used for another purpose; with small numbers you can create any regular polygon shape: equilateral triangle, square, pentagon, hexagon, ...
See also: SF::Shape, SF::RectangleShape, SF::ConvexShape
Constructors
Instance methods
Returns a shallow copy of this object.
This allocates a new object and copies the contents of
self into it.
Get a point of the circle
The returned point is in local coordinates, that is, the shape's transforms (position, rotation, scale) are not taken into account. The result is undefined if index is out of the valid range.
- index - Index of the point to get, in range
0 ... point_count
Returns: index-th point of the shape
Get the number of points of the circle
Returns: Number of points of the circle
See also: point_count=