List of all members | Public Member Functions
thor::ConcaveShape Class Reference

Concave shape class. More...

Inherits Drawable, and Transformable.

Public Member Functions

 ConcaveShape ()
 Creates an empty shape. More...
 
 ConcaveShape (const sf::Shape &shape)
 Implicit constructor that adapts an existing sf::Shape. More...
 
void setPointCount (std::size_t count)
 Sets the amount of points in the concave polygon.
 
std::size_t getPointCount () const
 Returns the amount of points in the concave polygon.
 
void setPoint (std::size_t index, sf::Vector2f position)
 Sets the position of a point. More...
 
sf::Vector2f getPoint (std::size_t index) const
 Returns the position of a point. More...
 
void setFillColor (const sf::Color &fillColor)
 Sets the polygon's fill color.
 
void setOutlineColor (const sf::Color &outlineColor)
 Sets the polygon's outline color.
 
sf::Color getFillColor () const
 Returns the polygon's fill color.
 
sf::Color getOutlineColor () const
 Returns the polygon's outline color.
 
void setOutlineThickness (float outlineThickness)
 sets the thickness of the shape's outline (0.f by default). More...
 
float getOutlineThickness () const
 Returns the shape's outline thickness.
 
sf::FloatRect getLocalBounds () const
 Return untransformed bounding rectangle.
 
sf::FloatRect getGlobalBounds () const
 Return transformed bounding rectangle. More...
 

Detailed Description

Concave shape class.

This class has an interface and functionality similar to sf::ConvexShape, but is additionally able to work with shapes that are concave. It inherits the sf::Drawable and sf::Transformable classes.

Constructor & Destructor Documentation

thor::ConcaveShape::ConcaveShape ( )

Creates an empty shape.

You can use setPointCount() and SetPoint() to build your own concave shape.

thor::ConcaveShape::ConcaveShape ( const sf::Shape &  shape)

Implicit constructor that adapts an existing sf::Shape.

The concave shape should look as similar as possible to the original convex shape.

Member Function Documentation

sf::FloatRect thor::ConcaveShape::getGlobalBounds ( ) const

Return transformed bounding rectangle.

This function does not necessarily yield the minimal bounding rect that spans all vertices. It transforms the local bounding rect, and then computes the bounding rect of that transformed bounding rect – so for example, a rotated shape might not have the bounding rect that you expect. This behavior is consistent with SFML.

sf::Vector2f thor::ConcaveShape::getPoint ( std::size_t  index) const

Returns the position of a point.

Parameters
indexWhich point? Must be in [0, getPointCount()[
void thor::ConcaveShape::setOutlineThickness ( float  outlineThickness)

sets the thickness of the shape's outline (0.f by default).

outlineThickness must be greater or equal to zero. If it is zero, no outline is visible.

void thor::ConcaveShape::setPoint ( std::size_t  index,
sf::Vector2f  position 
)

Sets the position of a point.

Parameters
indexWhich point? Must be in [0, getPointCount()[
positionNew point position in local coordinates.

The documentation for this class was generated from the following file: