#include <TextManager.hpp>
|
| void | init () override |
| void | process () override |
| void | shutdown () override |
| std::unique_ptr< Font > | loadFont (std::string *name, int size) |
| | Load a font from a file.
|
| void | loadDefaultPalette () |
| | Loads the predefined default palette.
|
| bool | loadPalette (std::string *paletteFilePath, bool sub=false) |
| | Load a palette from a file.
|
| void | unloadPalette () |
| | Unload the current palettes.
|
| std::uint8_t * | loadFontBitmap (std::string *path) |
| | Load the font bitmap from a file.
|
| bool | loadFontMetadata (std::string *path, Font *font, bool forBoldBitmap=false) |
| | Load the font metadata from a file.
|
| void | clearScreen (uint16_t *videoBuffer) |
| | Clear the text layer by filling the video buffer with black.
|
|
| | TextManager ()=default |
| int | extractIntValue (const std::string &line, const std::string &key) |
| | Extract an integer value from a line of text based on a specified key.
|
Definition at line 14 of file TextManager.hpp.
◆ TextManager()
| TextManager::TextManager |
( |
| ) |
|
|
privatedefault |
◆ clearScreen()
| void TextManager::clearScreen |
( |
uint16_t * | videoBuffer | ) |
|
Clear the text layer by filling the video buffer with black.
- Parameters
-
| videoBuffer | Pointer to the video buffer to clear. |
Definition at line 198 of file TextManager.cpp.
◆ extractIntValue()
| int TextManager::extractIntValue |
( |
const std::string & | line, |
|
|
const std::string & | key ) |
|
private |
Extract an integer value from a line of text based on a specified key.
- Parameters
-
| line | The line of text to extract the value from. |
| key | The key that preceedes the integer value in the line. |
- Returns
- The extracted integer value, or 0 if the key is not found.
- Note
- This function assumes that the line takes the form "key=value ".
Definition at line 208 of file TextManager.cpp.
◆ init()
| void TextManager::init |
( |
| ) |
|
|
inlineoverride |
◆ loadDefaultPalette()
| void TextManager::loadDefaultPalette |
( |
| ) |
|
◆ loadFont()
| std::unique_ptr< Font > TextManager::loadFont |
( |
std::string * | name, |
|
|
int | size ) |
Load a font from a file.
- Parameters
-
| name | Name of the font. |
| size | Size of the font. |
- Returns
- Owning pointer to the loaded font, or nullptr if loading failed.
- Note
- This function assumes that the font files are located in the "fonts" directory and follow the naming convention "<name>/size-<size>".
- Warning
- This function will halt the program if the regular font fails to load. If the bold font fails to load, it will simply set the boldLoaded flag to false and continue.
Definition at line 36 of file TextManager.cpp.
◆ loadFontBitmap()
| std::uint8_t * TextManager::loadFontBitmap |
( |
std::string * | path | ) |
|
Load the font bitmap from a file.
- Parameters
-
| path | The path to the font bitmap file. |
- Returns
- Pointer to the loaded font bitmap, or nullptr if loading failed.
Definition at line 115 of file TextManager.cpp.
◆ loadFontMetadata()
| bool TextManager::loadFontMetadata |
( |
std::string * | path, |
|
|
Font * | font, |
|
|
bool | forBoldBitmap = false ) |
Load the font metadata from a file.
- Parameters
-
| path | The path to the font metadata file. |
| font | Pointer to the font to populate with metadata. |
| forBoldBitmap | Whether the metadata being loaded is for the bold version of the font. |
- Returns
- true if loading was successful, false otherwise.
Definition at line 132 of file TextManager.cpp.
◆ loadPalette()
| bool TextManager::loadPalette |
( |
std::string * | paletteFilePath, |
|
|
bool | sub = false ) |
Load a palette from a file.
- Parameters
-
| paletteFilePath | The path to the palette file. |
| sub | Whether to load the palette for the sub screen. |
- Returns
- true if the palette was loaded successfully, false otherwise.
- Note
- This palette will apply for all text that is being drawn.
Definition at line 82 of file TextManager.cpp.
◆ process()
| void TextManager::process |
( |
| ) |
|
|
inlineoverride |
◆ shutdown()
| void TextManager::shutdown |
( |
| ) |
|
|
inlineoverride |
◆ unloadPalette()
| void TextManager::unloadPalette |
( |
| ) |
|
Unload the current palettes.
- Note
- This function unloads the palettes from both the main and sub screens.
Definition at line 109 of file TextManager.cpp.
◆ Singleton< TextManager >
◆ io
| IOManager& TextManager::io = IOManager::getInstance() |
|
private |
The documentation for this class was generated from the following files: