Platform Data Engine 0.0.1
A data-driven game engine for platformers
|
A more generic text render drawable that can be used outside a component context More...
#include <TextDrawable.h>
Public Member Functions | |
TextDrawable (std::string fontFilename="assets/smallest_pixel-7.ttf") | |
Default constructor | |
TextDrawable (int fontSize, bool bold, float renderSize, const std::string &text) | |
Constructor More... | |
void | setText (const std::string &text) |
Sets the new text in the text drawable More... | |
void | draw (sf::RenderTarget &target, sf::RenderStates states) const |
Draws the text, never call directly always use target.draw(textDrawable); More... | |
sf::Font & | getFont () |
int | getFontSize () const |
bool | getFontBold () const |
float | getRenderSize () const |
const std::string & | getText () const |
const sf::FloatRect | getBounds () const |
std::shared_ptr< sf::Shader > | getShader () const |
void | setFont (const sf::Font &font) |
void | setFontSize (int fontSize) |
void | setFontBold (bool bold) |
void | setRenderSize (float renderSize) |
void | setColor (const sf::Color &color) |
A more generic text render drawable that can be used outside a component context
TextDrawable::TextDrawable | ( | int | fontSize, |
bool | bold, | ||
float | renderSize, | ||
const std::string & | text | ||
) |
Constructor
fontSize | the font size |
bold | if true, bold font |
renderSize | the render size, sort of like scale, independant from font size |
text | the text to draw |
void TextDrawable::draw | ( | sf::RenderTarget & | target, |
sf::RenderStates | states | ||
) | const |
Draws the text, never call directly always use target.draw(textDrawable);
target | |
states |
void TextDrawable::setText | ( | const std::string & | text | ) |
Sets the new text in the text drawable
text | text to set |