Cockpit: on-screen vRIO button banks around the MFDs (clickable, lamp-lit)

Each MFD carries its 4+4 physical button strip and the radar its 6+6
amber side columns, exactly as mounted on the pod (RP412 MFDSplitView
geometry + the shared Tesla-board RIO addresses; anchors 0x2F/0x27/0x37/
0x0F/0x07 for the five MFDs, 0x10/0x18 for the radar).

- L4VB16.cpp: BTBuildCockpitButtons computes the button rects from the
  same cockpit surface layout (strips toward the screen interior to stay
  on-canvas); BTDrawCockpitButtons draws them as coloured quads, lit from
  PadRIO::GetLampState (bright red/amber) or dim; state-block wrapped so
  the button pass doesn't leak render state into the next world frame.
  BTCockpitButtonAt hit-tests; BTPadRIOScreenButton bridges to PadRIO.
- btl4main.cpp WndProc: WM_LBUTTONDOWN/UP hit-test the buttons and inject
  press/release into PadRIO (SetCapture so the release always fires).

Verified: the button banks render around all six surfaces in the
L4MFDSPLIT cockpit; mouse plumbing wired through the already-active
PadRIO screen-button path (Phase 2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-16 20:46:57 -05:00
co-authored by Claude Fable 5
parent 0c964c0ee7
commit 99ea3f07e9
2 changed files with 166 additions and 0 deletions
+23
View File
@@ -100,6 +100,29 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
L4NotifyWindowResized((int)LOWORD(lParam), (int)HIWORD(lParam));
}
return 0;
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
{
// COCKPIT BUTTONS (L4MFDSPLIT): a mouse press on an on-screen MFD/radar
// button injects into PadRIO exactly like a physical RIO key. A single
// pressed unit is tracked so the matching release fires even if the
// cursor moved off the button first.
extern int BTCockpitButtonAt(int px, int py, int clientW, int clientH);
extern void BTPadRIOScreenButton(int unit, int pressed);
static int s_pressedUnit = -1;
RECT rc; GetClientRect(hWnd, &rc);
int mx = (short)LOWORD(lParam), my = (short)HIWORD(lParam);
if (uMsg == WM_LBUTTONDOWN)
{
int unit = BTCockpitButtonAt(mx, my, rc.right, rc.bottom);
if (unit >= 0) { s_pressedUnit = unit; BTPadRIOScreenButton(unit, 1); SetCapture(hWnd); }
}
else
{
if (s_pressedUnit >= 0) { BTPadRIOScreenButton(s_pressedUnit, 0); s_pressedUnit = -1; ReleaseCapture(); }
}
return 0;
}
case WM_CLOSE:
DestroyWindow(hWnd);
return 0;