Bromeon
Functions
thor::Shapes Namespace Reference

Namespace for predefined shapes. More...

Functions

sf::ConvexShape ToConvexShape (const sf::Shape &shape)
 Converts a specific shape to a general, convex SFML shape.
sf::ConvexShape Line (sf::Vector2f direction, const sf::Color &color, float thickness=1.f)
 Creates a rectangle with radiused corners.
sf::ConvexShape RoundedRect (sf::Vector2f size, float cornerRadius, const sf::Color &fillColor, float outlineThickness=0.f, const sf::Color &outlineColor=sf::Color())
 Creates a rectangle with radiused corners.
sf::ConvexShape Polygon (unsigned int nbPoints, float radius, const sf::Color &fillColor, float outlineThickness=0.f, const sf::Color &outlineColor=sf::Color())
 Creates a regular, convex polygon shape.
sf::ConvexShape Star (unsigned int nbStarPoints, float innerRadius, float outerRadius, const sf::Color &fillColor, float outlineThickness=0.f, const sf::Color &outlineColor=sf::Color())
 Creates a regular star shape.
ConcaveShape Pie (float radius, float filledAngle, const sf::Color &fillColor, float outlineThickness=0.f, const sf::Color &outlineColor=sf::Color())
 Creates a pie (a sector of a circle).

Detailed Description

Namespace for predefined shapes.

This namespace contains some functions to create predefined shapes like stars or rounded rectangles. The namespace Shapes can be considered an extension to the specific SFML shape classes like sf::CircleShape or sf::RectangleShape.


Function Documentation

sf::ConvexShape thor::Shapes::Line ( sf::Vector2f  direction,
const sf::Color &  color,
float  thickness = 1.f 
)

Creates a rectangle with radiused corners.

Parameters:
directionLine direction.
thicknessLine thickness (> 0.f).
colorColor of the line.
Returns:
A sf::ConvexShape copy representing the line.
ConcaveShape thor::Shapes::Pie ( float  radius,
float  filledAngle,
const sf::Color &  fillColor,
float  outlineThickness = 0.f,
const sf::Color &  outlineColor = sf::Color() 
)

Creates a pie (a sector of a circle).

Parameters:
radiusRadius of the circle.
filledAngleThe part of the circle which is filled (angle in degrees). The value doesn't have to be inside [0,360[.
fillColorThe color which is used to fill the pie.
outlineThicknessThe thickness of the outline.
outlineColorThe color used for the outline.
Returns:
A concave shape representing the pie.
sf::ConvexShape thor::Shapes::Polygon ( unsigned int  nbPoints,
float  radius,
const sf::Color &  fillColor,
float  outlineThickness = 0.f,
const sf::Color &  outlineColor = sf::Color() 
)

Creates a regular, convex polygon shape.

Parameters:
nbPointsThe number of polygon points (the smallest possible value is 3 for a triangle).
radiusThe distance from the center to the points (> 0.f).
fillColorThe color which is used to fill the inside of the polygon.
outlineThicknessThe thickness of the outline.
outlineColorThe color used for the outline.
Returns:
A sf::ConvexShape copy representing the regular polygon.
sf::ConvexShape thor::Shapes::RoundedRect ( sf::Vector2f  size,
float  cornerRadius,
const sf::Color &  fillColor,
float  outlineThickness = 0.f,
const sf::Color &  outlineColor = sf::Color() 
)

Creates a rectangle with radiused corners.

Parameters:
sizeWidth and height of the rectangle.
cornerRadiusThe radius of the circle at the corners.
fillColorThe rounded rectangle's fill color.
outlineThicknessThe thickness of the outline.
outlineColorColor used for the outline.
Returns:
A sf::ConvexShape copy containing the rounded rectangle.
sf::ConvexShape thor::Shapes::Star ( unsigned int  nbStarPoints,
float  innerRadius,
float  outerRadius,
const sf::Color &  fillColor,
float  outlineThickness = 0.f,
const sf::Color &  outlineColor = sf::Color() 
)

Creates a regular star shape.

Parameters:
nbStarPointsThe number of points (the smallest possible is a 3-pointed star).
innerRadiusThe distance from the center to the inner points (> 0.f).
outerRadiusThe distance from the center to the outer points (> innerRadius).
fillColorThe color which is used to fill the star.
outlineThicknessThe thickness of the outline.
outlineColorThe color used for the outline.
Returns:
A convex shape representing the star.
sf::ConvexShape thor::Shapes::ToConvexShape ( const sf::Shape &  shape)

Converts a specific shape to a general, convex SFML shape.

Returns:
General shape with the same properties (shape attributes, texture, transform) as the parameter. Note that you lose specific information (such as a circle radius) during this conversion.