From 2438259c8ac67e33befb62aacfbdddf1233f59b8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 21 Jun 2013 17:40:41 -0700 Subject: [PATCH] Improve button preference UI (there's always one.) --- UI/MenuScreens.cpp | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index c36bac4ad4..37b5c8d5f7 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -1161,24 +1161,33 @@ void SystemScreen::render() { UICheckBox(GEN_ID, x, y += stride, s->T("Fast Memory", "Fast Memory (unstable)"), ALIGN_TOPLEFT, &g_Config.bFastMemory); UICheckBox(GEN_ID, x, y += stride, s->T("Daylight Savings"), ALIGN_TOPLEFT, &g_Config.bDayLightSavings); - UICheckBox(GEN_ID, x, y += stride, s->T("Button Preference"), ALIGN_TOPLEFT, &g_Config.bButtonPreference); - if (g_Config.bButtonPreference) { - char button[256]; - std::string type; - switch (g_Config.iButtonPreference) { - case 0: type = "O to Enter";break; - case 1: type = "X to Enter";break; - } - sprintf(button, "%s %s", s->T("Type :"), type.c_str()); - ui_draw2d.DrawText(UBUNTU24, button, x + 60, y += stride , 0xFFFFFFFF, ALIGN_LEFT); - HLinear hlinear1(x + 280, y, 20); - if (UIButton(GEN_ID, hlinear1, 90, 0, s->T("Use O"), ALIGN_LEFT)) - g_Config.iButtonPreference = 0; - if (UIButton(GEN_ID, hlinear1, 90, 0, s->T("Use X"), ALIGN_LEFT)) - g_Config.iButtonPreference = 1; - y += 10; + + const char *buttonPreferenceTitle; + switch (g_Config.iButtonPreference) { + case PSP_SYSTEMPARAM_BUTTON_CIRCLE: + buttonPreferenceTitle = s->T("Button Preference - O to Confirm"); + break; + case PSP_SYSTEMPARAM_BUTTON_CROSS: + default: + buttonPreferenceTitle = s->T("Button Preference - X to Confirm"); + break; } +#ifdef _WIN32 + const int checkboxH = 32; +#else + const int checkboxH = 48; +#endif + ui_draw2d.DrawTextShadow(UBUNTU24, buttonPreferenceTitle, x + UI_SPACE + 29, (y += stride) + checkboxH / 2, 0xFFFFFFFF, ALIGN_LEFT | ALIGN_VCENTER); + y += stride; + // 29 is the width of the checkbox, new UI will replace. + HLinear hlinearButtonPref(x + UI_SPACE + 29, y, 20); + if (UIButton(GEN_ID, hlinearButtonPref, 90, 0, s->T("Use O"), ALIGN_LEFT)) + g_Config.iButtonPreference = PSP_SYSTEMPARAM_BUTTON_CIRCLE; + if (UIButton(GEN_ID, hlinearButtonPref, 90, 0, s->T("Use X"), ALIGN_LEFT)) + g_Config.iButtonPreference = PSP_SYSTEMPARAM_BUTTON_CROSS; + y += 20 + 6; + /* bool time = g_Config.iTimeFormat > 0 ; UICheckBox(GEN_ID, x, y += stride, s->T("Time Format"), ALIGN_TOPLEFT, &time);