Brenta Engine 1.1
Loading...
Searching...
No Matches
brenta::text Class Reference

Text subsystem. More...

#include <text.hpp>

Static Public Member Functions

static void init ()
 Initialize the text subsystem.
 
static void load (std::string font_name, unsigned int font_size)
 Load a font.
 
static void render_text (std::string text, float x, float y, float scale, glm::vec3 color)
 Render text.
 

Static Public Attributes

static std::map< char, types::charactercharacters
 Map of characters.
 

Detailed Description

Text subsystem.

This class is used to render text on the screen. The text is rendered using the FreeType library to load the font and the characters, and OpenGL to render the text on the screen.

Definition at line 70 of file text.hpp.

Member Function Documentation

◆ init()

void text::init ( )
static

Initialize the text subsystem.

This method initializes the text subsystem by loading the shader, the VAO, and the VBO. The shader is loaded from the file text.vs and text.fs, and the VAO and VBO are created using the data from the characters map.

Note: opengl context must be created before calling this method.

Definition at line 41 of file text.cpp.

◆ load()

void text::load ( std::string font_name,
unsigned int font_size )
static

Load a font.

This method loads a font from the given file and size. The font is loaded using the FreeType library, and the characters are stored in the characters map.

Parameters
font_nameName of the font file
font_sizeSize of the font

Definition at line 49 of file text.cpp.

◆ render_text()

void text::render_text ( std::string text,
float x,
float y,
float scale,
glm::vec3 color )
static

Render text.

This method renders the given text on the screen at the given position, with the given scale and color. The text is rendered using the shader, VAO, and VBO that are initialized in the Init method.

Parameters
textText to render
xX position of the text
yY position of the text
scaleScale of the text
colorColor of the text

Definition at line 137 of file text.cpp.

Field Documentation

◆ characters

std::map< char, types::character > text::characters
static

Map of characters.

Map an ascii character to a Character struct

Definition at line 78 of file text.hpp.


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