jubilant-funicular
|
Loads in a .ttf file, creates a font texture from it which is then used to render text. More...
#include <SpriteFont.h>
Public Member Functions | |
~SpriteFont () | |
destructor | |
glm::vec2 | measure (crstring text) const |
returns the dimensions of the rectangle containing the text | |
int | font_height () const |
returns m_fontHeight | |
GLuint | getTexture () const |
Returns the (id of) the texture used for rendering font. | |
void | drawText (SpriteBatch &batch, crstring text, crvec2 topLeft, crvec2 scale, crvec4 color=glm::vec4(1), float depth=NTA_DEFAULT_DEPTH) const |
renders text with specified location, color, scale, etc. | |
void | drawText (SpriteBatch &batch, crstring text, crvec4 posRect, crvec4 color=glm::vec4(1), float depth=NTA_DEFAULT_DEPTH) const |
void | drawText (SpriteBatch &batch, crvec2 corner1, crvec2 corner2, crstring text, crvec4 color=glm::vec4(1), float depth=NTA_DEFAULT_DEPTH) const |
void | drawTexture (SpriteBatch &batch, crvec4 posRect=glm::vec4(-100, 100, 200, 200)) const |
renders texture | |
void | destroy () |
Destroys this SpriteFont. | |
Public Attributes | |
friend | ContextData |
Private Member Functions | |
void | init (TTF_Font *font) |
Private Attributes | |
CharGlyph * | m_charGlyphs = nullptr |
a collection of glyphs for each char | |
GLuint | m_texId = 0 |
the idea of the generated texture | |
int | m_fontHeight = 0 |
the height of the font | |
Loads in a .ttf file, creates a font texture from it which is then used to render text.
Definition at line 55 of file SpriteFont.h.
|
private |
Initializes the SpriteFont
Creates a texture from the font
Definition at line 5 of file SpriteFont.cpp.