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)
49 lines
1.4 KiB
C++
Executable File
49 lines
1.4 KiB
C++
Executable File
#ifndef _FONTMANAGER_H
|
|
#define _FONTMANAGER_H
|
|
|
|
#include <libdragon.h>
|
|
#include <unordered_map>
|
|
#include <string>
|
|
|
|
typedef struct FontEntry
|
|
{
|
|
rdpq_font_t* font;
|
|
uint8_t fontId;
|
|
} FontEntry;
|
|
|
|
typedef std::unordered_map<std::string, FontEntry> RDPQFontMap;
|
|
|
|
/**
|
|
* @brief This class exists because libdragon does not offer a way to unload a font or otherwise load a font
|
|
* more than once.
|
|
* .
|
|
* Therefore if you want to load the font again in a different scene, you hit an assert.
|
|
*
|
|
* FontManager prevents this by handling the loading transparently and returning already loaded font handles
|
|
* if the desired font was already loaded before.
|
|
*
|
|
*/
|
|
class FontManager
|
|
{
|
|
public:
|
|
FontManager();
|
|
|
|
/**
|
|
* Retrieve a fontId for the font at the given URI
|
|
*/
|
|
uint8_t getFont(const char* fontUri);
|
|
|
|
/**
|
|
* This function registers the given fontStyle onto the given font and associate it with the specified fontStyleId
|
|
* Note: there's no unregisterFontStyle because libdragon doesn't offer the functionality.
|
|
*
|
|
* That being said, replacing the fontStyleId is possible without it throwing an assert() in our face
|
|
*/
|
|
void registerFontStyle(uint8_t fontId, uint8_t fontStyleId, const rdpq_fontstyle_t& fontStyle);
|
|
protected:
|
|
private:
|
|
RDPQFontMap fontMap_;
|
|
uint8_t nextFontId_;
|
|
};
|
|
|
|
#endif |