Touch controls: Make it harder to accidentally hit dpad diagonals.

Treats the dpad as 4-way out to a certain radius.
This commit is contained in:
Henrik Rydgard 2013-12-10 18:58:47 +01:00
parent fedf7edc2b
commit 63bc4910cf

View File

@ -143,8 +143,10 @@ void PSPDpad::ProcessTouch(float x, float y, bool down) {
int ctrlMask = 0;
int lastDown = down_;
bool fourWay = g_Config.bDisableDpadDiagonals || rad < 1.25f;
if (down) {
if (g_Config.bDisableDpadDiagonals) {
if (fourWay) {
int direction = (int)(floorf((atan2f(dy, dx) / (2 * M_PI) * 4) + 0.5f)) & 3;
switch (direction) {
case 0: ctrlMask |= CTRL_RIGHT; break;