|
libmx2 2.2.1
C++20 multimedia and game-engine library (SDL2 / OpenGL / Vulkan)
|
Glyph cache that maps each ASCII character to a pre-rendered SDL_Surface. More...
#include <console.hpp>
Public Member Functions | |
| ConsoleChars () | |
| ~ConsoleChars () | |
| ConsoleChars (const ConsoleChars &)=delete | |
| ConsoleChars & | operator= (const ConsoleChars &)=delete |
| ConsoleChars (ConsoleChars &&)=delete | |
| ConsoleChars & | operator= (ConsoleChars &&)=delete |
| void | load (const std::string &fnt, int size, const SDL_Color &c) |
| Load/reload the glyph cache from a font file. | |
| void | clear () |
| Release all cached SDL_Surface objects. | |
Public Attributes | |
| std::unordered_map< char, SDL_Surface * > | characters |
| Glyph surfaces keyed by char. | |
Protected Attributes | |
| std::unique_ptr< mx::Font > | font |
Glyph cache that maps each ASCII character to a pre-rendered SDL_Surface.
Surfaces are produced via SDL_ttf and stored in an unordered_map keyed by char. Recreate by calling load() after font changes.
Definition at line 111 of file console.hpp.
| console::ConsoleChars::ConsoleChars | ( | ) |
Definition at line 30 of file console.cpp.
References font.
Referenced by ConsoleChars(), ConsoleChars(), operator=(), and operator=().
| console::ConsoleChars::~ConsoleChars | ( | ) |
Definition at line 37 of file console.cpp.
References clear().
|
delete |
References ConsoleChars().
|
delete |
References ConsoleChars().
| void console::ConsoleChars::clear | ( | ) |
Release all cached SDL_Surface objects.
Definition at line 57 of file console.cpp.
References characters, and font.
Referenced by load(), and ~ConsoleChars().
| void console::ConsoleChars::load | ( | const std::string & | fnt, |
| int | size, | ||
| const SDL_Color & | c ) |
Load/reload the glyph cache from a font file.
| fnt | Path to a TTF font file. |
| size | Point size. |
| c | Colour applied to each glyph surface. |
Definition at line 41 of file console.cpp.
References characters, clear(), and font.
|
delete |
References ConsoleChars().
|
delete |
References ConsoleChars().
| std::unordered_map<char, SDL_Surface *> console::ConsoleChars::characters |
Glyph surfaces keyed by char.
Definition at line 132 of file console.hpp.
|
protected |
Definition at line 134 of file console.hpp.
Referenced by clear(), ConsoleChars(), and load().