Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework the search algorithm for available scaled resolutions #7051

Merged
merged 2 commits into from
Apr 25, 2023

Conversation

oleg-derevenetz
Copy link
Collaborator

@oleg-derevenetz oleg-derevenetz commented Apr 22, 2023

Related to #7046

Use the reverse logic to search the available scaled resolutions: do not search for bigger resolutions for existing smaller ones (640x480 -> 1280x960) but add lower "pseudo-resolutions" for existing bigger resolutions instead (1280x1024 -> 640x512x2).

resolutions

@oleg-derevenetz oleg-derevenetz added improvement New feature, request or improvement ui UI/GUI related stuff labels Apr 22, 2023
@oleg-derevenetz oleg-derevenetz added this to the 1.0.4 milestone Apr 22, 2023
@oleg-derevenetz oleg-derevenetz marked this pull request as draft April 22, 2023 21:06
Copy link
Collaborator

@Districh-ru Districh-ru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @oleg-derevenetz.
I left one comment. Could you check it when you have time.

src/engine/screen.cpp Outdated Show resolved Hide resolved
@ihhub
Copy link
Owner

ihhub commented Apr 23, 2023

Hi @oleg-derevenetz , my biggest fear not implementing this in the past is the amount of resolutions available for end users. Having tons of them seems like an overkill.

The biggest problem is the way how we add resolutions in a case of having a single resolution returned by SDL. Logically we should add resolutions which are close to the aspect ratio of the original one. For instance, having 1920x1080 and adding 1280x960 doesn't look right for some people. I don't have a strong opinion about the best solution we should choose at the moment.

@oleg-derevenetz
Copy link
Collaborator Author

@ihhub

my biggest fear not implementing this in the past is the amount of resolutions available for end users. Having tons of them seems like an overkill.

Well, it's up to you :) But IMHO having more scaled resolutions is fine, because existing resolutions usually doesn't fit the scaling well.

The biggest problem is the way how we add resolutions in case of having a single resolution returned by SDL. Logically we should add resolutions which are close to the aspect ration of the original one. For instance, having 1920x1080 and adding 1280x960 doesn't look right for some people. I don't have a strong opinion about the best solution we should choose at the moment.

This logic left intact in this PR (apart from incorrect optimization of resolution comparison which is reverted).

Copy link
Collaborator

@Districh-ru Districh-ru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it works OK. 👍
On my cell phone I have only one scaled resolution (x1.5) as before this PR. On PC I have some new (x2.0) resolutions.

IMHO it will be better in future to set only the game resolution and have an option to use desktop resolution as screen resolution with scaling.
Talking about PC for me there is no difference - run the game in fullscreen using 640x480 or 640x480(x2.0) - desktop resolution will be changed, all windows and icons will be rearranged. The only difference is that in first place there only will be used the video card or monitor built-in scaler. And running the game in a window I can always change the window size (i.e. maximize it) so (x1.0) and (x2.0) will give the same picture.
And, as I can see, on android the game always use native screen resolution and stretches the picture to fit it, keeping the aspect ratio. So there will be no difference between (x1.0) and other scales for the same resolution.

@oleg-derevenetz
Copy link
Collaborator Author

IMHO it will be better in future to set only the game resolution and have an option to use desktop resolution as screen resolution with scaling.

Technically there is no problem with this - all we need is to always use the SDL_WINDOW_FULLSCREEN_DESKTOP fullscreen mode (and always use the software cursor to properly scale it). Currently this mode is used almost everywhere except Windows. This mode is better than the "hardware" fullscreen mode (SDL_WINDOW_FULLSCREEN) in many aspects - for example, it properly works with multiple monitors and it doesn't cause negative effects such as rearranging shortcut icons on the desktop.

Copy link
Collaborator

@zenseii zenseii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Android (with max res of 1480x720) and PC(1920x1080) and it worked very well with the lower stretched resolutions. The Android phone had 986x480 (x1.5) reported.

@ihhub ihhub merged commit c028846 into ihhub:master Apr 25, 2023
31 checks passed
@ihhub
Copy link
Owner

ihhub commented Apr 25, 2023

@oleg-derevenetz , thank you so much for these improvements!

@oleg-derevenetz oleg-derevenetz deleted the resolution-scaling branch April 25, 2023 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement ui UI/GUI related stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants