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:
parent
fedf7edc2b
commit
63bc4910cf
1 changed files with 3 additions and 1 deletions
|
@ -143,8 +143,10 @@ void PSPDpad::ProcessTouch(float x, float y, bool down) {
|
||||||
|
|
||||||
int ctrlMask = 0;
|
int ctrlMask = 0;
|
||||||
int lastDown = down_;
|
int lastDown = down_;
|
||||||
|
|
||||||
|
bool fourWay = g_Config.bDisableDpadDiagonals || rad < 1.25f;
|
||||||
if (down) {
|
if (down) {
|
||||||
if (g_Config.bDisableDpadDiagonals) {
|
if (fourWay) {
|
||||||
int direction = (int)(floorf((atan2f(dy, dx) / (2 * M_PI) * 4) + 0.5f)) & 3;
|
int direction = (int)(floorf((atan2f(dy, dx) / (2 * M_PI) * 4) + 0.5f)) & 3;
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0: ctrlMask |= CTRL_RIGHT; break;
|
case 0: ctrlMask |= CTRL_RIGHT; break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue