CircleShape


Object Hierarchy:

Object hierarchy for CircleShape

Description:

[ Compact ]
[ CCode ( cname = "sfCircleShape" , copy_function = "sfCircleShape_copy" , free_function = "sfCircleShape_destroy" ) ]
public class CircleShape : Shape

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:

Color

var circle = new CircleShape () {
radius = 50.0f,
outlineColor = Color(100, 250, 50)
};

Outline

var circle = new CircleShape () {
radius = 50.0f,
fillColor = Color(150, 50, 250),
outlineColor = Color(250, 150, 100),
OutlineThickness = Color(250, 150, 100)
};

Texture

var circle = new CircleShape() {
radius = 50.0f
};

// map a 100x100 textured rectangle to the shape
shape.setTexture(texture); // texture is a sf.Texture
shape.setTextureRect(IntRect(10, 10, 100, 100));

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


Namespace: sf
Package: sfml

Content:

Properties:

Creation methods:

Methods:

Inherited Members: