|
libmx2 2.2.1
C++20 multimedia and game-engine library (SDL2 / OpenGL / Vulkan)
|
Helper for rendering text strings with SDL_Renderer. More...
#include <font.hpp>
Public Member Functions | |
| Text ()=default | |
| Default constructor. | |
| void | setRenderer (SDL_Renderer *renderer) |
| Set the SDL renderer used for all draw calls. | |
| void | setColor (SDL_Color color) |
| Set the colour used when rendering text. | |
| void | printText_Solid (const Font &f, int x, int y, const std::string &text) |
| Render text with solid (no anti-aliasing) blending. | |
| void | printText_Blended (const Font &f, int x, int y, const std::string &text) |
| Render text with blended (anti-aliased) quality. | |
Private Attributes | |
| SDL_Renderer * | renderer = nullptr |
| Active renderer. | |
| SDL_Color | color_value |
| Current text colour. | |
Helper for rendering text strings with SDL_Renderer.
Renders text glyphs onto the active SDL_Renderer using either solid (fast) or blended (anti-aliased) rendering modes.
|
default |
Default constructor.
References renderer.
| void mx::Text::printText_Blended | ( | const Font & | f, |
| int | x, | ||
| int | y, | ||
| const std::string & | text ) |
Render text with blended (anti-aliased) quality.
| f | Font to use. |
| x | X position in renderer coordinates. |
| y | Y position in renderer coordinates. |
| text | String to render. |
Definition at line 97 of file font.cpp.
References color_value, renderer, mx::system_err, and mx::Font::wrapper().
| void mx::Text::printText_Solid | ( | const Font & | f, |
| int | x, | ||
| int | y, | ||
| const std::string & | text ) |
Render text with solid (no anti-aliasing) blending.
| f | Font to use. |
| x | X position in renderer coordinates. |
| y | Y position in renderer coordinates. |
| text | String to render. |
Definition at line 79 of file font.cpp.
References color_value, renderer, mx::system_err, and mx::Font::wrapper().
| void mx::Text::setColor | ( | SDL_Color | color | ) |
Set the colour used when rendering text.
| color | Desired text colour. |
Definition at line 75 of file font.cpp.
References color_value.
| void mx::Text::setRenderer | ( | SDL_Renderer * | renderer | ) |
|
private |
Current text colour.
Definition at line 153 of file font.hpp.
Referenced by printText_Blended(), printText_Solid(), and setColor().
|
private |
Active renderer.
Definition at line 152 of file font.hpp.
Referenced by printText_Blended(), printText_Solid(), setRenderer(), and Text().