mirror of
https://github.com/DarkStore-3DS/Universal-Core.git
synced 2026-07-06 16:59:08 +00:00
Don't hardcode Universal-Updater's font paths
This commit is contained in:
+6
-6
@@ -88,25 +88,25 @@ namespace Gui {
|
|||||||
Initialize the GUI.
|
Initialize the GUI.
|
||||||
Call this when initializing.
|
Call this when initializing.
|
||||||
|
|
||||||
FontPath: The font to use.
|
FontPaths: The locations to check for the font.
|
||||||
*/
|
*/
|
||||||
bool init(const char *FontPath = nullptr);
|
bool init(const std::vector<std::string> &FontPaths);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Load a Font. (NFTR)
|
Load a Font. (NFTR)
|
||||||
|
|
||||||
fnt: The Font variable which should be initialized.
|
fnt: The Font variable which should be initialized.
|
||||||
Path: Path to the NFTR file.
|
Paths: The locations to check for the NFTR file.
|
||||||
if you're unsure, just call 'Gui::init();' and it will load the default font.
|
if you're unsure, just call 'Gui::init();' and it will load the default font.
|
||||||
*/
|
*/
|
||||||
bool loadFont(Font &fnt, const char *Path = nullptr);
|
bool loadFont(Font &fnt, const std::vector<std::string> &Paths);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Reinit the GUI.
|
Reinit the GUI.
|
||||||
|
|
||||||
FontPath: The font to use.
|
FontPaths: The locations to check for the font.
|
||||||
*/
|
*/
|
||||||
bool reinit(const char *FontPath = nullptr);
|
bool reinit(const std::vector<std::string> &FontPaths);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Draws a centered String.
|
Draws a centered String.
|
||||||
|
|||||||
+6
-7
@@ -44,7 +44,7 @@ int fadecolor = 0;
|
|||||||
bool widescreen = false;
|
bool widescreen = false;
|
||||||
int selectorTimer = 0;
|
int selectorTimer = 0;
|
||||||
|
|
||||||
bool Gui::init(const char *FontPath) {
|
bool Gui::init(const std::vector<std::string> &FontPaths) {
|
||||||
// Initialize video mode
|
// Initialize video mode
|
||||||
videoSetMode(MODE_5_2D);
|
videoSetMode(MODE_5_2D);
|
||||||
videoSetModeSub(MODE_5_2D);
|
videoSetModeSub(MODE_5_2D);
|
||||||
@@ -74,7 +74,7 @@ bool Gui::init(const char *FontPath) {
|
|||||||
REG_BLDCNT_SUB = 1 << 11;
|
REG_BLDCNT_SUB = 1 << 11;
|
||||||
|
|
||||||
// Load the default font
|
// Load the default font
|
||||||
DefaultFont = std::make_unique<Font>(std::vector<std::string>({"sd:/_nds/Universal-Updater/font.nftr", "fat:/_nds/Universal-Updater/font.nftr", "nitro:/graphics/font/default.nftr"}));
|
DefaultFont = std::make_unique<Font>(FontPaths);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -91,9 +91,8 @@ void Gui::DrawSprite(Spritesheet &sheet, size_t imgindex, int x, int y, float Sc
|
|||||||
sheet[imgindex].draw(x, y, 0x20, ScaleX, ScaleY);
|
sheet[imgindex].draw(x, y, 0x20, ScaleX, ScaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gui::loadFont(Font &fnt, const char *Path) {
|
bool Gui::loadFont(Font &fnt, const std::vector<std::string> &Paths) {
|
||||||
if(Path && access(Path, F_OK) == 0) // Only load if found.
|
fnt = Font(Paths);
|
||||||
fnt = Font(Path);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -105,8 +104,8 @@ bool Gui::loadSheet(const char *Path, Spritesheet &sheet) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gui::reinit(const char *FontPath) {
|
bool Gui::reinit(const std::vector<std::string> &FontPaths) {
|
||||||
return Gui::init(FontPath);
|
return Gui::init(FontPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::DrawStringCentered(int x, int y, float size, u8 color, const std::string &Text, int maxWidth, int maxHeight, Font *fnt, int flags) {
|
void Gui::DrawStringCentered(int x, int y, float size, u8 color, const std::string &Text, int maxWidth, int maxHeight, Font *fnt, int flags) {
|
||||||
|
|||||||
Reference in New Issue
Block a user