gui: Properly display minutes/hours (double digits) as well as some minor cleanups

This commit is contained in:
joel16 2021-02-08 01:15:37 -05:00
parent f07d89f1a1
commit c705877114
3 changed files with 6 additions and 5 deletions

View File

@ -43,6 +43,7 @@ GFXBUILD := $(ROMFS)/res/drawable
APP_TITLE := 3DShell
APP_DESCRIPTION := Multi-purpose file manager
APP_AUTHOR := Joel16
ICON := res/ic_launcher_filemanager.png
VERSION_MAJOR := 5
VERSION_MINOR := 0
VERSION_MICRO := 0

View File

@ -54,12 +54,12 @@ namespace GUI {
const std::time_t time = std::time(nullptr);
const std::tm calendar_time = *std::localtime(std::addressof(time));
std::string time_string = std::to_string((calendar_time.tm_hour % 12) == 0? 12 : (calendar_time.tm_hour % 12)) + ":" + std::to_string(calendar_time.tm_min);
time_string.append((calendar_time.tm_hour / 12)? "PM" : "AM");
static char time_string[30];
std::snprintf(time_string, 30, "%2i:%02i %s", (calendar_time.tm_hour % 12) == 0? 12 : (calendar_time.tm_hour % 12), calendar_time.tm_min, (calendar_time.tm_hour / 12)? "PM" : "AM");
float text_height = 0.f;
C2D::GetTextSize(0.45f, nullptr, &text_height, time_string.c_str());
C2D::Text(5, ((15 - text_height) / 2), 0.45f, WHITE, time_string.c_str());
C2D::GetTextSize(0.45f, nullptr, &text_height, time_string);
C2D::Text(5, ((15 - text_height) / 2), 0.45f, WHITE, time_string);
u8 level = 0;
PTMU_GetBatteryLevel(&level);

View File

@ -57,7 +57,7 @@ namespace GUI {
if ((!done) && (*connection_status) && (*available))
C2D::Text(248 - (confirm_width), (159 - confirm_height) - 3, 0.42f, cfg.dark_theme? TITLE_COLOUR_DARK : TITLE_COLOUR, "YES");
C2D::Text(288 - cancel_width, (159 - cancel_height) - 3, 0.42f, cfg.dark_theme? TITLE_COLOUR_DARK : TITLE_COLOUR, ((!*connection_status) || (done))? "OK" : "NO");
C2D::Text(288 - cancel_width, (159 - cancel_height) - 3, 0.42f, cfg.dark_theme? TITLE_COLOUR_DARK : TITLE_COLOUR, ((!*connection_status) || (done) || (!*available))? "OK" : "NO");
}
void ControlUpdateOptions(MenuItem *item, u32 *kDown, bool *state, bool *connection_status, bool *available, const std::string &tag) {