Define the functions and variables required to display texts. More...
#include <TextDisplay.hpp>
Public Member Functions | |
TextDisplay (Vec2 position, SDL_Renderer *renderer, TTF_Font *font, std::string text) | |
void | setText (std::string const &textToDisplay) |
~TextDisplay () | |
void | Update (int x, int y, std::string text) |
void | Draw () |
Public Member Functions inherited from Component | |
Component () | |
~Component () | |
Public Attributes | |
Vec2 | position {} |
The in-game position of this text. More... | |
SDL_Renderer * | renderer |
Reference to SDL renderer. More... | |
TTF_Font * | font |
Reference to the font object we loaded. More... | |
SDL_Surface * | surface {} |
Reference to SDL text surface. More... | |
SDL_Texture * | texture {} |
Reference to SDL text texture. More... | |
SDL_Rect | rect {} |
The box area that will contain the generated text area. More... | |
Define the functions and variables required to display texts.
TextDisplay::TextDisplay | ( | Vec2 | position, |
SDL_Renderer * | renderer, | ||
TTF_Font * | font, | ||
std::string | text | ||
) |
Constructor
position | The in-game position of this text. |
renderer | Reference to SDL renderer. |
font | Reference to the font object. |
text | The content of this text. |
TextDisplay::~TextDisplay | ( | ) |
Destructor
void TextDisplay::Draw | ( | ) |
Render the text on the screen.
void TextDisplay::setText | ( | std::string const & | textToDisplay | ) |
Modify the content of this text.
void TextDisplay::Update | ( | int | x, |
int | y, | ||
std::string | text | ||
) |
Update position and text
TTF_Font* TextDisplay::font |
Reference to the font object we loaded.
Vec2 TextDisplay::position {} |
The in-game position of this text.
SDL_Rect TextDisplay::rect {} |
The box area that will contain the generated text area.
SDL_Renderer* TextDisplay::renderer |
Reference to SDL renderer.
SDL_Surface* TextDisplay::surface {} |
Reference to SDL text surface.
SDL_Texture* TextDisplay::texture {} |
Reference to SDL text texture.