|
Brenta Engine 1.2
|
Text subsystem. More...
#include <text.hpp>
Data Structures | |
| class | builder |
| struct | config |
Public Member Functions | |
| std::expected< void, subsystem::error > | initialize () override |
| Initialize the text subsystem. | |
| std::expected< void, subsystem::error > | terminate () override |
| Cleaup resources. | |
| std::string | name () override |
| Returns the name of the sybsystem. | |
| bool | is_initialized () override |
| Returns true if the subsystem is initialized. | |
Public Member Functions inherited from brenta::subsystem | |
Static Public Member Functions | |
| static text & | instance () |
| static void | load (std::string font_name, int font_size=48) |
| 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::character > | characters |
| Map of characters. | |
| static const std::string | subsystem_name = "text" |
| static const text::config | default_config |
| static text::config | init_config = default_config |
Additional Inherited Members | |
Public Types inherited from brenta::subsystem | |
| using | error = std::string |
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.
|
overridevirtual |
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.
Implements brenta::subsystem.
|
overridevirtual |
Returns true if the subsystem is initialized.
Implements brenta::subsystem.
|
static |
|
overridevirtual |
Returns the name of the sybsystem.
Implements brenta::subsystem.
|
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.
| text | Text to render |
| x | X position of the text |
| y | Y position of the text |
| scale | Scale of the text |
| color | Color of the text |
|
overridevirtual |
|
static |
|
static |
|
static |