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

feature: Add aspect ratio info to resolution selection dialog #6587

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

Osmodium
Copy link
Contributor

@Osmodium Osmodium commented Feb 6, 2023

resolves #6586

@oleg-derevenetz oleg-derevenetz linked an issue Feb 7, 2023 that may be closed by this pull request
1 task
@oleg-derevenetz oleg-derevenetz added improvement New feature, request or improvement ui UI/GUI related stuff labels Feb 7, 2023
@oleg-derevenetz oleg-derevenetz added this to the 1.0.2 milestone Feb 7, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

@oleg-derevenetz
Copy link
Collaborator

Hi @Osmodium please remove extra spaces at the end of the line and reorder the includes as suggested by the code style check workflow.

@Osmodium
Copy link
Contributor Author

Osmodium commented Feb 7, 2023

I kind of wanted to add the ratios as two new fields on ResolutionInfo but since it needs to be computed based on width and height it would require for the constructor to calculate it, or where it is instantiated to calculate it. Don't know if it would even be a concern since the only time we spend resources calculating it, is when the dialog is shown.

@oleg-derevenetz
Copy link
Collaborator

If this ratio is only needed in one place for illustration purpose only, then there is no need to store it in the ResolutionInfo. It is better to calculate it in-place.

@Osmodium Osmodium force-pushed the feature/add-aspect-ratio-info branch 2 times, most recently from 99f3135 to 65c3345 Compare February 11, 2023 19:45
Copy link
Owner

@ihhub ihhub left a comment

Choose a reason for hiding this comment

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

Hi @Osmodium , added few comments in this pull request. Could you please take a look when you have time?

Comment on lines 157 to 158
const int32_t gcd = std::gcd( resolution.width, resolution.height );
const auto aspectRatioString = std::to_string( resolution.width / gcd ) + " : " + std::to_string( resolution.height / gcd );
Copy link
Owner

Choose a reason for hiding this comment

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

What if the aspect ratio is more than 99 / 99? I see some weird aspect ratios:
image

We shouldn't do this. I suggest add logic to verify if division by gcd doesn't make values normally looking then increased it to the value when they do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

1366x768 was created as an approximated 16:9 aspect ratio:
https://superuser.com/questions/946086/why-does-1366x768-resolution-exist

I suppose this is the same for 1360x768.

Copy link
Contributor Author

@Osmodium Osmodium Feb 12, 2023

Choose a reason for hiding this comment

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

I have included code to not show the aspect ratio if it is above 99, however this was all just suggestions 😃.

The image below shows, not committed code that gets the closest aspect ratio that looks "good":
image
Is this wished?

@Osmodium
Copy link
Contributor Author

Osmodium commented Feb 12, 2023

@ihhub, so I just posted images of potential layouts in the issue to find out which direction to go.
I mostly like this one but not showing the x1 (only showing scale when above 1):
image

@Osmodium Osmodium force-pushed the feature/add-aspect-ratio-info branch from e9840c7 to 9052d6d Compare February 12, 2023 18:37
@Osmodium Osmodium requested review from ihhub and oleg-derevenetz and removed request for ihhub and oleg-derevenetz February 12, 2023 22:43
@Osmodium
Copy link
Contributor Author

@ihhub I might even like this layout better
image

@ihhub
Copy link
Owner

ihhub commented Feb 13, 2023

Hi @Osmodium , since most of readers in the world read text from left to right we have to put the most important information at the left and less important on the right. Ratio factor is less important information I believe. What do you think?

@Osmodium
Copy link
Contributor Author

Osmodium commented Feb 13, 2023

Hi @Osmodium , since most of readers in the world read text from left to right we have to put the most important information at the left and less important on the right. Ratio factor is less important information I believe. What do you think?

Hi @ihhub
I certainly see your point. I can get behind this format too 😄
image

@Osmodium Osmodium force-pushed the feature/add-aspect-ratio-info branch from 03a8bfb to 590392f Compare February 13, 2023 17:41
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

@ihhub
Copy link
Owner

ihhub commented Feb 14, 2023

Hi @Osmodium , think about the design from a perspective of a new player. The player will see something like x2 and x3 on the left corner and immediately rises a question "What is this?" While putting it just besides the resolution intuitively is being understandable as a scale factor.

@Osmodium
Copy link
Contributor Author

Osmodium commented Feb 14, 2023

Hi @Osmodium , think about the design from a perspective of a new player. The player will see something like x2 and x3 on the left corner and immediately rises a question "What is this?" While putting it just besides the resolution intuitively is being understandable as a scale factor.

Hi @ihhub.
This was why I had placed it on the right since it would make more sense it being a scale factor, however I'm not sure all players, new or otherwise will get what a (x2) means intuitively.
I tried having it in parenthesies (image is for demonstration purposes)
image
But I feel like this looks too cramped.
A thing we could try it to have a header for each column that indicates the information in that column?
EDIT: Hmm adding a column might prove a bit more difficult since the dialog is one big sprite :)

@zenseii zenseii requested a review from ihhub March 6, 2023 10:24
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.

LGTM

@Osmodium
Copy link
Contributor Author

Osmodium commented Mar 9, 2023

@ihhub Do you have further to this issue? :)

@ihhub
Copy link
Owner

ihhub commented Mar 9, 2023

@ihhub Do you have further to this issue? :)

Hi @Osmodium , I will review this pull request again tomorrow. It is on my TODO list. I am also adding @Branikolog to gather his opinion.

@ihhub ihhub requested a review from Branikolog March 9, 2023 16:14
@Branikolog
Copy link
Collaborator

Branikolog commented Mar 9, 2023

Hi @ihhub and @Osmodium
Sorry, but I'm not really satisfied how this window looks now. It's not so bad though and I can accept it, but I wish it looks more elegant... The aspect ratio feature is good, but I personally cannot propose any good looking integration of this feature into the current window. Maybe we need more global rework of the whole window now?
Also, I'm concerning about the variety of available aspect ratio values.
image

Could we approximate the first number, which is before the colon ( : ) in such way, so the second number would take more common values, like 3,4,9 or 10? I think it's more demonstrative to have like [15.9 : 9] or [17.7 : 10] rather than [62 : 35].

Copy link
Owner

@ihhub ihhub left a comment

Choose a reason for hiding this comment

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

HI @Osmodium , I left several comments in this pull request. Could you please take a look?

I also agree with @Branikolog regarding the visual look of the feature. We should change the dialog to support the feature properly.

Comment on lines +148 to +151
void ActionListDoubleClick( fheroes2::ResolutionInfo & item, const fheroes2::Point & /*unused*/, int32_t /*unused*/, int32_t /*unused*/ ) override
{
ActionListDoubleClick( item );
}
Copy link
Owner

Choose a reason for hiding this comment

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

What is the reason to override this method which calls another overridden method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it was from some other implementation, just forgot to remove it.
e26cde4

Copy link
Contributor Author

@Osmodium Osmodium Apr 4, 2023

Choose a reason for hiding this comment

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

Ah I remember, it was a clang error that told me to add it:
https://github.com/ihhub/fheroes2/actions/runs/4610597218/jobs/8149253282?pr=6587
Reintroduced here: b9a2b4a

@ihhub ihhub modified the milestones: 1.0.2, 1.0.3 Mar 12, 2023
@Osmodium Osmodium requested a review from ihhub April 4, 2023 17:29
@ihhub ihhub modified the milestones: 1.0.3, 1.0.4 Apr 11, 2023
@ihhub ihhub modified the milestones: 1.0.4, 1.0.5 May 13, 2023
@ihhub ihhub modified the milestones: 1.0.5, 1.0.6 Jun 14, 2023
@ihhub ihhub modified the milestones: 1.0.6, 1.0.7 Jul 15, 2023
@ihhub ihhub modified the milestones: 1.0.7, 1.0.8 Aug 14, 2023
@ihhub ihhub modified the milestones: 1.0.8, 1.0.9 Sep 11, 2023
@ihhub ihhub modified the milestones: 1.0.9, 1.1.0 Oct 11, 2023
@ihhub ihhub modified the milestones: 1.1.0, Beyond OG scope Jan 13, 2024
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.

Display aspect ratio in resolution select dialog
5 participants