Closed squealingpiggies closed 7 months ago
Thanks! Ill review it in a few hours
BTW, @ineveraskedforthis This MR also changes the screen scaling behavior to make the game scretch on devices that dont fit the target resolution. This is a design change more than a fix, we should discuss it before deciding if its a desired behavior. What are your thoughts?
BTW, @ineveraskedforthis This MR also changes the screen scaling behavior to make the game scretch on devices that dont fit the target resolution. This is a design change more than a fix, we should discuss it before deciding if its a desired behavior. What are your thoughts?
As long as it doesn't require any maintenance and things work as usual on "main" resolution, I am fine with such change. Having some way to handle multiple resolutions without maintenance cost is better than not having support for multiple resolutions at all.
BTW, @ineveraskedforthis This MR also changes the screen scaling behavior to make the game scretch on devices that dont fit the target resolution. This is a design change more than a fix, we should discuss it before deciding if its a desired behavior. What are your thoughts?
As long as it doesn't require any maintenance and things work as usual on "main" resolution, I am fine with such change. Having some way to handle multiple resolutions without maintenance cost is better than not having support for multiple resolutions at all.
Maybe it should be a separate type of a setting. "fullscreen (stretch)" and "fullscreen (keep aspect)"
Wdyt? @ineveraskedforthis @squealingpiggies
From my understanding as a user, most programs graphics end up stretched if you set the screen resolution to a different aspect ratio than the monitor on fullscreen thus I was trying to intentionally get that from my code. But from the coding side, love2d has two fullscreen modes as options from one version of setFullscreen
that takes boolean and string as option. The options only works if the boolean is true and, from my experimentation, they do either one of two things: set the monitor resolution to the window size (exclusive) or stretch the window cover the whole monitor (desktop). I simply implemented some checks to pass one of those two options.
If preventing screen stretching is desired, having a keep aspect option could easily be implemented as another options variable with a checkbox and checking it in the UpdateFullscreen
. Alternatively, screen resolution and fullscreen options could be made mutually exclusive, where the exclusive and desktop will always use the monitor resolutions, so the fullscreen never stretches the drawing.
(Just a heads up, I'm in Tokyo so timezones make this a bit slower than it needs to be - I'll take a look again in circa 10h)
Now has a new fitscreen variable in the OPTIONS
linked to a checkbox in the options menu. This variable is used to match fullscreen stretching to monitor aspect ratio but still f4 to a different ratio window, if desired.
The new variable, if set to true, will prevent width stretching/squishing when going fullscreen even if the aspect ratio is different from the monitor. This allows the user to have a custom sized window and use F4 to toggle between exclusive and windowed mode while keeping all square images properly square.
I also figured out how to fit the alias but had to annotate an Options
class that used the Fullscreen
alias and changed updateFullscreen
to take the alias as a parameter.
I moved the update function to opt in game.options.lua since it is tied heavily to the annotated Options
class. Additionally, I annotated the returns for opt.init
and opt.load
and created an alias for love.AlignMode
in engine.ui.lua to clean up the last remaining warnings on the three files touched (engine.ui.lua still has more warnings to solve).
From my understanding as a user, most programs graphics end up stretched if you set the screen resolution to a different aspect ratio than the monitor on fullscreen thus I was trying to intentionally get that from my code. But from the coding side, love2d has two fullscreen modes as options from one version of
setFullscreen
that takes boolean and string as option. The options only works if the boolean is true and, from my experimentation, they do either one of two things: set the monitor resolution to the window size (exclusive) or stretch the window cover the whole monitor (desktop). I simply implemented some checks to pass one of those two options. If preventing screen stretching is desired, having a keep aspect option could easily be implemented as another options variable with a checkbox and checking it in theUpdateFullscreen
. Alternatively, screen resolution and fullscreen options could be made mutually exclusive, where the exclusive and desktop will always use the monitor resolutions, so the fullscreen never stretches the drawing.
Most programs (well, well made ones) don't stretch the resolution, they expand the rendered view and adapt the sizes of rendered ui widgets (relative to the whole screen). See Skyrim, Europa Universalis IV, Factorio, Godot or Paint for examples. You can also see Unity or Godot for automatically scaling UIs, search terms would be things like "anchors", "keep aspect", "keep width", etc. SotE's UI library doesn't have support for this - if you stretch resolution square UI widgets stop being squares. That behavior was popular in very old games such as original releases of Gothic or Heroes of Might and Magic. That was due to them not taking into account that in the future the average user's aspect ratio may change.
I think it's fine to have it but it ought to be spelled out loudly that the option will actually stretch the screen ^-^
Other than that, seems sensible, we should merge it in
Added the version field to options and fixed my typo. Also added argument passing to the bash script.
Seems solid. Thanks!
141
The following code changes the options menu to include a scroll view of resolutions fetched by the love2d engine and a replacement of the fullscreen checkbox with a cycling button to move between windowed, fullscreen (exclusive), and borderless fullscreen window (desktop).
In order to achieve this the following changes were made:
OPTIONS.fullscreen
is now a string that hold either"normal"
,"fullscreen"
, or"desktop"
OPTIONS
now contains a"screen_resolution"
that holds awidth
andheight
that hold the desired screen resolutionset_reference_screen_dimensions
function to keep reference fixed and allow width to stretch or shrink to fit view.updateFullscreen
function to handle updating window and canvas updates on options change.Windowed with a resolution of 800x600 (1280x720 image)
Fullscreen (exclusive) actually changes the monitor resolution, screenshot is at size of settings value but the monitor will stretch it as one would expect for mismatched aspect ratios. Borderless Fullscreen Window (desktop) is much sharper than exclusive (unintentional) but still catches the mismatched aspect ratio (intentional).
It works well except for 4:3 resolutions where the market can stretch off the edge of the screen.