Simple tilt sensitivity setting

This commit is contained in:
Henrik Rydgard 2013-09-09 23:48:11 +02:00
parent 90b0fc11ce
commit b24ea4014a
4 changed files with 6 additions and 1 deletions

View File

@ -194,6 +194,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename)
// control->Get("KeyMapping",iMappingMap);
control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65);
control->Get("TiltSensitivity", &iTiltSensitivity, 100);
control->Get("ButtonScale", &fButtonScale, 1.15);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
@ -339,6 +340,7 @@ void Config::Save() {
control->Set("ShowTouchControls", bShowTouchControls);
// control->Set("KeyMapping",iMappingMap);
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
control->Set("TiltSensitivity", iTiltSensitivity);
control->Set("TouchButtonOpacity", iTouchButtonOpacity);
control->Set("ButtonScale", fButtonScale);

View File

@ -109,6 +109,7 @@ public:
int iShowFPSCounter;
bool bShowDebugStats;
bool bAccelerometerToAnalogHoriz;
int iTiltSensitivity;
// The three tabs.
bool bGridView1;

View File

@ -441,9 +441,10 @@ void EmuScreen::update(InputState &input) {
__CtrlSetRapidFire(virtKeys[VIRTKEY_RAPID_FIRE - VIRTKEY_FIRST]);
// Apply tilt to left stick
// TODO: Make into an axis
if (g_Config.bAccelerometerToAnalogHoriz) {
// TODO: Deadzone, etc.
leftstick_x += clamp1(curve1(input.acc.y) * 2.0f);
leftstick_x += clamp1(curve1(input.acc.y) * 2.0f) * g_Config.iTiltSensitivity / 100;
__CtrlSetAnalogX(clamp1(leftstick_x), CTRL_STICK_LEFT);
}

View File

@ -193,6 +193,7 @@ void GameSettingsScreen::CreateViews() {
controlsSettings->Add(new ItemHeader(ms->T("Controls")));
controlsSettings->Add(new Choice(c->T("Control Mapping")))->OnClick.Handle(this, &GameSettingsScreen::OnControlMapping);
controlsSettings->Add(new CheckBox(&g_Config.bAccelerometerToAnalogHoriz, c->T("Tilt", "Tilt to Analog (horizontal)")));
controlsSettings->Add(new PopupSliderChoice(&g_Config.iTiltSensitivity, 10, 200, c->T("Tilt Sensitivity"), screenManager()));
controlsSettings->Add(new ItemHeader(c->T("OnScreen", "On-Screen Touch Controls")));
controlsSettings->Add(new CheckBox(&g_Config.bShowTouchControls, c->T("OnScreen", "On-Screen Touch Controls")));
controlsSettings->Add(new PopupSliderChoice(&g_Config.iTouchButtonOpacity, 0, 85, c->T("Button Opacity"), screenManager()));