Touch controls wip

This commit is contained in:
Shinovon 2026-05-06 16:16:41 +05:00
parent a56793f44b
commit 7efcaf573a
2 changed files with 32 additions and 27 deletions

View file

@ -1319,6 +1319,34 @@ void CHud::Draw()
void CHud::DrawAfterFade()
{
// controller hud
{
// FIXME
int w = 640;
int y = 0;
{
#define CRECT(X, Y, W, H) CRect(X, (Y) * 480.f / 360.f, (W) + (X), ((H) + (Y)) * 480.f / 360.f)
// l
CSprite2d::DrawRect(CRECT(40, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
CSprite2d::DrawRect(CRECT(180, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
// r
CSprite2d::DrawRect(CRECT(w - 40 - 90, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
CSprite2d::DrawRect(CRECT(w - 180 - 90, 6 + y, 90, 20), CRGBA(0, 0, 0, 128));
// select, start
CSprite2d::DrawRect(CRECT(320 - 80, 286 + y, 60, 20), CRGBA(0, 0, 0, 128));
CSprite2d::DrawRect(CRECT(320 + 20, 286 + y, 60, 20), CRGBA(0, 0, 0, 128));
// dpad
CSprite2d::DrawRect(CRECT(0, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128));
// abxy
CSprite2d::DrawRect(CRECT(w - w / 4, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128));
#undef CRECT
}
}
if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack())
return;
@ -1710,4 +1738,4 @@ void CHud::SetPagerMessage(wchar *message)
m_PagerMessage[i] = message[i];
}
m_PagerMessage[i] = 0;
}
}

View file

@ -537,29 +537,6 @@ public:
}
if (aPointerEvent.iType == TPointerEvent::EButton1Down) {
// if (x < w / 3 && y > h / 4) {
// // bottom left: left stick
// activeZone[i] = 1;
// stickCenterX[i] = x;
// stickCenterY[i] = y;
// } else if (x > w * 2 / 3 && y > h / 4) {
// // bottom right: right stick
// activeZone[i] = 2;
// stickCenterX[i] = x;
// stickCenterY[i] = y;
// } else if (x > w - (w / 5) && y < h / 4) {
// // top right: enter/exit
// activeZone[i] = 3;
// virtualButtons[JOY_Y] = 1;
// } else if (x < w / 5 && y < h / 4) {
// // top left: brake
// activeZone[i] = 4;
// virtualButtons[JOY_X] = 1;
// } else {
// // gas
// activeZone[i] = 5;
// virtualButtons[JOY_B] = 1;
// }
if (y >= 0 && y <= 32) {
if (x > 40 && x < 40 + 90) {
// l1
@ -569,11 +546,11 @@ public:
// l2
activeZone[i] = JOY_L2 + 1;
virtualButtons[JOY_L2] = 1;
} else if (x > w - 40 && x < w - 40 - 90) {
} else if (x > w - 40 - 90 && x < w - 40) {
// r1
activeZone[i] = JOY_R1 + 1;
virtualButtons[JOY_R1] = 1;
} else if (x > w - 180 && x < w - 180 - 90) {
} else if (x > w - 180 - 90 && x < w - 180) {
// r2
activeZone[i] = JOY_R2 + 1;
virtualButtons[JOY_R2] = 1;
@ -620,7 +597,7 @@ public:
b = JOY_Y;
} else if (y > 155) {
b = JOY_A;
} else if (x < w / 8) {
} else if (x < w - w / 8) {
b = JOY_X;
} else {
b = JOY_B;