Cockpit: buttons under the glass, -fit, and player display layout
Button banks The exploded diagnostic view was still display-only - it predates the button work - so it now builds the same banks as the cockpit, with the pod arrangement laid out from the panes measured sizes rather than a hardcoded 640/480 grid (the banks make each window bigger than its glass, and the bottom row hung off the work area otherwise). The map side columns were spread height/6 from the top, but the maps own legend grid is not sixths: measured off the bitmap it starts 13 rows down with six 102-tall cells on a 105 pitch. Every button sat high of its label, worst at the bottom. Each buttons top and bottom now come off that grid separately and are subtracted - scaling a height directly would let rounding drift them back out of step on a resized cockpit. Depth 100 to 240: against the 480 glass the two banks meet in the middle bar the strips, so practically the whole display is a press target. This mattered most in the cockpit, where the panes are small enough that the halfway clamp governs - at 100 the MFDs had a 110px dead band straight through the middle of the glass. -fit (also spelled -windowed-fullscreen) Borderless over the whole monitor, with the render size chosen to match. The cockpit presents the 3D into a viewscreen that fills its canvas, so the right -res is that canvas at the scale the cockpit will settle on; computing it with identical arithmetic makes the stretch a copy. On the 3440x1440 panel that is 133% and -res 2553 1436, against 125% for the windowed path that pays for the taskbar. The pick runs after the whole command line, so an explicit -res wins from either side of -fit. Capped at 3840x2160. Cockpit mode only - mode 0 has to stay playable on real pod hardware and mode 2 is a dev view - so those get the resolution and keep their windows. Display layout, in environ.ini L4MFDSCALE sizes all five MFDs, L4MFDSCALE_UL and friends override any one of them, L4RADARSCALE the radar, and L4RADARPOS puts the radar bottom centre, in either bottom corner, or halfway up either side. Scaling is applied in canvas units before the canvas is fitted to the window, so a number means the same thing on every monitor. Sizing each display separately let the clamps become exact rather than one conservative rule for all five: what limits a display is its actual neighbour. Which neighbour that is depends on the radar, so the clamps follow it - on the bottom edge it clears the one MFD above its column, but centred on a side it has one above AND below and grows from the middle both ways, so it must clear the taller twice over. Clamping shrinks uniformly; these are photographs of real instruments and a one-axis clamp would squash them. Verified on the ultrawide: all five radar positions, per-display and group scaling with the clamps biting, -fit with and without an explicit -res, and the button geometry measured back off the screen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+30
-5
@@ -17,9 +17,26 @@ namespace
|
||||
// player actually clicks. Applies to both the MFD strips (depth
|
||||
// measured vertically) and the map's side columns (horizontally).
|
||||
//---------------------------------------------------------------
|
||||
const int buttonDepth = 100;
|
||||
// 240 against the 480 glass: the two banks reach in far enough to
|
||||
// meet in the middle bar the strips' own width, so practically the
|
||||
// whole display is a press target and neither bank overlaps the
|
||||
// other. The clamps below keep that true on a scaled-down cockpit.
|
||||
const int buttonDepth = 240;
|
||||
const int indicatorStrip = 10;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// The map paints its own legend beside each side button, and that
|
||||
// grid is not the naive height/6: measured off the 640-tall map,
|
||||
// the first cell starts 13 rows down and the six cells are 102
|
||||
// tall on a 105 pitch (13 + 6*102 + 5*3 = 640). Spacing the
|
||||
// buttons evenly from the top instead left every one of them
|
||||
// riding high of its label. Scaled to the live glass height.
|
||||
//---------------------------------------------------------------
|
||||
const int mapLegendSpan = 640;
|
||||
const int mapLegendTop = 13;
|
||||
const int mapLegendCell = 102;
|
||||
const int mapLegendPitch = 105;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Button fill colors by lamp brightness (0 off / 1-2 dim / 3
|
||||
// bright), red family for MFD strips, amber for the side columns.
|
||||
@@ -327,20 +344,28 @@ void
|
||||
if (button_w > limit) button_w = limit;
|
||||
if (button_w < strip_w) button_w = strip_w;
|
||||
|
||||
int button_h = display_height / 6;
|
||||
|
||||
displayX = strip_w;
|
||||
*client_width = display_width + 2 * strip_w;
|
||||
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
int h = (i == 5) ? (display_height - 5 * button_h) : button_h;
|
||||
//-------------------------------------------------------
|
||||
// Take top and bottom off the legend grid separately and
|
||||
// subtract: scaling a height directly would let rounding
|
||||
// drift the buttons out of step with the labels.
|
||||
//-------------------------------------------------------
|
||||
int cell_top = mapLegendTop + i * mapLegendPitch;
|
||||
int top = (cell_top * display_height) / mapLegendSpan;
|
||||
int bottom =
|
||||
((cell_top + mapLegendCell) * display_height) / mapLegendSpan;
|
||||
int h = bottom - top;
|
||||
if (h < 1) h = 1;
|
||||
|
||||
ScreenButton *left = &buttons[buttonCount++];
|
||||
left->unit = anchorA + i;
|
||||
left->amber = 1;
|
||||
left->x = 0;
|
||||
left->y = i * button_h;
|
||||
left->y = top;
|
||||
left->w = button_w;
|
||||
left->h = h;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user