Touch controls: Add an option for "Sticky D-Pad".

Will make it a lot easier to pull off certain moves in fighting games.

Should help #17950
This commit is contained in:
Henrik Rydgård committed 2023-08-31 22:37:11 +02:00
1 parent 0fb1ea3a21
commit ce47055860
3 files changed
+8 -1

No files matched your search

+3
View File
@@ -314,6 +314,9 @@ public:
// Floating analog stick (recenters on thumb on press).
bool bAutoCenterTouchAnalog;
// Sticky D-pad (can't glide off it)
bool bStickyTouchDPad;
//space between PSP buttons
//the PSP button's center (triangle, circle, square, cross)
ConfigTouchPos touchActionButtonCenter;
+4
View File
@@ -688,6 +688,10 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings)
CheckBox *hideStickBackground = controlsSettings->Add(new CheckBox(&g_Config.bHideStickBackground, co->T("Hide touch analog stick background circle")));
hideStickBackground->SetEnabledPtr(&g_Config.bShowTouchControls);
// Sticky D-pad.
CheckBox *stickyDpad = controlsSettings->Add(new CheckBox(&g_Config.bStickyTouchDPad, co->T("Sticky D-Pad (easier sweeping movements)")));
stickyDpad->SetEnabledPtr(&g_Config.bShowTouchControls);
// Re-centers itself to the touch location on touch-down.
CheckBox *floatingAnalog = controlsSettings->Add(new CheckBox(&g_Config.bAutoCenterTouchAnalog, co->T("Auto-centering analog stick")));
floatingAnalog->SetEnabledPtr(&g_Config.bShowTouchControls);
+1 -1
View File
@@ -319,7 +319,7 @@ void PSPDpad::ProcessTouch(float x, float y, bool down) {
float dx = (x - bounds_.centerX()) * inv_stick_size;
float dy = (y - bounds_.centerY()) * inv_stick_size;
float rad = sqrtf(dx * dx + dy * dy);
if (rad < deadzone || fabs(dx) > 0.5f || fabs(dy) > 0.5)
if (!g_Config.bStickyTouchDPad && (rad < deadzone || fabs(dx) > 0.5f || fabs(dy) > 0.5))
down = false;
int ctrlMask = 0;