persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
TextManager Class Reference

#include <TextManager.hpp>

Inheritance diagram for TextManager:
Collaboration diagram for TextManager:

Public Member Functions

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.

Private Member Functions

 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.

Private Attributes

IOManager & io = IOManager::getInstance()

Friends

class Singleton< TextManager >

Detailed Description

Definition at line 14 of file TextManager.hpp.

Constructor & Destructor Documentation

◆ TextManager()

TextManager::TextManager ( )
privatedefault
Here is the caller graph for this function:

Member Function Documentation

◆ clearScreen()

void TextManager::clearScreen ( uint16_t * videoBuffer)

Clear the text layer by filling the video buffer with black.

Parameters
videoBufferPointer to the video buffer to clear.

Definition at line 198 of file TextManager.cpp.

Here is the call graph for this function:

◆ 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
lineThe line of text to extract the value from.
keyThe 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void TextManager::init ( )
inlineoverride

Definition at line 17 of file TextManager.hpp.

◆ loadDefaultPalette()

void TextManager::loadDefaultPalette ( )

Loads the predefined default palette.

Definition at line 76 of file TextManager.cpp.

◆ loadFont()

std::unique_ptr< Font > TextManager::loadFont ( std::string * name,
int size )

Load a font from a file.

Parameters
nameName of the font.
sizeSize 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.

Here is the call graph for this function:

◆ loadFontBitmap()

std::uint8_t * TextManager::loadFontBitmap ( std::string * path)

Load the font bitmap from a file.

Parameters
pathThe 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFontMetadata()

bool TextManager::loadFontMetadata ( std::string * path,
Font * font,
bool forBoldBitmap = false )

Load the font metadata from a file.

Parameters
pathThe path to the font metadata file.
fontPointer to the font to populate with metadata.
forBoldBitmapWhether 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadPalette()

bool TextManager::loadPalette ( std::string * paletteFilePath,
bool sub = false )

Load a palette from a file.

Parameters
paletteFilePathThe path to the palette file.
subWhether 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.

Here is the call graph for this function:

◆ process()

void TextManager::process ( )
inlineoverride

Definition at line 21 of file TextManager.hpp.

◆ shutdown()

void TextManager::shutdown ( )
inlineoverride

Definition at line 25 of file TextManager.hpp.

◆ 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 >

friend class Singleton< TextManager >
friend

Definition at line 79 of file TextManager.hpp.

Member Data Documentation

◆ io

IOManager& TextManager::io = IOManager::getInstance()
private

Definition at line 85 of file TextManager.hpp.


The documentation for this class was generated from the following files: