2D_Game_Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
TextRenderer Class Reference

#include <textrenderer.hpp>

Public Member Functions

 TextRenderer ()
 
 TextRenderer (const std::string &font_path, float glyph_size, bool fixed)
 
 TextRenderer (const std::string &font_path, float glyph_size, bool fixed, uint32_t id)
 
 ~TextRenderer ()
 
void DrawText (const std::string &text, float x, float y, float scale, int layer, Vec3 color)
 
void _DrawText (const std::string &text, float x, float y, float scale, Vec3 color)
 
std::pair< float, float > GetTextSize (std::string text, float scale)
 
void UpdateProjMat (glm::mat4 &proj)
 

Public Attributes

uint32_t m_ID
 
std::string m_FontPath
 
float m_GlyphSize
 
bool m_Fixed
 

Friends

class SceneSerializer
 
class FontManager
 

Detailed Description

Definition at line 14 of file textrenderer.hpp.

Constructor & Destructor Documentation

◆ TextRenderer() [1/3]

TextRenderer::TextRenderer ( )
inline

Definition at line 16 of file textrenderer.hpp.

◆ TextRenderer() [2/3]

TextRenderer::TextRenderer ( const std::string & font_path,
float glyph_size,
bool fixed )
Parameters
fixedfalse if its position should be relative to the camera

Definition at line 6 of file textrenderer.cpp.

◆ TextRenderer() [3/3]

TextRenderer::TextRenderer ( const std::string & font_path,
float glyph_size,
bool fixed,
uint32_t id )
Parameters
fixedfalse if its position should be relative to the camera

Definition at line 24 of file textrenderer.cpp.

◆ ~TextRenderer()

TextRenderer::~TextRenderer ( )

Definition at line 42 of file textrenderer.cpp.

Member Function Documentation

◆ _DrawText()

void TextRenderer::_DrawText ( const std::string & text,
float x,
float y,
float scale,
Vec3 color )

Istantaneously draw the text. Coordinates are expected in engine units (screen width = 10 units)

Parameters
texta string containing the text
xthe x position of the text
ythe y position of the text
scalethe scale of the text
colorthe color of the text

Definition at line 61 of file textrenderer.cpp.

◆ DrawText()

void TextRenderer::DrawText ( const std::string & text,
float x,
float y,
float scale,
int layer,
Vec3 color )

Draw the text. Coordinates are expected in engine units (screen width = 10 units)

Parameters
texta string containing the text
xthe x position of the text
ythe y position of the text
scalethe scale of the text
colorthe color of the text

Definition at line 51 of file textrenderer.cpp.

◆ GetTextSize()

std::pair< float, float > TextRenderer::GetTextSize ( std::string text,
float scale )

Get the size of the text.

Parameters
texta string containing the text
scalethe scale of the text

Definition at line 103 of file textrenderer.cpp.

◆ UpdateProjMat()

void TextRenderer::UpdateProjMat ( glm::mat4 & proj)
inline

Definition at line 55 of file textrenderer.hpp.

Friends And Related Symbol Documentation

◆ FontManager

friend class FontManager
friend

Definition at line 64 of file textrenderer.hpp.

◆ SceneSerializer

friend class SceneSerializer
friend

Definition at line 63 of file textrenderer.hpp.

Member Data Documentation

◆ m_Fixed

bool TextRenderer::m_Fixed

Definition at line 98 of file textrenderer.hpp.

◆ m_FontPath

std::string TextRenderer::m_FontPath

Definition at line 96 of file textrenderer.hpp.

◆ m_GlyphSize

float TextRenderer::m_GlyphSize

Definition at line 97 of file textrenderer.hpp.

◆ m_ID

uint32_t TextRenderer::m_ID

Definition at line 95 of file textrenderer.hpp.


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