mirror of
https://github.com/DarkStore-3DS/Universal-Core.git
synced 2026-07-02 16:59:05 +00:00
Add separate function to load a system font
The other fonts are smaller, so when printing they're multiplied to be about the same as the standard
This commit is contained in:
@@ -42,6 +42,7 @@ bool currentScreen = false;
|
||||
bool fadeout = false, fadein = false, fadeout2 = false, fadein2 = false;
|
||||
int fadealpha = 0;
|
||||
int fadecolor = 0;
|
||||
CFG_Region loadedSystemFont = (CFG_Region)-1;
|
||||
|
||||
/*
|
||||
Clear the Text Buffer.
|
||||
@@ -73,6 +74,8 @@ void Gui::DrawSprite(C2D_SpriteSheet sheet, size_t imgindex, int x, int y, float
|
||||
|
||||
Contains initializing Citro2D, Citro3D and the screen targets.
|
||||
Call this when initing the app.
|
||||
|
||||
fontRegion: The region to use for the system font.
|
||||
*/
|
||||
Result Gui::init(CFG_Region fontRegion) {
|
||||
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
|
||||
@@ -86,10 +89,22 @@ Result Gui::init(CFG_Region fontRegion) {
|
||||
|
||||
/* Load Textbuffer. */
|
||||
TextBuf = C2D_TextBufNew(4096);
|
||||
Font = C2D_FontLoadSystem(fontRegion); // Load System font.
|
||||
loadSystemFont(fontRegion);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Load a system font.
|
||||
|
||||
fontRegion: The region to use for the system font.
|
||||
*/
|
||||
void Gui::loadSystemFont(CFG_Region fontRegion) {
|
||||
if(loadedSystemFont != fontRegion) {
|
||||
Font = C2D_FontLoadSystem(fontRegion);
|
||||
loadedSystemFont = fontRegion;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Load a bcfnt font.
|
||||
|
||||
@@ -151,6 +166,8 @@ void Gui::exit(void) {
|
||||
|
||||
/*
|
||||
Reinitialize the GUI.
|
||||
|
||||
fontRegion: The region to use for the system font.
|
||||
*/
|
||||
Result Gui::reinit(CFG_Region fontRegion) {
|
||||
C2D_TextBufDelete(TextBuf);
|
||||
@@ -198,6 +215,22 @@ void Gui::DrawString(float x, float y, float size, u32 color, std::string Text,
|
||||
|
||||
C2D_TextOptimize(&c2d_text);
|
||||
|
||||
if(!fnt) {
|
||||
switch(loadedSystemFont) {
|
||||
case CFG_REGION_CHN:
|
||||
size *= 1.13f;
|
||||
break;
|
||||
case CFG_REGION_TWN:
|
||||
size *= 1.5f;
|
||||
break;
|
||||
case CFG_REGION_KOR:
|
||||
size *= 1.1f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float heightScale;
|
||||
|
||||
if (maxHeight == 0) {
|
||||
|
||||
Reference in New Issue
Block a user