Skip to content

Maintain aspect ratio of currently displayed card no matter what dimensions the window has#237

Closed
Larikk wants to merge 7 commits into
edo9300:topdownfrom
Larikk:cardimg-aspectratio
Closed

Maintain aspect ratio of currently displayed card no matter what dimensions the window has#237
Larikk wants to merge 7 commits into
edo9300:topdownfrom
Larikk:cardimg-aspectratio

Conversation

@Larikk

@Larikk Larikk commented Jun 7, 2022

Copy link
Copy Markdown

Most users play edopro on widescreen monitors under which the currently displayed card appears wide/stretched out. This change attempts to fix that.

Comparisons (top image shows current behaviour, bottom one adjusted behaviour):

Window at ~1080p:
image
image

Window at half of ~1080p:
image
image

The positions of buttons in deck edit, duels and replays were adjusted.

Known issues:

  • Some Exit/Leave/Quit buttons are not sized correctly when the current scene is changes. Resizing the window fixes that.

@Larikk

Larikk commented Jun 8, 2022

Copy link
Copy Markdown
Author

After thinking about it a bit I think it could be better to make ResizeWithAspectRatio cap only the width instead of width and height. This would preserve the current behaviour of the card being squished when the window is narrow which does not have severe functional implication for the card info. It does however have functional implications if the function would be used to resize the cards in the deck and searchlist too: Having narrow cards may be more desireable than having very small cards. The card name and stats in the searchlist would also shrink if the card next to it would be small.

Alternatively another resize function could be added which only caps the width. That one could be used for the cards in the deck and searchlist in a future change

So the questions basically are:

  • Should the card info be squished or scaled down when the window is narrow?
  • Should the cards in the deck and search list be squished or scaled down when the window is narrow?

@Larikk

Larikk commented Jun 11, 2022

Copy link
Copy Markdown
Author

Okay, regarding the issue with the exit button I have found the culprit: The size/position is changed outside of game.cpp like at

mainGame->btnLeaveGame->setRelativePosition(mainGame->Resize(205, 5, 295, 45));

This is super obvious in hindsight but I (wrongly) assumed due to its sheer size and complexity that game.cpp handles everything GUI related.

Some possible fixes:

  1. Revert the commits which change the positions of the buttons and leave them as it is right now. There would be a gap between the card info and the buttons.
  2. Query the size of the cardinfo at the locations that adjust those buttons and fix their placement.
  3. Make Game::OnResize() the centralized location which determines the placements of GUI elements and call it at the end of every function which makes changes to the GUI. Use (0,0,0,0) as the placement in other places or just leave as it is.

I'm honestly in favor of option 3. Even if you ignore dynamically calculated bounds like in this case it still seems like a headache to me that you have to keep the hardcoded values for the bounds of GUI elements in Game:OnResize and Game::Initialize and other places in sync.

@edo9300 edo9300 deleted the branch edo9300:topdown July 12, 2022 12:31
@edo9300 edo9300 closed this Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants