Display hbmenu and hbloader version, side by side. Align "Applet Mode" text to the right.
This commit is contained in:
parent
6c84575ef7
commit
d9effc3143
@ -43,7 +43,7 @@ static bool FontSetType(u32 font)
|
|||||||
case interuimedium30:
|
case interuimedium30:
|
||||||
scale = 8;
|
scale = 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case largestar:
|
case largestar:
|
||||||
scale = 18;
|
scale = 18;
|
||||||
break;
|
break;
|
||||||
@ -313,8 +313,8 @@ void GetTextDimensions(u32 font, const char* text, uint32_t* width_out, uint32_t
|
|||||||
width = x;
|
width = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
*width_out = width;
|
if(width_out) *width_out = width;
|
||||||
*height_out = height;
|
if(height_out) *height_out = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fontInitialize(void)
|
bool fontInitialize(void)
|
||||||
@ -380,11 +380,11 @@ void fontExit()
|
|||||||
if (s_font_libret==0) FT_Done_FreeType(s_font_library);
|
if (s_font_libret==0) FT_Done_FreeType(s_font_library);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Automatically gives you the desired x-coordinate
|
/*Automatically gives you the desired x-coordinate
|
||||||
*based on the string length and desired alignment
|
*based on the string length and desired alignment
|
||||||
*rY=reference point... where to align around
|
*rY=reference point... where to align around
|
||||||
*align='t','b','c' translates to (top,bottom,center)
|
*align='t','b','c' translates to (top,bottom,center)
|
||||||
*'t' aligned, top of text aligns with rY,
|
*'t' aligned, top of text aligns with rY,
|
||||||
*you get the rest....
|
*you get the rest....
|
||||||
*/
|
*/
|
||||||
uint32_t GetTextYCoordinate(u32 font, uint32_t rY, const char* text, const char align) {
|
uint32_t GetTextYCoordinate(u32 font, uint32_t rY, const char* text, const char align) {
|
||||||
@ -405,7 +405,7 @@ uint32_t GetTextYCoordinate(u32 font, uint32_t rY, const char* text, const char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Automatically gives you the desired x-coordinate
|
/*Automatically gives you the desired x-coordinate
|
||||||
*based on the string length and desired alignment
|
*based on the string length and desired alignment
|
||||||
*rX=reference point... where to align around
|
*rX=reference point... where to align around
|
||||||
*text=string you want to display
|
*text=string you want to display
|
||||||
|
@ -496,7 +496,7 @@ void drawNetwork(int tmpX) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawStatus() {
|
u32 drawStatus() {
|
||||||
|
|
||||||
char timeString[9];
|
char timeString[9];
|
||||||
|
|
||||||
@ -509,12 +509,14 @@ void drawStatus() {
|
|||||||
|
|
||||||
sprintf(timeString, "%02d:%02d:%02d", hours, minutes, seconds);
|
sprintf(timeString, "%02d:%02d:%02d", hours, minutes, seconds);
|
||||||
|
|
||||||
int tmpX = GetTextXCoordinate(interuimedium20, 1180, timeString, 'r');
|
u32 tmpX = GetTextXCoordinate(interuimedium20, 1180, timeString, 'r');
|
||||||
|
|
||||||
DrawText(interuimedium20, tmpX, 0 + 47 + 10, themeCurrent.textColor, timeString);
|
DrawText(interuimedium20, tmpX, 0 + 47 + 10, themeCurrent.textColor, timeString);
|
||||||
|
|
||||||
drawCharge();
|
drawCharge();
|
||||||
drawNetwork(tmpX);
|
drawNetwork(tmpX);
|
||||||
|
|
||||||
|
return tmpX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawButtons(menu_s* menu, bool emptyDir, int *x_image_out) {
|
void drawButtons(menu_s* menu, bool emptyDir, int *x_image_out) {
|
||||||
@ -603,11 +605,28 @@ void menuLoop(void) {
|
|||||||
menuTimer += 0.05;
|
menuTimer += 0.05;
|
||||||
|
|
||||||
drawImage(40, 20, 140, 60, themeCurrent.hbmenuLogoImage, IMAGE_MODE_RGBA32);
|
drawImage(40, 20, 140, 60, themeCurrent.hbmenuLogoImage, IMAGE_MODE_RGBA32);
|
||||||
DrawText(interuiregular14, 180, 46 + 18, themeCurrent.textColor, VERSION);
|
DrawText(interuiregular14, 184, 46 + 18, themeCurrent.textColor, VERSION);
|
||||||
|
u32 statusXPos = drawStatus();
|
||||||
|
|
||||||
#ifdef __SWITCH__
|
#ifdef __SWITCH__
|
||||||
AppletType at = appletGetAppletType();
|
AppletType at = appletGetAppletType();
|
||||||
if (at != AppletType_Application && at != AppletType_SystemApplication) {
|
if (at != AppletType_Application && at != AppletType_SystemApplication) {
|
||||||
DrawText(interuimedium30, 640-32, 46 + 18, themeCurrent.attentionTextColor, textGetString(StrId_AppletMode));
|
const char* appletMode = textGetString(StrId_AppletMode);
|
||||||
|
u32 x_pos = GetTextXCoordinate(interuimedium30, statusXPos, appletMode, 'r');
|
||||||
|
DrawText(interuimedium30, x_pos - 32, 46 + 18, themeCurrent.attentionTextColor, appletMode);
|
||||||
|
}
|
||||||
|
const char* loaderInfo = envGetLoaderInfo();
|
||||||
|
if (loaderInfo) {
|
||||||
|
u32 x_pos = 43;
|
||||||
|
char* spacePos = strchr(loaderInfo, ' ');
|
||||||
|
if (spacePos) {
|
||||||
|
char tempbuf[64] = {0};
|
||||||
|
size_t tempsize = spacePos - loaderInfo + 1;
|
||||||
|
if (tempsize > sizeof(tempbuf)-1) tempsize = sizeof(tempbuf)-1;
|
||||||
|
memcpy(tempbuf, loaderInfo, tempsize);
|
||||||
|
x_pos = GetTextXCoordinate(interuiregular14, 184, tempbuf, 'r');
|
||||||
|
}
|
||||||
|
DrawText(interuiregular14, x_pos, 46 + 18 + 20, themeCurrent.textColor, loaderInfo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -620,8 +639,6 @@ void menuLoop(void) {
|
|||||||
DrawText(interuiregular14, 180 + 256, 46 + 16 + 18, themeCurrent.textColor, tmpstr);
|
DrawText(interuiregular14, 180 + 256, 46 + 16 + 18, themeCurrent.textColor, tmpstr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
drawStatus();
|
|
||||||
|
|
||||||
memset(&netloader_state, 0, sizeof(netloader_state));
|
memset(&netloader_state, 0, sizeof(netloader_state));
|
||||||
netloaderGetState(&netloader_state);
|
netloaderGetState(&netloader_state);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user