#include <WText.hpp>
|
| WTextComponent (class Wasabi *app) |
|
void | AddFontDirectory (std::string dir) |
|
WError | Initialize () |
|
WError | CreateTextFont (uint32_t ID, std::string fontName) |
|
WError | DestroyFont (uint32_t ID) |
|
WError | SetTextColor (WColor col) |
|
WError | SetFont (uint32_t ID) |
|
WError | RenderText (std::string text, float x, float y, float fHeight) |
|
WError | RenderText (std::string text, float x, float y, float fHeight, uint32_t fontID) |
|
WError | RenderText (std::string text, float x, float y, float fHeight, uint32_t fontID, WColor col) |
|
void | Render (class WRenderTarget *rt) |
|
float | GetTextWidth (std::string text, float fHeight, uint32_t fontID=0) |
|
A WTextComponent provides an interface to allow text rendering.
◆ AddFontDirectory()
void WTextComponent::AddFontDirectory |
( |
std::string |
dir | ) |
|
Adds a directory from which fonts can be loaded.
- Parameters
-
dir | New directory to load fonts from |
◆ CreateTextFont()
WError WTextComponent::CreateTextFont |
( |
uint32_t |
ID, |
|
|
std::string |
fontName |
|
) |
| |
Creates a new font.
- Parameters
-
ID | ID to assign the font to. The ID must be unique |
fontName | Filename of the font (.ttf file), which can be relative to any of the added font directories (see AddFontDirectory()) |
- Returns
- Error code, see WError.h
◆ DestroyFont()
WError WTextComponent::DestroyFont |
( |
uint32_t |
ID | ) |
|
Destroys a font.
- Parameters
-
ID | ID of the font to destroy |
- Returns
- Error code, see WError.h
◆ GetTextWidth()
float WTextComponent::GetTextWidth |
( |
std::string |
text, |
|
|
float |
fHeight, |
|
|
uint32_t |
fontID = 0 |
|
) |
| |
Retrieves the width that would be occupied by a text if it was to render.
- Parameters
-
text | Text to check its width |
fHeight | Height that will be used for the render call |
fontID | Font that will be used for the render call, -1 for default |
- Returns
- Width, in pixels, of the text if it was to render using the specified parameters
◆ Initialize()
WError WTextComponent::Initialize |
( |
| ) |
|
Initializes the text component and all its resources.
- Returns
- Error code, see WError.h
◆ Render()
Renders all text onto the render target.
- Parameters
-
rt | Render target to render to |
◆ RenderText() [1/3]
WError WTextComponent::RenderText |
( |
std::string |
text, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
fHeight |
|
) |
| |
Adds text to be rendered on the next frame.
- Parameters
-
text | Text to render |
x | X-coordinate to render at |
y | Y-coordinate to render at |
fHeight | Height of a text character |
- Returns
- Error code, see WError.h
◆ RenderText() [2/3]
WError WTextComponent::RenderText |
( |
std::string |
text, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
fHeight, |
|
|
uint32_t |
fontID |
|
) |
| |
Adds text to be rendered on the next frame.
- Parameters
-
text | Text to render |
x | X-coordinate to render at |
y | Y-coordinate to render at |
fHeight | Height of a text character |
fontID | ID of the font to use |
- Returns
- Error code, see WError.h
◆ RenderText() [3/3]
WError WTextComponent::RenderText |
( |
std::string |
text, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
fHeight, |
|
|
uint32_t |
fontID, |
|
|
WColor |
col |
|
) |
| |
Adds text to be rendered on the next frame.
- Parameters
-
text | Text to render |
x | X-coordinate to render at |
y | Y-coordinate to render at |
fHeight | Height of a text character |
fontID | ID of the font to use |
col | Color to use for rendering |
- Returns
- Error code, see WError.h
◆ SetFont()
WError WTextComponent::SetFont |
( |
uint32_t |
ID | ) |
|
Sets the default font ID for the following text renders (if not specified in the render call).
- Parameters
-
ID | ID of the font to set default |
- Returns
- Error code, see WError.h
◆ SetTextColor()
Sets the default color for the following text renders (if not specified in the render call).
- Parameters
-
- Returns
- Error code, see WError.h
◆ m_app
class Wasabi* WTextComponent::m_app |
|
protected |
◆ m_curColor
WColor WTextComponent::m_curColor |
|
protected |
◆ m_curFont
uint32_t WTextComponent::m_curFont |
|
protected |
Current (default) font ID
◆ m_directories
std::vector<std::string> WTextComponent::m_directories |
|
protected |
List of directories in which fonts could be found
◆ m_fonts
A hashtable for the fonts, mapping ID -> font
◆ m_textEffect
class WEffect* WTextComponent::m_textEffect |
|
protected |
Effect to use for rendering texts
The documentation for this class was generated from the following file: