Shapes.hpp
Go to the documentation of this file.
1 //
3 // Thor C++ Library
4 // Copyright (c) 2011-2016 Jan Haller
5 //
6 // This software is provided 'as-is', without any express or implied
7 // warranty. In no event will the authors be held liable for any damages
8 // arising from the use of this software.
9 //
10 // Permission is granted to anyone to use this software for any purpose,
11 // including commercial applications, and to alter it and redistribute it
12 // freely, subject to the following restrictions:
13 //
14 // 1. The origin of this software must not be misrepresented; you must not
15 // claim that you wrote the original software. If you use this software
16 // in a product, an acknowledgment in the product documentation would be
17 // appreciated but is not required.
18 //
19 // 2. Altered source versions must be plainly marked as such, and must not be
20 // misrepresented as being the original software.
21 //
22 // 3. This notice may not be removed or altered from any source distribution.
23 //
25 
28 
29 #ifndef THOR_SHAPES_HPP
30 #define THOR_SHAPES_HPP
31 
32 #include <Thor/Config.hpp>
33 
34 #include <SFML/System/Vector2.hpp>
35 #include <SFML/Graphics/Color.hpp>
36 
37 #include <cstddef> // std::size_t
38 
39 
40 namespace sf
41 {
42 
43  class Shape;
44  class ConvexShape;
45 
46 } // namespace sf
47 
48 
49 namespace thor
50 {
51 
54 
58 namespace Shapes
59 {
60 
64  sf::ConvexShape THOR_API toConvexShape(const sf::Shape& shape);
65 
73  sf::ConvexShape THOR_API line(sf::Vector2f direction, const sf::Color& color, float thickness = 1.f);
74 
82  sf::ConvexShape THOR_API roundedRect(sf::Vector2f size, float cornerRadius,
83  const sf::Color& fillColor, float outlineThickness = 0.f, const sf::Color& outlineColor = sf::Color());
84 
92  sf::ConvexShape THOR_API polygon(std::size_t nbPoints, float radius, const sf::Color& fillColor,
93  float outlineThickness = 0.f, const sf::Color& outlineColor = sf::Color());
94 
103  sf::ConvexShape THOR_API star(std::size_t nbStarPoints, float innerRadius, float outerRadius, const sf::Color& fillColor,
104  float outlineThickness = 0.f, const sf::Color& outlineColor = sf::Color());
105 
106 } // namespace Shapes
107 
109 
110 } // namespace thor
111 
112 #endif // THOR_SHAPES_HPP
Definition: AnimationMap.hpp:42
sf::ConvexShape toConvexShape(const sf::Shape &shape)
Converts a specific shape to a general, convex SFML shape.
Configuration header of the library.
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.
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.
Definition: BigSprite.hpp:41
sf::ConvexShape line(sf::Vector2f direction, const sf::Color &color, float thickness=1.f)
Creates a line shape.
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.