From 7efcaf573a8ed09306abaf9f3085ba77fd625d94 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Wed, 6 May 2026 16:16:41 +0500 Subject: [PATCH] Touch controls wip --- src/renderer/Hud.cpp | 30 +++++++++++++++++++++++++++++- src/skel/symbian/symbian.cpp | 29 +++-------------------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/renderer/Hud.cpp b/src/renderer/Hud.cpp index bba8c52..2aefede 100644 --- a/src/renderer/Hud.cpp +++ b/src/renderer/Hud.cpp @@ -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; -} \ No newline at end of file +} diff --git a/src/skel/symbian/symbian.cpp b/src/skel/symbian/symbian.cpp index 0b6ad26..d8db10b 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -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;