|
coastline 0.0.4
|
The two fonts of the menus, their gradients, and the layout of their glyphs. More...
#include <menutext.h>
Public Member Functions | |
| ~MenuText () | |
| Release font textures before the renderer's GPU device is destroyed. | |
| MenuText (const MenuText &)=delete | |
| Prevent copying GPU-backed font resources. | |
| MenuText & | operator= (const MenuText &)=delete |
| Prevent assignment of GPU-backed font resources. | |
| void | Draw (SceneRenderer &renderer, std::string_view text, int x, int y, const TextStyle &style, const Matrix4 &projection) const |
| Draw a string as DrawText() of the console draws it on a frame of high resolution. | |
| int | Width (std::string_view text, int size, bool doubled=true) const |
Static Public Member Functions | |
| static std::unique_ptr< MenuText > | Load (SceneRenderer &renderer, const std::filesystem::path &fonts) |
| Read the fonts of a release. | |
The two fonts of the menus, their gradients, and the layout of their glyphs.
| coastline::MenuText::~MenuText | ( | ) |
Release font textures before the renderer's GPU device is destroyed.
|
delete |
Prevent copying GPU-backed font resources.
|
static |
Read the fonts of a release.
| renderer | The renderer that draws the text. |
| fonts | The fonts directory of the import, with fonts.json. |
Prevent assignment of GPU-backed font resources.
| void coastline::MenuText::Draw | ( | SceneRenderer & | renderer, |
| std::string_view | text, | ||
| int | x, | ||
| int | y, | ||
| const TextStyle & | style, | ||
| const Matrix4 & | projection ) const |
Draw a string as DrawText() of the console draws it on a frame of high resolution.
| renderer | The renderer of the frame. |
| text | The string in UTF-8, with the colour codes of the console. A character without a glyph is not drawn. Each line after a newline is drawn as a string of its own, at TextStyle::lineGaps or TextStyle::lineHeight below the line before. |
| x | The left, centre, or right of each line, in pixels of the 320 by 240 screen. |
| y | The baseline of the first line, in pixels of the 320 by 240 screen. |
| style | How the string is drawn. |
| projection | The matrix from the 640 by 480 screen to the frame. |
| int coastline::MenuText::Width | ( | std::string_view | text, |
| int | size, | ||
| bool | doubled = true ) const |
| text | The string in UTF-8. |
| size | The height of the text, in pixels of the 320 by 240 screen. |
| doubled | Whether the size is of the 320 by 240 screen a frame of high resolution doubles, or of the 640 by 480 screen as it is. |