Text defines a graphical 2D text, that can be drawn on screen. More...
#include <Text.hpp>
Public Types | |
enum | Style { Regular = 0, Bold = 1 << 0, Italic = 1 << 1, Underlined = 1 << 2 } |
Enumerate the string drawing styles. More... | |
Public Member Functions | |
Text () | |
Default constructor. | |
Text (const String &string, const Font &font=Font::GetDefaultFont(), unsigned int characterSize=30) | |
Construct the string from any kind of text. | |
void | SetString (const String &string) |
Set the text (from any kind of string). | |
void | SetFont (const Font &font) |
Set the font of the string. | |
void | SetCharacterSize (unsigned int size) |
Set the base size for the characters. | |
void | SetStyle (unsigned long style) |
Set the style of the text The default style is Regular. | |
const String & | GetString () const |
Get the text (the returned text can be converted implicitely to any kind of string). | |
const Font & | GetFont () const |
Get the font used by the string. | |
unsigned int | GetCharacterSize () const |
Get the base size of characters. | |
unsigned long | GetStyle () const |
Get the style of the text. | |
Vector2f | GetCharacterPos (std::size_t index) const |
Return the visual position of the Index-th character of the string, in coordinates relative to the string (note : translation, center, rotation and scale are not applied). | |
FloatRect | GetRect () const |
Get the string rectangle on screen. | |
void | SetPosition (float x, float y) |
Set the position of the object (take 2 values). | |
void | SetPosition (const Vector2f &position) |
Set the position of the object (take a 2D vector). | |
void | SetX (float x) |
Set the X position of the object. | |
void | SetY (float y) |
Set the Y position of the object. | |
void | SetScale (float factorX, float factorY) |
Set the scale of the object (take 2 values). | |
void | SetScale (const Vector2f &scale) |
Set the scale of the object (take a 2D vector). | |
void | SetScaleX (float factor) |
Set the X scale factor of the object. | |
void | SetScaleY (float factor) |
Set the Y scale factor of the object. | |
void | SetOrigin (float x, float y) |
Set the local origin of the object, in coordinates relative to the top-left of the object (take 2 values). | |
void | SetOrigin (const Vector2f &origin) |
Set the local origin of the object, in coordinates relative to the top-left of the object (take a 2D vector). | |
void | SetRotation (float angle) |
Set the orientation of the object. | |
void | SetColor (const Color &color) |
Set the color of the object. | |
void | SetBlendMode (Blend::Mode mode) |
Set the blending mode for the object. | |
const Vector2f & | GetPosition () const |
Get the position of the object. | |
const Vector2f & | GetScale () const |
Get the current scale of the object. | |
const Vector2f & | GetOrigin () const |
Get the local origin of the object. | |
float | GetRotation () const |
Get the orientation of the object. | |
const Color & | GetColor () const |
Get the color of the object. | |
Blend::Mode | GetBlendMode () const |
Get the current blending mode. | |
void | Move (float offsetX, float offsetY) |
Move the object of a given offset (take 2 values). | |
void | Move (const Vector2f &offset) |
Move the object of a given offset (take a 2D vector). | |
void | Scale (float factorX, float factorY) |
Scale the object (take 2 values). | |
void | Scale (const Vector2f &factor) |
Scale the object (take a 2D vector). | |
void | Rotate (float Angle) |
Rotate the object. | |
Vector2f | TransformToLocal (const Vector2f &point) const |
Transform a point from global coordinates into local coordinates (ie it applies the inverse of object's origin, translation, rotation and scale to the point). | |
Vector2f | TransformToGlobal (const Vector2f &point) const |
Transform a point from local coordinates into global coordinates (ie it applies the object's origin, translation, rotation and scale to the point). | |
Protected Member Functions | |
virtual void | Render (RenderTarget &target, Renderer &renderer) const |
/see Drawable::Render | |
const Matrix3 & | GetMatrix () const |
Get the transform matrix of the drawable. | |
const Matrix3 & | GetInverseMatrix () const |
Get the inverse transform matrix of the drawable. |
Text defines a graphical 2D text, that can be drawn on screen.
Definition at line 44 of file Text.hpp.
enum sf::Text::Style |
Blend::Mode sf::Drawable::GetBlendMode | ( | ) | const [inherited] |
Get the current blending mode.
Definition at line 263 of file Drawable.cpp.
Vector2f sf::Text::GetCharacterPos | ( | std::size_t | index | ) | const |
Return the visual position of the Index-th character of the string, in coordinates relative to the string (note : translation, center, rotation and scale are not applied).
index | : Index of the character |
unsigned int sf::Text::GetCharacterSize | ( | ) | const |
const Color & sf::Drawable::GetColor | ( | ) | const [inherited] |
const Font & sf::Text::GetFont | ( | ) | const |
const Matrix3 & sf::Drawable::GetInverseMatrix | ( | ) | const [protected, inherited] |
Get the inverse transform matrix of the drawable.
Definition at line 353 of file Drawable.cpp.
const Matrix3 & sf::Drawable::GetMatrix | ( | ) | const [protected, inherited] |
Get the transform matrix of the drawable.
Definition at line 337 of file Drawable.cpp.
const Vector2f & sf::Drawable::GetOrigin | ( | ) | const [inherited] |
Get the local origin of the object.
Get the origin of the object.
Definition at line 236 of file Drawable.cpp.
const Vector2f & sf::Drawable::GetPosition | ( | ) | const [inherited] |
Get the position of the object.
Definition at line 218 of file Drawable.cpp.
FloatRect sf::Text::GetRect | ( | ) | const |
float sf::Drawable::GetRotation | ( | ) | const [inherited] |
Get the orientation of the object.
Rotation is always in the range [0, 360]
Definition at line 245 of file Drawable.cpp.
const Vector2f & sf::Drawable::GetScale | ( | ) | const [inherited] |
Get the current scale of the object.
Definition at line 227 of file Drawable.cpp.
const String & sf::Text::GetString | ( | ) | const |
unsigned long sf::Text::GetStyle | ( | ) | const |
void sf::Drawable::Move | ( | const Vector2f & | offset | ) | [inherited] |
Move the object of a given offset (take a 2D vector).
offset | : Amount of units to move the object of |
Definition at line 282 of file Drawable.cpp.
void sf::Drawable::Move | ( | float | offsetX, | |
float | offsetY | |||
) | [inherited] |
Move the object of a given offset (take 2 values).
offsetX | : X offset | |
offsetY | : Y offset |
Definition at line 273 of file Drawable.cpp.
void sf::Text::Render | ( | RenderTarget & | target, | |
Renderer & | renderer | |||
) | const [protected, virtual] |
void sf::Drawable::Rotate | ( | float | Angle | ) | [inherited] |
Rotate the object.
Angle | : Angle of rotation, in degrees |
Definition at line 309 of file Drawable.cpp.
void sf::Drawable::Scale | ( | const Vector2f & | factor | ) | [inherited] |
Scale the object (take a 2D vector).
factor | : Scaling factors (both values must be strictly positive) |
Definition at line 300 of file Drawable.cpp.
void sf::Drawable::Scale | ( | float | factorX, | |
float | factorY | |||
) | [inherited] |
Scale the object (take 2 values).
factorX | : Scaling factor on X (must be strictly positive) | |
factorY | : Scaling factor on Y (must be strictly positive) |
Definition at line 291 of file Drawable.cpp.
void sf::Drawable::SetBlendMode | ( | Blend::Mode | mode | ) | [inherited] |
Set the blending mode for the object.
The default blend mode is Blend::Alpha
mode | : New blending mode |
The default blend mode is Blend::Alpha
Definition at line 209 of file Drawable.cpp.
void sf::Text::SetCharacterSize | ( | unsigned int | size | ) |
void sf::Drawable::SetColor | ( | const Color & | color | ) | [inherited] |
Set the color of the object.
The default color is white
color | : New color |
The default color is white
Definition at line 199 of file Drawable.cpp.
void sf::Text::SetFont | ( | const Font & | font | ) |
void sf::Drawable::SetOrigin | ( | const Vector2f & | origin | ) | [inherited] |
Set the local origin of the object, in coordinates relative to the top-left of the object (take a 2D vector).
The default origin is (0, 0)
origin | : New origin |
The default origin is (0, 0)
Definition at line 175 of file Drawable.cpp.
void sf::Drawable::SetOrigin | ( | float | x, | |
float | y | |||
) | [inherited] |
Set the local origin of the object, in coordinates relative to the top-left of the object (take 2 values).
The default origin is (0, 0)
x | : X coordinate of the origin | |
y | : Y coordinate of the origin |
The default origin is (0, 0)
Definition at line 160 of file Drawable.cpp.
void sf::Drawable::SetPosition | ( | const Vector2f & | position | ) | [inherited] |
Set the position of the object (take a 2D vector).
position | : New position |
Definition at line 74 of file Drawable.cpp.
void sf::Drawable::SetPosition | ( | float | x, | |
float | y | |||
) | [inherited] |
Set the position of the object (take 2 values).
x | : New X coordinate | |
y | : New Y coordinate |
Definition at line 64 of file Drawable.cpp.
void sf::Drawable::SetRotation | ( | float | angle | ) | [inherited] |
Set the orientation of the object.
angle | : Angle of rotation, in degrees |
Definition at line 184 of file Drawable.cpp.
void sf::Drawable::SetScale | ( | const Vector2f & | scale | ) | [inherited] |
Set the scale of the object (take a 2D vector).
Scale | : New scale (both values must be strictly positive) |
Definition at line 118 of file Drawable.cpp.
void sf::Drawable::SetScale | ( | float | factorX, | |
float | factorY | |||
) | [inherited] |
Set the scale of the object (take 2 values).
factorX | : New horizontal scale (must be strictly positive) | |
factorY | : New vertical scale (must be strictly positive) |
Definition at line 108 of file Drawable.cpp.
void sf::Drawable::SetScaleX | ( | float | factor | ) | [inherited] |
Set the X scale factor of the object.
factor | : New X scale factor |
Definition at line 128 of file Drawable.cpp.
void sf::Drawable::SetScaleY | ( | float | factor | ) | [inherited] |
Set the Y scale factor of the object.
factor | : New Y scale factor |
Definition at line 143 of file Drawable.cpp.
void sf::Text::SetString | ( | const String & | string | ) |
void sf::Text::SetStyle | ( | unsigned long | style | ) |
void sf::Drawable::SetX | ( | float | x | ) | [inherited] |
Set the X position of the object.
x | : New X coordinate |
Definition at line 84 of file Drawable.cpp.
void sf::Drawable::SetY | ( | float | y | ) | [inherited] |
Set the Y position of the object.
y | : New Y coordinate |
Definition at line 96 of file Drawable.cpp.
Transform a point from local coordinates into global coordinates (ie it applies the object's origin, translation, rotation and scale to the point).
point | : Point to transform |
Definition at line 328 of file Drawable.cpp.
Transform a point from global coordinates into local coordinates (ie it applies the inverse of object's origin, translation, rotation and scale to the point).
point | : Point to transform |
Definition at line 319 of file Drawable.cpp.