mirror of
https://gitlab.com/shinovon/re3-symbian.git
synced 2026-05-23 01:57:21 +03:00
Improve touch controls
This commit is contained in:
parent
6c644421fd
commit
52c4681c0c
2 changed files with 73 additions and 46 deletions
|
|
@ -625,6 +625,10 @@ public:
|
|||
RestartTimerL(10000);
|
||||
}
|
||||
|
||||
static bool c(int px, int py, int x, int y, int w, int h) {
|
||||
return px >= x && py >= y && px <= x + w && py <= y + h;
|
||||
}
|
||||
|
||||
virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent) {
|
||||
touch = true;
|
||||
int x = aPointerEvent.iPosition.iX;
|
||||
|
|
@ -683,7 +687,7 @@ public:
|
|||
activeZone[i] = JOY_R2 + 1;
|
||||
virtualButtons[JOY_R2] = 1;
|
||||
}
|
||||
} else if (y > 200 && y <= 360 && (x < 200 || x > w - 200)) {
|
||||
} else if (y > 220 && y <= 360 && (x < 200 || x > w - 200)) {
|
||||
if (x < 200) {
|
||||
activeZone[i] = -1;
|
||||
stickCenterX[i] = x;
|
||||
|
|
@ -712,35 +716,44 @@ public:
|
|||
virtualButtons[JOY_R3] = 1;
|
||||
}
|
||||
} else if (y >= 80 && y <= 80 + 120) {
|
||||
if (x < w / 4) {
|
||||
// dpad
|
||||
int b = 0;
|
||||
if (y < 125) {
|
||||
b = JOY_DPAD_UP;
|
||||
} else if (y > 155) {
|
||||
b = JOY_DPAD_DOWN;
|
||||
} else if (x < w / 8) {
|
||||
b = JOY_DPAD_LEFT;
|
||||
} else {
|
||||
b = JOY_DPAD_RIGHT;
|
||||
do {
|
||||
int cy = (h * 2) / 5;
|
||||
if (x < w / 4) {
|
||||
// dpad
|
||||
int b = 0;
|
||||
int cx = w / 8;
|
||||
if (c(x, y, cx - 20, cy - 60, 40, 30)) {
|
||||
b = JOY_DPAD_UP;
|
||||
} else if (c(x, y, cx - 20, cy + 30, 40, 40)) {
|
||||
b = JOY_DPAD_DOWN;
|
||||
} else if (c(x, y, cx - 75, cy - 20, 40, 40)) {
|
||||
b = JOY_DPAD_LEFT;
|
||||
} else if (c(x, y, cx + 35, cy - 20, 40, 40)) {
|
||||
b = JOY_DPAD_RIGHT;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
activeZone[i] = b + 1;
|
||||
virtualButtons[b] = 1;
|
||||
} else if (x > w - w / 4) {
|
||||
// abxy
|
||||
int cx = w - w / 8;
|
||||
int b = 0;
|
||||
if (c(x, y, cx - 20, cy - 60, 40, 40)) {
|
||||
b = JOY_Y;
|
||||
} else if (c(x, y, cx - 20, cy + 30, 40, 40)) {
|
||||
b = JOY_B;
|
||||
} else if (c(x, y, cx - 75, cy - 20, 40, 40)) {
|
||||
b = JOY_X;
|
||||
} else if (c(x, y, cx + 35, cy - 20, 40, 40)) {
|
||||
b = JOY_A;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
activeZone[i] = b + 1;
|
||||
virtualButtons[b] = 1;
|
||||
}
|
||||
activeZone[i] = b + 1;
|
||||
virtualButtons[b] = 1;
|
||||
} else if (x > w - w / 4) {
|
||||
// abxy
|
||||
int b = 0;
|
||||
if (y < 125) {
|
||||
b = JOY_Y;
|
||||
} else if (y > 155) {
|
||||
b = JOY_B;
|
||||
} else if (x < w - w / 8) {
|
||||
b = JOY_X;
|
||||
} else {
|
||||
b = JOY_A;
|
||||
}
|
||||
activeZone[i] = b + 1;
|
||||
virtualButtons[b] = 1;
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
} else if (aPointerEvent.iType == TPointerEvent::EDrag) {
|
||||
if (activeZone[i] == -1 || activeZone[i] == -2) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue