Cockpit scales both ways and re-fits on resize, aspect locked
The canvas was capped at 100%, so a bigger monitor got a 1920x1080 cockpit in the corner of the screen and maximising did nothing - the layout only ran once at startup. Now the fit is one uniform scale with no ceiling, recomputed whenever the window changes size (maximise, restore, drag), and the canvas is centred in whatever client area it gets. Uniform scale is what locks the aspect: a wider-than-16:9 desktop letterboxes with even black bars instead of stretching the cockpit. Panes gained Resize() so the glass and its button banks re-scale with the canvas; the pixel buffers keep their native source resolution. Scaling up is free quality on the MFDs - their glass is a downscale of a native 640x480 channel until about 200%. Verified on the 3440x1392 ultrawide: opens at 125% (2400x1350) instead of 100%, maximises to 126% centred with even bars, a 1884x661 window fits 61% letterboxed left/right, 1084x961 fits 56% letterboxed top/ bottom, and a 2584x1461 client scales up to 134%. The 3D still renders at -res and D3D stretches it to the canvas, so raise -res to match a large screen for 1:1 pixels; start-windowed.bat and the README say so. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,10 @@ MFDSplitView::MFDSplitView(
|
||||
header->biCompression = BI_RGB;
|
||||
blitHeader = header;
|
||||
|
||||
buttonStyle = button_style;
|
||||
buttonAnchorA = anchorA;
|
||||
buttonAnchorB = anchorB;
|
||||
|
||||
int client_width = display_width;
|
||||
int client_height = display_height;
|
||||
LayoutButtons(button_style, anchorA, anchorB,
|
||||
@@ -472,6 +476,34 @@ void
|
||||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Re-scale to a new glass size: the pixel buffer keeps its native
|
||||
// source resolution, so only the destination rectangle, the button
|
||||
// geometry and the window size change.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
void
|
||||
MFDSplitView::Resize(int display_width, int display_height)
|
||||
{
|
||||
Check_Pointer(this);
|
||||
|
||||
buttonCount = 0;
|
||||
pressedIndex = -1;
|
||||
|
||||
int client_width = display_width;
|
||||
int client_height = display_height;
|
||||
LayoutButtons(buttonStyle, buttonAnchorA, buttonAnchorB,
|
||||
display_width, display_height, &client_width, &client_height);
|
||||
clientWidth = client_width;
|
||||
clientHeight = client_height;
|
||||
|
||||
if (window != NULL)
|
||||
{
|
||||
SetWindowPos((HWND) window, NULL, 0, 0,
|
||||
client_width, client_height,
|
||||
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MFDSplitView::Repaint()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user