Bromeon
Namespaces | Classes | Functions | Variables
Multimedia

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).

Detailed Description

Miscellaneous SFML related functionality, such as shapes and colors.


Function Documentation

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.

Parameters:
firstColorThe first color to blend.
secondColorThe second color to blend.
interpolationSpecifies 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.

Returns:
Implementation-defined type that is convertible to thor::ColorGradient. Do not use the type directly.
std::string thor::ToString ( const sf::Color &  color)

Returns a std::string representation of sf::Color.

Format: (r,g,b,a)

template<typename T >
std::string thor::ToString ( const sf::Vector2< T > &  vector)

Returns a std::string representation of sf::Vector2<T>.

Format: (x,y)

template<typename T >
std::string thor::ToString ( const sf::Vector3< T > &  vector)

Returns a std::string representation of sf::Vector3<T>.

Format: (x,y,z)

template<typename T >
std::string thor::ToString ( const sf::Rect< T > &  rect)

Returns a std::string representation of sf::Rect<T>.

Format: (Left,Top;Width,Height)

template<typename T >
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)


Variable Documentation

const sf::Color thor::Transparency

Transparent color == sf::Color(0,0,0,0).

Can be used as color for invisible objects.