Represents a Font, a texture with monospace characters to be used to draw text onscreen.
More...
#include <RenderingSystem.hpp>
|
| Font (Texture *t, vec2dw CharacterSize, vec2b PaddingSize) |
| Constructs a font. More...
|
|
| ~Font () |
| Disposes font accordingly. More...
|
|
vec2dw | GetCharacterSize () const |
| Gets the size of a single character. More...
|
|
vec2b | GetPaddingSize () const |
| Gets the size of the padding around a single character. More...
|
|
void | DrawString (vec2 Position, std::string Text, float magnification, Color4 tint, float transparency) |
| Draws a specific string in a region. More...
|
|
void | DrawString (vec2 Position, std::string Text, float magnification) |
| Draws a specific string in a region. More...
|
|
void | DrawString (vec2 Position, std::string Text) |
| Draws a specific string in a region. More...
|
|
vec2 | MeasureString (std::string Text, float magnification) const |
| Calculates the total area consumed by the text on screen. More...
|
|
Represents a Font, a texture with monospace characters to be used to draw text onscreen.
- Warning
- The characters font range must be 31 ~ 126 in ASCII table.
◆ Font()
OficinaFramework::RenderingSystem::Font::Font |
( |
Texture * |
t, |
|
|
vec2dw |
CharacterSize, |
|
|
vec2b |
PaddingSize |
|
) |
| |
Constructs a font.
- Parameters
-
t | Texture to be used as source for characters. |
- Warning
- The texture must contain monospace ASCII characters ranging from 31 (before white space) to '~'.
-
DO NOT dispose the texture by yourself. The system will take care of it, once you delete the font pointer.
- Parameters
-
CharacterSize | Size occupied by each character on the texture. |
PaddingSize | Thickness of the padding around each character of the atlas. x specifies left and right boundaries, y specifies up and down boundaries. |
◆ ~Font()
OficinaFramework::RenderingSystem::Font::~Font |
( |
| ) |
|
Disposes font accordingly.
◆ DrawString() [1/3]
void OficinaFramework::RenderingSystem::Font::DrawString |
( |
vec2 |
Position, |
|
|
std::string |
Text, |
|
|
float |
magnification, |
|
|
Color4 |
tint, |
|
|
float |
transparency |
|
) |
| |
Draws a specific string in a region.
- Warning
- The text included must be ASCII characters ranging from 31~126.
- Parameters
-
Position | Position on screen in which the text will be drawn. |
Text | Text that must be rendered. Only ASCII text is valid. |
magnification | Size for the text to be multiplied by. Defaults to 1. |
tint | Color to tint the font. Defaults to White (1.0f, 1.0f, 1.0f, 1.0f). The alpha factor will be used to measure intensity of tinting. |
transparency | Transparency of the text. 1 is opaque, 0 is completely transparent. |
◆ DrawString() [2/3]
void OficinaFramework::RenderingSystem::Font::DrawString |
( |
vec2 |
Position, |
|
|
std::string |
Text, |
|
|
float |
magnification |
|
) |
| |
Draws a specific string in a region.
- Warning
- The text included must be ASCII characters ranging from 31~126.
- Parameters
-
Position | Position on screen in which the text will be drawn. |
Text | Text that must be rendered. Only ASCII text is valid. |
magnification | Size for the text to be multiplied by. Defaults to 1. |
◆ DrawString() [3/3]
void OficinaFramework::RenderingSystem::Font::DrawString |
( |
vec2 |
Position, |
|
|
std::string |
Text |
|
) |
| |
Draws a specific string in a region.
- Warning
- The text included must be ASCII characters ranging from 31~126.
- Parameters
-
Position | Position on screen in which the text will be drawn. |
Text | Text that must be rendered. Only ASCII text is valid. |
◆ GetCharacterSize()
vec2dw OficinaFramework::RenderingSystem::Font::GetCharacterSize |
( |
| ) |
const |
Gets the size of a single character.
- Returns
- A vec2 with dword precision showing the size of a character.
◆ GetPaddingSize()
vec2b OficinaFramework::RenderingSystem::Font::GetPaddingSize |
( |
| ) |
const |
Gets the size of the padding around a single character.
- Returns
- A vec2 with byte precision showing the thickness of the padding border.
◆ MeasureString()
vec2 OficinaFramework::RenderingSystem::Font::MeasureString |
( |
std::string |
Text, |
|
|
float |
magnification |
|
) |
| const |
Calculates the total area consumed by the text on screen.
- Parameters
-
Text | Rendered text to have its space calculated. |
magnification | Size for the text to be multiplied by. Defaults to 1. |
- Returns
- A vec2, with float precision, showing the total occupied size by the string.
The documentation for this class was generated from the following file: