Files
RP412/MUNGA_L4/L4MFDVIEW.h
T
CydandClaude Fable 5 1e15519e90 1920x1080 internal cockpit canvas with pod-bezel occlusion
The cockpit is now a fixed 1920x1080 canvas (uniformly scaled down on
smaller monitors, min 25%):

  [ MFD UL 640 ][ MFD UC 640 ][ MFD UR 640 ]  <- native glass, 1920 wide
             [ viewscreen 800x600 centered ]
  [ MFD LL ]       [ Map ]        [ MFD LR ]  <- bottom edge

Playtest direction: the original pods MFDs partially occluded the main
display, and that is used here on purpose - the panes overlap the
viewscreen and render over it (viewscreen pinned to the bottom of the
sibling z-order, WS_CLIPSIBLINGS everywhere, so the 3D present clips
around every pane). Top-row glasses are gauge-canvas native 640x480 -
three across is exactly 1920. Red MFD buttons at half height; the amber
map columns stack contiguous like the pod strips. The auto-fit
scale/L4MFDSCALE machinery is gone - the canvas is the design space.

Verified live at 100% scale: contiguous native top row over the
centered viewscreen, bottom cluster overlapping its lower edge, map and
gauges updating (BOOST values moving, presets lit).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 15:26:22 -05:00

132 lines
3.2 KiB
C++

#pragma once
#include "..\munga\style.h"
//########################################################################
//############################ MFDSplitView ##############################
//########################################################################
//
// One desktop window showing a single cockpit display, used by SVGA16's
// split mode (L4MFDSPLIT=1). The pod hardware packed the five monochrome
// MFDs into the color channels of two video outputs and mounted the map
// display rotated; on a desktop each display gets its own window instead.
//
// Each window also carries its display's physical button bank, exactly
// as mounted in the pod (geometry per vRIO's CockpitLayout):
// - MFDs: a 4x2 cluster - 4 red buttons above the glass, 4 below,
// RIO addresses descending from the cluster anchor (top-left = hi).
// - The map ("secondary screen"): 6 amber buttons down each side -
// Secondary 0x10-0x15 on the left, Screen 0x18-0x1D on the right
// (the remaining column addresses are Tesla relays, not buttons).
// Buttons light from the lamp state the game commands (via PadRIO) and
// press/release RIO units with the mouse.
//
// SVGA16 fills Pixels() (32bpp top-down, sourceWidth x sourceHeight as
// passed - already swapped by the caller for the rotated map) and calls
// Repaint(). Closing a view window just hides it.
//
class MFDSplitView
{
public:
enum ButtonStyle
{
NoButtons = 0,
MFDStrips, // 4 above + 4 below, addresses descend from anchorA
SideColumns // 6 per side; anchorA = left base, anchorB = right base
};
// With a parent, the view is created as a chrome-less child window
// inside the single cockpit window (x/y in parent client coords);
// without one it is its own draggable desktop window.
MFDSplitView(
const char *title,
int source_width,
int source_height,
int display_width,
int display_height,
int x,
int y,
ButtonStyle button_style = NoButtons,
int anchorA = 0,
int anchorB = 0,
void *parent = 0
);
int
ClientWidth() const
{ return clientWidth; }
int
ClientHeight() const
{ return clientHeight; }
// Move the pane (child mode: parent client coords). Panes overlap
// the viewscreen like the pod's bezels, so exact placement happens
// after construction from the measured client sizes.
void
SetPosition(int x, int y);
~MFDSplitView();
Logical
TestInstance() const;
unsigned long *
Pixels()
{ return pixels; }
void
Repaint();
// Window-procedure callbacks (public for the registered WndProc)
void
Paint();
void
MouseDown(int x, int y);
void
MouseUp();
protected:
void
LayoutButtons(
ButtonStyle button_style,
int anchorA,
int anchorB,
int display_width,
int display_height,
int *client_width,
int *client_height
);
struct ScreenButton
{
int unit;
int x, y, w, h;
int amber; // 0 = red family, 1 = amber family
};
enum { maxButtons = 20 };
void
*window; // HWND
void
*blitHeader; // BITMAPINFOHEADER for StretchDIBits
unsigned long
*pixels;
int
sourceWidth,
sourceHeight;
int
displayX, displayY,
displayW, displayH;
int
clientWidth, clientHeight;
ScreenButton
buttons[maxButtons];
int
buttonCount;
int
pressedIndex;
};