HIRO_DRAW
Computer Graphics Structures library
hiro::draw::TextRenderer Class Reference

Responsible for rendering texts. More...

Public Member Functions

 TextRenderer (const hiro::draw::TextRenderer &)=delete
 
size_t LoadFont (const std::string &font_file, float font_height)
 Load TTF font file from disk and returns unique identifier of the font.
 
void SetFont (const size_t font_id)
 Sets an active font by its identifier.
 
void SetColor (const cogs::Color4b &color)
 Sets active color for the text.
 
void SetAlignment (hiro::draw::TextAlignment alignment)
 Sets active text alignment for the text.
 
void Print (glm::ivec2 pos, const std::string &text)
 Prints specified text with the alignment origin at the specified position.
 
void SetSceneContext (const hiro::draw::PScene &scene)
 Sets active rendering context for the text. Not to be called by a user.
 

Friends

class RenderSystem
 

Detailed Description

Responsible for rendering texts.

TextRenderer has an active state which includes font, color, alignment etc. and all Print calls use current active state for the rendering.

Instance of this object stores all print calls and state changes, and renders texts automatically at the same time.