![]() |
Onsens
1.0
This is C++ game about bitwise logic.
|
Specialized shape representing a circle. More...
#include <CircleShape.hpp>
Public Member Functions | |
CircleShape (float radius=0, std::size_t pointCount=30) | |
Default constructor. More... | |
void | setRadius (float radius) |
Set the radius of the circle. More... | |
float | getRadius () const |
Get the radius of the circle. More... | |
void | setPointCount (std::size_t count) |
Set the number of points of the circle. More... | |
virtual std::size_t | getPointCount () const |
Get the number of points of the circle. More... | |
virtual Vector2f | getPoint (std::size_t index) const |
Get a point of the circle. More... | |
![]() | |
virtual | ~Shape () |
Virtual destructor. More... | |
void | setTexture (const Texture *texture, bool resetRect=false) |
Change the source texture of the shape. More... | |
void | setTextureRect (const IntRect &rect) |
Set the sub-rectangle of the texture that the shape will display. More... | |
void | setFillColor (const Color &color) |
Set the fill color of the shape. More... | |
void | setOutlineColor (const Color &color) |
Set the outline color of the shape. More... | |
void | setOutlineThickness (float thickness) |
Set the thickness of the shape's outline. More... | |
const Texture * | getTexture () const |
Get the source texture of the shape. More... | |
const IntRect & | getTextureRect () const |
Get the sub-rectangle of the texture displayed by the shape. More... | |
const Color & | getFillColor () const |
Get the fill color of the shape. More... | |
const Color & | getOutlineColor () const |
Get the outline color of the shape. More... | |
float | getOutlineThickness () const |
Get the outline thickness of the shape. More... | |
virtual std::size_t | getPointCount () const =0 |
Get the total number of points of the shape. More... | |
virtual Vector2f | getPoint (std::size_t index) const =0 |
Get a point of the shape. More... | |
FloatRect | getLocalBounds () const |
Get the local bounding rectangle of the entity. More... | |
FloatRect | getGlobalBounds () const |
Get the global (non-minimal) bounding rectangle of the entity. More... | |
![]() | |
virtual | ~Drawable () |
Virtual destructor. More... | |
![]() | |
Transformable () | |
Default constructor. More... | |
virtual | ~Transformable () |
Virtual destructor. More... | |
void | setPosition (float x, float y) |
set the position of the object More... | |
void | setPosition (const Vector2f &position) |
set the position of the object More... | |
void | setRotation (float angle) |
set the orientation of the object More... | |
void | setScale (float factorX, float factorY) |
set the scale factors of the object More... | |
void | setScale (const Vector2f &factors) |
set the scale factors of the object More... | |
void | setOrigin (float x, float y) |
set the local origin of the object More... | |
void | setOrigin (const Vector2f &origin) |
set the local origin of the object More... | |
const Vector2f & | getPosition () const |
get the position of the object More... | |
float | getRotation () const |
get the orientation of the object More... | |
const Vector2f & | getScale () const |
get the current scale of the object More... | |
const Vector2f & | getOrigin () const |
get the local origin of the object More... | |
void | move (float offsetX, float offsetY) |
Move the object by a given offset. More... | |
void | move (const Vector2f &offset) |
Move the object by a given offset. More... | |
void | rotate (float angle) |
Rotate the object. More... | |
void | scale (float factorX, float factorY) |
Scale the object. More... | |
void | scale (const Vector2f &factor) |
Scale the object. More... | |
const Transform & | getTransform () const |
get the combined transform of the object More... | |
const Transform & | getInverseTransform () const |
get the inverse of the combined transform of the object More... | |
Additional Inherited Members | |
![]() | |
Shape () | |
Default constructor. More... | |
void | update () |
Recompute the internal geometry of the shape. More... | |
virtual void | draw (RenderTarget &target, RenderStates states) const =0 |
Draw the object to a render target. More... | |
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:
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, ...
Definition at line 41 of file CircleShape.hpp.
|
explicit |
Default constructor.
radius | Radius of the circle |
pointCount | Number of points composing the circle |
|
virtual |
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 .. getPointCount() - 1] |
Implements sf::Shape.
|
virtual |
Get the number of points of the circle.
Implements sf::Shape.
float sf::CircleShape::getRadius | ( | ) | const |
void sf::CircleShape::setPointCount | ( | std::size_t | count | ) |
Set the number of points of the circle.
count | New number of points of the circle |
void sf::CircleShape::setRadius | ( | float | radius | ) |