2D_Game_Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
FontManager Class Reference

#include <fontmanager.hpp>

Public Member Functions

 FontManager ()=default
 
 ~FontManager ()=default
 
std::pair< uint32_t, std::shared_ptr< TextRenderer > > GetFont (const std::string &path, int glyph_size, bool fixed)
 
std::shared_ptr< TextRendererGetFont (uint32_t id)
 
void ReleaseFont (uint32_t font_id)
 
std::pair< uint32_t, std::shared_ptr< TextRenderer > > UpdateFont (uint32_t font_id, const std::string &path, int glyph_size, bool fixed)
 
std::unordered_map< uint32_t, struct FontInfo > & GetFonts ()
 

Detailed Description

Definition at line 13 of file fontmanager.hpp.

Constructor & Destructor Documentation

◆ FontManager()

FontManager::FontManager ( )
default

◆ ~FontManager()

FontManager::~FontManager ( )
default

Member Function Documentation

◆ GetFont() [1/2]

std::pair< uint32_t, std::shared_ptr< TextRenderer > > FontManager::GetFont ( const std::string & path,
int glyph_size,
bool fixed )

Returns a font from the parameters given. If the font is already loaded, it will return the font and increase the number of copies, otherwise it will load the font and return it.

Returns
A pair with the font id and the font itself.

Definition at line 4 of file fontmanager.cpp.

◆ GetFont() [2/2]

std::shared_ptr< TextRenderer > FontManager::GetFont ( uint32_t id)

Returns a font from the id given.

Returns
the font

Definition at line 21 of file fontmanager.cpp.

◆ GetFonts()

std::unordered_map< uint32_t, struct FontInfo > & FontManager::GetFonts ( )
inline

Definition at line 41 of file fontmanager.hpp.

◆ ReleaseFont()

void FontManager::ReleaseFont ( uint32_t font_id)

Decreases the number of copies of the font with the id given. If the number of copies reaches 0, the font will be deleted.

Definition at line 30 of file fontmanager.cpp.

◆ UpdateFont()

std::pair< uint32_t, std::shared_ptr< TextRenderer > > FontManager::UpdateFont ( uint32_t font_id,
const std::string & path,
int glyph_size,
bool fixed )

Updates the font with the id given with the new parameters.

Definition at line 40 of file fontmanager.cpp.


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