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

Document the meaning of display/window/stretch/aspect #104254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PGijsbers
Copy link

@PGijsbers PGijsbers commented Mar 16, 2025

Add documentation for ProjectSettings.display/window/stretch/aspect.

I understand bad documentation is worse than no documentation. I'd be happy to make changes, though I understand closing the PR if it's poor since it probably takes much longer to educate me rather than write the docs.

I could not find related issues or PRs.

@PGijsbers PGijsbers requested a review from a team as a code owner March 16, 2025 22:01
Copy link
Contributor

@Chubercik Chubercik left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +919 to +924
Defines if and how the aspect ratio of the root [Viewport] should be preserved when stretching is applied.
[b]"ignore"[/b]: Keep the width and height of the viewport. If the aspect ratio of the window or screen does not match that of the viewport, stretch the render to fill it.
[b]"keep"[/b]: Keep the width and height of the viewport. If the aspect ratio of the window or screen does not match that of the viewport, empty space is filled with black.
[b]"keep_width"[/b]: Keep the width of the viewport, but allow its height to expand. If the aspect ratio of the window or screen is greater, the game is shown centered with vertical black bars. If the aspect ratio is smaller, the viewport is expanded vertically downwards.
[b]"keep_height"[/b]: Keep the height of the viewport, but allow its width to expand. If the aspect ratio of the window or screen is smaller, the game is shown centered with horizontal black bars. If the aspect ratio is greater, the viewport is expanded horizontally to the right.
[b]"expand"[/b]: Allow the viewport to expand in either direction to fill the screen or window. If the aspect ratio of the window or screen is greater, the game is expanded horizontally to the right. If the aspect ratio is smaller, the viewport is expanded vertically downwards.
Copy link
Author

Choose a reason for hiding this comment

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

Suggested change
Defines if and how the aspect ratio of the root [Viewport] should be preserved when stretching is applied.
[b]"ignore"[/b]: Keep the width and height of the viewport. If the aspect ratio of the window or screen does not match that of the viewport, stretch the render to fill it.
[b]"keep"[/b]: Keep the width and height of the viewport. If the aspect ratio of the window or screen does not match that of the viewport, empty space is filled with black.
[b]"keep_width"[/b]: Keep the width of the viewport, but allow its height to expand. If the aspect ratio of the window or screen is greater, the game is shown centered with vertical black bars. If the aspect ratio is smaller, the viewport is expanded vertically downwards.
[b]"keep_height"[/b]: Keep the height of the viewport, but allow its width to expand. If the aspect ratio of the window or screen is smaller, the game is shown centered with horizontal black bars. If the aspect ratio is greater, the viewport is expanded horizontally to the right.
[b]"expand"[/b]: Allow the viewport to expand in either direction to fill the screen or window. If the aspect ratio of the window or screen is greater, the game is expanded horizontally to the right. If the aspect ratio is smaller, the viewport is expanded vertically downwards.
Defines if and how the aspect ratio of the root [Viewport] should be preserved when stretching is applied.
[b]"ignore"[/b]: Keep the width and height of the viewport. If the aspect ratio of the window or screen does not match that of the viewport, stretch the render to fill it.
[b]"keep"[/b]: Keep the width and height of the viewport. If the aspect ratio of the window or screen does not match that of the viewport, empty space is filled with black.
[b]"keep_width"[/b]: Keep the width of the viewport, but allow its height to expand. If the aspect ratio of the window or screen is wider, the game is shown centered with vertical black bars. If the aspect ratio is narrower, the viewport is expanded vertically downwards.
[b]"keep_height"[/b]: Keep the height of the viewport, but allow its width to expand. If the aspect ratio of the window or screen is narrower, the game is shown centered with horizontal black bars. If the aspect ratio is wider, the viewport is expanded horizontally to the right.
[b]"expand"[/b]: Allow the viewport to expand in either direction to fill the screen or window. If the aspect ratio of the window or screen is wider, the game is expanded horizontally to the right. If the aspect ratio is narrower, the viewport is expanded vertically downwards.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry to edit things after the review, so I propose it through the suggestions. After sleeping on it, I think it's probably better to use narrower (instead of smaller) and wider (instead of greater), as the meaning w.r.t. game screen/window shape is more intuitive.

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries, though I'm not sure about the change; more intuitive, sure, but in the context of aspect ratios, comparisons would usually use words like smaller/greater, no? I'm not a native speaker so I wouldn't want to call the shots here, we might want to wait for a review from someone on the docs team.

Copy link
Author

@PGijsbers PGijsbers Mar 17, 2025

Choose a reason for hiding this comment

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

I wasn't sure either, which is why I initially used greater/smaller (since it's a ratio, it's at least correct). However, reading the wikipedia page they do use "wider/narrower" in this context:

but converted when the international standards group introduced a wider ratio of 5+1⁄3 to 3 (= 16:9).

and

which progressed to a wider 4:3

and

This aspect ratio is also wider than the popular 16:9

and

Notably one of the few popular display aspect ratios narrower than 4:3

So I'll leave it for your (and the docs team's) consideration.

Copy link
Author

Choose a reason for hiding this comment

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

I don't know why I couldn't find it yesterday, but I found the proper documentation page for this now: https://docs.godotengine.org/en/stable/tutorials/rendering/multiple_resolutions.html#stretch-aspect

I can update the PR to include these descriptions instead, or is there a way to instead share the same source to reduce the risk of the doc pages and attribute documentation get out-of-sync? And/or can we link to this documentation directly? The animated gifs will be very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants