Namespace for predefined shapes. More...
Functions | |
sf::ConvexShape | toConvexShape (const sf::Shape &shape) |
Converts a specific shape to a general, convex SFML shape. More... | |
sf::ConvexShape | line (sf::Vector2f direction, const sf::Color &color, float thickness=1.f) |
Creates a line shape. More... | |
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. More... | |
sf::ConvexShape | polygon (std::size_t nbPoints, float radius, const sf::Color &fillColor, float outlineThickness=0.f, const sf::Color &outlineColor=sf::Color()) |
Creates a regular, convex polygon shape. More... | |
sf::ConvexShape | star (std::size_t nbStarPoints, float innerRadius, float outerRadius, const sf::Color &fillColor, float outlineThickness=0.f, const sf::Color &outlineColor=sf::Color()) |
Creates a regular star shape. More... | |
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.
sf::ConvexShape thor::Shapes::line | ( | sf::Vector2f | direction, |
const sf::Color & | color, | ||
float | thickness = 1.f |
||
) |
Creates a line shape.
This is a simple function that returns directly a shape. If you want a more flexible line implementation that can also be changed after creation, look at the thor::Arrow class and its Line style.
direction | Line direction. |
thickness | Line thickness (> 0.f). |
color | Color of the line. |
sf::ConvexShape thor::Shapes::polygon | ( | std::size_t | nbPoints, |
float | radius, | ||
const sf::Color & | fillColor, | ||
float | outlineThickness = 0.f , |
||
const sf::Color & | outlineColor = sf::Color() |
||
) |
Creates a regular, convex polygon shape.
nbPoints | The number of polygon points (the smallest possible value is 3 for a triangle). |
radius | The distance from the center to the points (> 0.f). |
fillColor | The color which is used to fill the inside of the polygon. |
outlineThickness | The thickness of the outline. |
outlineColor | The color used for the outline. |
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.
size | Width and height of the rectangle. |
cornerRadius | The radius of the circle at the corners. |
fillColor | The rounded rectangle's fill color. |
outlineThickness | The thickness of the outline. |
outlineColor | Color used for the outline. |
sf::ConvexShape thor::Shapes::star | ( | std::size_t | nbStarPoints, |
float | innerRadius, | ||
float | outerRadius, | ||
const sf::Color & | fillColor, | ||
float | outlineThickness = 0.f , |
||
const sf::Color & | outlineColor = sf::Color() |
||
) |
Creates a regular star shape.
nbStarPoints | The number of points (the smallest possible is a 3-pointed star). |
innerRadius | The distance from the center to the inner points (> 0.f). |
outerRadius | The distance from the center to the outer points (> innerRadius). |
fillColor | The color which is used to fill the star. |
outlineThickness | The thickness of the outline. |
outlineColor | The color used for the outline. |
sf::ConvexShape thor::Shapes::toConvexShape | ( | const sf::Shape & | shape | ) |
Converts a specific shape to a general, convex SFML shape.