v86
v86 copied to clipboard
Enhancement: Fullscreen auto-resize
It would be nice when the virtual machine is fullscreened if the scale automatically adjusted to make it as big as it can. Sorry If this is hard to understand
Nah that makes perfect sense, an although that sounds easy, there's a reason most sites or hardware have an adjustable ratio instead. You are talking cross-device aspect ratio resizing, right? anyways, sounds plausible, you'd need an identification method to see the ratio, and some simple methods to convert it. Idk though, I'm just an over-analyzer. all in all, whomever figures it out, please @ me, this seems great
@ethanaobrien @WRA1TH-n-vengence
Assuming you're talking about canvas aka graphics mode and assuming that the element that contains the canvas has the CSS class fullscreen set, when you're entering fullscreen mode, you can add the following CSS selector overrides to your code to get fully responsive, aspect-ratio-respecting auto-resize on fullscreen:
.fullscreen {
display: flex;
}
.fullscreen canvas {
margin-top: auto;
width: 100vw !important;
height: auto !important;
margin-bottom: auto;
}
This works, because scaling is width-dependent and the height is set to auto; therefore the rendering engine will determine the aspect-ratio height of the canvas automatically based on the original aspect ratio set (say v86 sets the canvas to 640x480 because the code executed triggers that via the VGA bios etc.pp, the original rendering size would be 640x480 but 640 gets extrapolated to what 100vw stands for in pixels and the height (480) gets extrapolated with the same scaling factor automatically -- therefore it's called: "auto"); 100vw stands for 100% "viewport width"; the viewport is the available rendering space in a browser window. The canvas rendering is set to pixelated already by the base CSS; that makes rendering appear nicely without blurring, even if we let the canvas scale; although pixels may render large enough to be very well visible.
We don't use transform scaleX and scaleY here. So if you have calls to screen_set_scale like this: screen_set_scale(...), it should not be called, as it would add a scaling transform that interferes with the technique used here.
Sorry for the delay, basically that when the os is put into full screen mode, to automatically fit the aspect ratio to the screen size without stretching the picture if the machine runs at a different aspect ratio, this would be a lot easier than having to put it in fullscreen mode and trying to play around with the numbers to make it fit perfectly.
Thanks!