Miscellaneous SFML related functionality, such as shapes and colors. More...
Namespaces | |
namespace | thor::Shapes |
Namespace for predefined shapes. | |
Classes | |
class | thor::Arrow |
Drawable arrow class, inherits sf::Drawable. More... | |
class | thor::ColorGradient |
Class to implement color gradients. More... | |
class | thor::ConcaveShape |
Concave shape class. More... | |
Functions | |
sf::Color | thor::BlendColors (const sf::Color &firstColor, const sf::Color &secondColor, float interpolation) |
Blends the colors firstColor and secondColor, according to the given interpolation. | |
std::string | thor::ToString (const sf::Color &color) |
Returns a std::string representation of sf::Color. | |
template<typename T > | |
std::string | thor::ToString (const sf::Vector2< T > &vector) |
Returns a std::string representation of sf::Vector2<T>. | |
template<typename T > | |
std::string | thor::ToString (const sf::Vector3< T > &vector) |
Returns a std::string representation of sf::Vector3<T>. | |
template<typename T > | |
std::string | thor::ToString (const sf::Rect< T > &rect) |
Returns a std::string representation of sf::Rect<T>. | |
template<typename T > | |
std::string | thor::ToString (const PolarVector2< T > &vector) |
Returns the string representation of thor::PolarVector<T>. | |
ColorGradientConvertible | thor::CreateGradient (const sf::Color &color) |
Creates a color gradient based on a list of colors and transitions. | |
void | thor::swap (ConcaveShape &lhs, ConcaveShape &rhs) |
Exchanges the contents of two concave shapes. | |
Variables | |
const sf::Color | thor::Transparency |
Transparent color == sf::Color(0,0,0,0). |
Miscellaneous SFML related functionality, such as shapes and colors.
sf::Color thor::BlendColors | ( | const sf::Color & | firstColor, |
const sf::Color & | secondColor, | ||
float | interpolation | ||
) |
Blends the colors firstColor and secondColor, according to the given interpolation.
firstColor | The first color to blend. |
secondColor | The second color to blend. |
interpolation | Specifies how much of every color is taken. If it has value 0, the first color is returned; with value 1, the second color is returned. Every value in ]0,1[ leads to a mixture. Other values are not allowed. |
ColorGradientConvertible CreateGradient | ( | const sf::Color & | color | ) | [related] |
Creates a color gradient based on a list of colors and transitions.
A color gradient consists of a list of N different colors and N-1 corresponding transition times (which specify how long it takes to morph one color to the other). So, the gradient is an alternating chain of colors and relative transition times, this is also the way you generate it:
thor::ColorGradient gradient = thor::CreateGradient(sf::Color::Red)(3.f)(sf::Color::Blue)(1.f)(sf::Color::Cyan);
In the above example, you have 3 colors and therefore 2 transitions. The gradient from red to blue takes 3 time units (the number between the colors), the one from blue to cyan takes 1 time unit. As mentioned, the transition times are relative to each other, i.e. the two partial gradients make up 75% and 25% of the whole gradient. Like this, you can build complexly composed gradients using a simple syntax.
std::string thor::ToString | ( | const sf::Color & | color | ) |
Returns a std::string representation of sf::Color.
Format: (r,g,b,a)
std::string thor::ToString | ( | const sf::Vector2< T > & | vector | ) |
Returns a std::string representation of sf::Vector2<T>.
Format: (x,y)
std::string thor::ToString | ( | const sf::Vector3< T > & | vector | ) |
Returns a std::string representation of sf::Vector3<T>.
Format: (x,y,z)
std::string thor::ToString | ( | const sf::Rect< T > & | rect | ) |
Returns a std::string representation of sf::Rect<T>.
Format: (Left,Top;Width,Height)
std::string thor::ToString | ( | const PolarVector2< T > & | vector | ) |
Returns the string representation of thor::PolarVector<T>.
Format: (r,phi�) - � represents the degree symbol (small circle)
const sf::Color thor::Transparency |
Transparent color == sf::Color(0,0,0,0).
Can be used as color for invisible objects.