Merge pull request from raven02/patch-2

Toggle to adjust on-screen buttons scaling
This commit is contained in:
Henrik Rydgård 2013-06-18 02:55:29 -07:00
commit b9ff0f57be
4 changed files with 20 additions and 3 deletions

@ -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());

@ -110,6 +110,7 @@ public:
std::map<int,int> iMappingMap; // Can be used differently depending on systems
int iForceInputDevice;
int iTouchButtonOpacity;
float fButtonScale;
// SystemParam
std::string sNickName;

@ -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;

@ -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;