#include <Text.hpp>
A class for displaying text. More...
A class for displaying text.
A Text uses the Font's glyphs and displays them to the screen. A Text is a Transformable object, so you can move/rotate/scale/colorize it.
Public Member Functions | |
Text () | |
Construct a null Text. It can't be drawn. More... | |
Text (Font &font) | |
Constructor. More... | |
Text (Font &font, const std::string &text) | |
Constructor. More... | |
Text (Font &font, const std::wstring &text) | |
Constructor. More... | |
void | SetString (const std::wstring &wide_string) |
Update the text to be drawn. More... | |
void | SetString (const std::string &string) |
Update the text to be drawn. More... | |
void | SetFont (Font &font) |
Update the Font to be used. More... | |
void | Draw (RenderTarget &target, RenderState state) const override |
Draw the Text to the screen. More... | |
glm::vec2 | ComputeDimensions () const |
Text (Text &&)=default | |
Text (const Text &)=default | |
Text & | operator= (Text &&) noexcept=default |
Text & | operator= (const Text &)=default |
void | SetCenter (float center_x, float center_y) |
Set the center of the object. It is used as the rotation center. The center of the object will be drawn exactly on (0,0) on the screen (plus its potential translation if any) More... | |
void | SetCenter (const glm::vec2 ¢er) |
Set the center of the object. It is used as the rotation center. The center of the object will be drawn exactly on (0,0) on the screen (plus its potential translation if any) More... | |
void | Move (const glm::vec2 &move) |
void | Move (float x, float y) |
void | SetPosition (float x, float y) |
Set the position of the object to be drawn. More... | |
void | SetPosition (const glm::vec2 &position) |
Set the position of the object to be drawn. More... | |
void | Rotate (float rotation) |
Increase the rotation of the object to apply before drawing it. More... | |
void | SetRotation (float rotation) |
Set the rotation to apply before drawing the object. More... | |
void | SetScale (float scale) |
Increase or decrease the size of the object being drawn. More... | |
void | SetScale (const glm::vec2 &scale) |
Increase or decrease the size of the object being drawn. More... | |
void | SetScale (float scale_x, float scale_y) |
Increase or decrease the size of the object being drawn. More... | |
void | SetScaleX (float scale_x) |
Increase or decrease the size of the object being drawn. More... | |
void | SetScaleY (float scale_y) |
Increase or decrease the size of the object being drawn. More... | |
glm::mat4 | transformation () const override |
Increase or decrease the size of the object being drawn. More... | |
void | SetColor (const glm::vec4 &color) |
Color. More... | |
const glm::vec4 & | color () const |
void | SetTexture (Texture texture) |
Set the object's texture. More... | |
const Texture & | texture () const |
void | SetBlendMode (const BlendMode &) |
Set the blending mode to be used for drawing the object. More... | |
const BlendMode & | blend_mode () const |
void | SetVertexArray (VertexArray vertex_array) |
Set the object's shape. More... | |
const VertexArray & | vertex_array () const |
Public Attributes | |
Font * | font_ = nullptr |
std::wstring | string_ |
|
default |
Construct a null Text. It can't be drawn.
smk::Text::Text | ( | Font & | font | ) |
smk::Text::Text | ( | Font & | font, |
const std::string & | text | ||
) |
smk::Text::Text | ( | Font & | font, |
const std::wstring & | text | ||
) |
|
inlineinherited |
Definition at line 36 of file Transformable.hpp.
|
inlineinherited |
Definition at line 28 of file Transformable.hpp.
glm::vec2 smk::Text::ComputeDimensions | ( | ) | const |
Compute the dimension of the text when drawn to the screen.
Definition at line 207 of file Text.cpp.
|
overridevirtual |
Draw the Text to the screen.
Implements smk::Drawable.
Definition at line 160 of file Text.cpp.
|
inherited |
Increase the position of the object being drawn.
move | The increment of position (x,y) |
Definition at line 44 of file Transformable.cpp.
|
inherited |
Increase the position of the object being drawn.
x | The increment of position along the horizontal axis. |
y | The increment of position along the vertical axis. |
Definition at line 52 of file Transformable.cpp.
|
inherited |
Increase the rotation of the object to apply before drawing it.
rotation | The delta of rotation to be added. |
Definition at line 22 of file Transformable.cpp.
|
inherited |
Set the blending mode to be used for drawing the object.
blend_mode | the BlendMode to be used. |
Definition at line 133 of file Transformable.cpp.
|
inherited |
Set the center of the object. It is used as the rotation center. The center of the object will be drawn exactly on (0,0) on the screen (plus its potential translation if any)
center | The center position (x,y) in the object. |
Definition at line 60 of file Transformable.cpp.
|
inherited |
Set the center of the object. It is used as the rotation center. The center of the object will be drawn exactly on (0,0) on the screen (plus its potential translation if any)
x | The center position along the horizontal axis. |
y | The center position along the vertical axis. |
Definition at line 69 of file Transformable.cpp.
|
inherited |
Modify the color of the object. The resulting pixel is the multiplication component wise in between this color and the original pixel color.
color | The color. |
Definition at line 127 of file Transformable.cpp.
void smk::Text::SetFont | ( | Font & | font | ) |
|
inherited |
Set the position of the object to be drawn.
position | the position (x,y) of the object. |
Definition at line 29 of file Transformable.cpp.
|
inherited |
Set the position of the object to be drawn.
x | The position along the horizontal axis. |
y | The position along the vertical axis. |
Definition at line 37 of file Transformable.cpp.
|
inherited |
Set the rotation to apply before drawing the object.
rotation | The angle in radian. |
Definition at line 15 of file Transformable.cpp.
|
inherited |
Increase or decrease the size of the object being drawn.
scale | The ratio of magnification. |
Definition at line 81 of file Transformable.cpp.
|
inherited |
Increase or decrease the size of the object being drawn.
scale | The ratio of magnification. |
Definition at line 75 of file Transformable.cpp.
|
inherited |
Increase or decrease the size of the object being drawn.
scale_x | The ratio of magnification along the horizontal axis. |
scale_y | The ratio of magnification along the vertical axis. |
Definition at line 88 of file Transformable.cpp.
|
inherited |
Increase or decrease the size of the object being drawn.
scale_x | The ratio of magnification along the horizontal axis. |
Definition at line 95 of file Transformable.cpp.
|
inherited |
Increase or decrease the size of the object being drawn.
scale_y | The ratio of magnification along the vertical axis. |
Definition at line 101 of file Transformable.cpp.
void smk::Text::SetString | ( | const std::string & | string | ) |
void smk::Text::SetString | ( | const std::wstring & | wide_string | ) |
|
inherited |
Set the object's texture.
Definition at line 138 of file Transformable.cpp.
|
inherited |
Set the object's shape.
Definition at line 143 of file Transformable.cpp.
|
inlineinherited |
Definition at line 32 of file Transformable.hpp.
|
overridevirtualinherited |
Increase or decrease the size of the object being drawn.
Implements smk::TransformableBase.
Definition at line 109 of file Transformable.cpp.
|
inlineinherited |
Definition at line 40 of file Transformable.hpp.