String of glyphs rendered with a font.
More...
#include <Text.hpp>
String of glyphs rendered with a font.
Definition at line 22 of file Text.hpp.
◆ Alignment
Text alignment.
Enumerator |
---|
LEFT | 0 | |
CENTER | 1 | |
RIGHT | 2 | |
Definition at line 28 of file Text.hpp.
◆ Text() [1/3]
galaxy::graphics::Text::Text |
( |
| ) |
|
Constructor.
Definition at line 22 of file Text.cpp.
◆ Text() [2/3]
galaxy::graphics::Text::Text |
( |
Text && | t | ) |
|
Move constructor.
Definition at line 33 of file Text.cpp.
◆ ~Text()
galaxy::graphics::Text::~Text |
( |
| ) |
|
Destructor.
Definition at line 66 of file Text.cpp.
◆ Text() [3/3]
galaxy::graphics::Text::Text |
( |
const Text & | | ) |
|
|
privatedelete |
◆ operator=() [1/2]
Text & galaxy::graphics::Text::operator= |
( |
Text && | t | ) |
|
Move assignment operator.
Definition at line 47 of file Text.cpp.
◆ create()
Creates the rendered text.
- Parameters
-
text | Text to display. Supports newlines. |
size | Size of text in em. |
font | Font to use. |
colour | Font colour. |
alignment | Text alignment. Defaults to LEFT. |
Definition at line 71 of file Text.cpp.
◆ set_font()
void galaxy::graphics::Text::set_font |
( |
std::string_view | font | ) |
|
Update the font used.
- Parameters
-
Definition at line 84 of file Text.cpp.
◆ update() [1/4]
void galaxy::graphics::Text::update |
( |
std::string_view | text | ) |
|
Update the rendered text.
- Parameters
-
text | Text to display. Supports newlines. |
Definition at line 158 of file Text.cpp.
◆ update() [2/4]
void galaxy::graphics::Text::update |
( |
const float | size | ) |
|
Update the rendered text.
- Parameters
-
Definition at line 166 of file Text.cpp.
◆ update() [3/4]
void galaxy::graphics::Text::update |
( |
const Alignment | alignment | ) |
|
Update the rendered text.
- Parameters
-
Definition at line 173 of file Text.cpp.
◆ width()
float galaxy::graphics::Text::width |
( |
| ) |
const |
|
nodiscard |
Get text width.
Is cached for performance.
- Returns
- Width as float.
Definition at line 180 of file Text.cpp.
◆ height()
float galaxy::graphics::Text::height |
( |
| ) |
const |
|
nodiscard |
Get text height.
Is cached for performance.
- Returns
- Height as float.
Definition at line 185 of file Text.cpp.
◆ get_text()
const std::string & galaxy::graphics::Text::get_text |
( |
| ) |
const |
|
nodiscard |
Get text.
Is cached for performance.
- Returns
- Const string reference.
Definition at line 190 of file Text.cpp.
◆ get_size()
float galaxy::graphics::Text::get_size |
( |
| ) |
const |
|
nodiscard |
Get text em size.
Is cached for performance.
- Returns
- Float as EM.
Definition at line 195 of file Text.cpp.
◆ get_alignment()
Get the text alignment.
- Returns
- Alignment enum.
Definition at line 200 of file Text.cpp.
◆ get_font()
const std::string & galaxy::graphics::Text::get_font |
( |
| ) |
const |
|
nodiscard |
Get font ID.
- Returns
- Const string reference.
Definition at line 205 of file Text.cpp.
◆ vao()
Get vertex array.
- Returns
- Reference.
Definition at line 210 of file Text.cpp.
◆ render_texture()
Get render texture.
- Returns
- Reference.
Definition at line 215 of file Text.cpp.
◆ operator=() [2/2]
Text & galaxy::graphics::Text::operator= |
( |
const Text & | | ) |
|
|
privatedelete |
Copy assignment operator.
◆ update() [4/4]
void galaxy::graphics::Text::update |
( |
| ) |
|
|
private |
Update the rendered text.
Definition at line 89 of file Text.cpp.
◆ m_colour
◆ m_vao
◆ m_rt
◆ m_font_name
std::string galaxy::graphics::Text::m_font_name |
|
private |
◆ m_font
Pointer to font resource.
Definition at line 205 of file Text.hpp.
◆ m_text
std::string galaxy::graphics::Text::m_text |
|
private |
◆ m_size
float galaxy::graphics::Text::m_size |
|
private |
◆ m_alignment
Alignment galaxy::graphics::Text::m_alignment |
|
private |
The documentation for this class was generated from the following files:
- galaxy/src/galaxy/graphics/text/Text.hpp
- galaxy/src/galaxy/graphics/text/Text.cpp