From ab545a1cf0068b4c86d360cba7bb5c882696cd22 Mon Sep 17 00:00:00 2001 From: raven02 Date: Tue, 18 Jun 2013 18:37:34 +0900 Subject: [PATCH] Toggle to adjust on-screen buttons scaling --- Core/Config.cpp | 3 ++- Core/Config.h | 1 + UI/GamepadEmu.cpp | 2 +- UI/MenuScreens.cpp | 17 ++++++++++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 8ecbb5ff8b..dc273895b3 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -138,6 +138,7 @@ void Config::Load(const char *iniFileName) control->Get("ForceInputDevice", &iForceInputDevice, -1); control->Get("RightStickBind", &iRightStickBind, 0); control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65); + control->Get("ButtonScale", &fButtonScale, 1.15); IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam"); pspConfig->Get("NickName", &sNickName, "shadow"); @@ -232,7 +233,7 @@ void Config::Save() control->Set("ForceInputDevice", iForceInputDevice); control->Set("RightStickBind", iRightStickBind); control->Set("TouchButtonOpacity", iTouchButtonOpacity); - + control->Set("ButtonScale", fButtonScale); IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam"); pspConfig->Set("NickName", sNickName.c_str()); diff --git a/Core/Config.h b/Core/Config.h index 03c91d4f06..7fbd525e65 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -110,6 +110,7 @@ public: std::map iMappingMap; // Can be used differently depending on systems int iForceInputDevice; int iTouchButtonOpacity; + float fButtonScale; // SystemParam std::string sNickName; diff --git a/UI/GamepadEmu.cpp b/UI/GamepadEmu.cpp index eab63aebd5..c8362b11b8 100644 --- a/UI/GamepadEmu.cpp +++ b/UI/GamepadEmu.cpp @@ -40,7 +40,7 @@ TouchStick leftStick(&ui_atlas, I_STICKBG, I_STICK, 0); void LayoutGamepad(int w, int h) { - float controlScale = g_Config.bLargeControls ? 1.6 : 1.15; + float controlScale = g_Config.bLargeControls ? g_Config.fButtonScale : 1.15; const int button_spacing = 50 * controlScale; const int arrow_spacing = 40 * controlScale; diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index ee694fe3fa..03c5a767d4 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -1131,7 +1131,22 @@ void ControlsScreen::render() { UICheckBox(GEN_ID, x, y += stride, c->T("OnScreen", "On-Screen Touch Controls"), ALIGN_TOPLEFT, &g_Config.bShowTouchControls); if (g_Config.bShowTouchControls) { - UICheckBox(GEN_ID, x, y += stride, c->T("Large Controls"), ALIGN_TOPLEFT, &g_Config.bLargeControls); + UICheckBox(GEN_ID, x, y += stride, c->T("Buttons Scaling"), ALIGN_TOPLEFT, &g_Config.bLargeControls); + if (g_Config.bLargeControls) { + char scale[256]; + sprintf(scale, "%s %0.2f", c->T("Scale :"), g_Config.fButtonScale); + ui_draw2d.DrawText(UBUNTU24, scale, x + 60, y += stride , 0xFFFFFFFF, ALIGN_LEFT); + HLinear hlinear1(x + 250, y, 20); + if (UIButton(GEN_ID, hlinear1, 80, 0, c->T("Auto"), ALIGN_LEFT)) + g_Config.fButtonScale = 1.15; + if (UIButton(GEN_ID, hlinear1, 60, 0, c->T("-0.1"), ALIGN_LEFT)) + if (g_Config.fButtonScale > 1.15) + g_Config.fButtonScale -= 0.1; + if (UIButton(GEN_ID, hlinear1, 60, 0, c->T("+0.1"), ALIGN_LEFT)) + if (g_Config.fButtonScale < 2.05) + g_Config.fButtonScale += 0.1; + y += 20; + } UICheckBox(GEN_ID, x, y += stride, c->T("Show Analog Stick"), ALIGN_TOPLEFT, &g_Config.bShowAnalogStick); // This will be a slider in the new UI later bool bTransparent = g_Config.iTouchButtonOpacity < 65;