mirror of
https://github.com/risingPhil/PokeMe64.git
synced 2026-03-21 18:04:15 -05:00
It doesn't look like much, but it's functional ;-) It can inject distribution pokémon into gen 1 and gen 2 original cartridges and inject the GS ball in Pokémon Crystal. That's it. But that was the minimal feature set I had in mind for the project. In the Readme.md you can find the ideas I have for expanding the project. But the first priority is the UI, because it really looks bad right now. (as I was mostly focused on building blocks and transfer pak functionality. Not on making it looks good)
36 lines
900 B
C++
Executable File
36 lines
900 B
C++
Executable File
#include "core/FontManager.h"
|
|
|
|
FontManager::FontManager()
|
|
: fontMap_()
|
|
, nextFontId_(1)
|
|
{
|
|
}
|
|
|
|
uint8_t FontManager::getFont(const char* fontUri)
|
|
{
|
|
auto it = fontMap_.find(std::string(fontUri));
|
|
if(it == fontMap_.end())
|
|
{
|
|
FontEntry entry = {
|
|
.font = rdpq_font_load(fontUri),
|
|
.fontId = nextFontId_
|
|
};
|
|
fontMap_.emplace(fontUri, entry);
|
|
|
|
rdpq_text_register_font(entry.fontId, entry.font);
|
|
return entry.fontId;
|
|
}
|
|
return it->second.fontId;
|
|
}
|
|
|
|
void FontManager::registerFontStyle(uint8_t fontId, uint8_t fontStyleId, const rdpq_fontstyle_t& fontStyle)
|
|
{
|
|
for(auto it = fontMap_.begin(); it != fontMap_.end(); ++it)
|
|
{
|
|
if(it->second.fontId == fontId)
|
|
{
|
|
rdpq_font_style(it->second.font, fontStyleId, &fontStyle);
|
|
return;
|
|
}
|
|
}
|
|
} |