Platform Data Engine 0.0.1
A data-driven game engine for platformers
PlatformDataEngine::TextDrawable Class Reference

A more generic text render drawable that can be used outside a component context More...

#include <TextDrawable.h>

Inheritance diagram for PlatformDataEngine::TextDrawable:

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)
 

Detailed Description

A more generic text render drawable that can be used outside a component context

Constructor & Destructor Documentation

◆ TextDrawable()

TextDrawable::TextDrawable ( int  fontSize,
bool  bold,
float  renderSize,
const std::string &  text 
)

Constructor

Parameters
fontSizethe font size
boldif true, bold font
renderSizethe render size, sort of like scale, independant from font size
textthe text to draw

Member Function Documentation

◆ draw()

void TextDrawable::draw ( sf::RenderTarget &  target,
sf::RenderStates  states 
) const

Draws the text, never call directly always use target.draw(textDrawable);

Parameters
target
states

◆ setText()

void TextDrawable::setText ( const std::string &  text)

Sets the new text in the text drawable

Parameters
texttext to set

The documentation for this class was generated from the following files: