Any Aspect Ratio support with dynamic window resizing#203
Merged
void2012 merged 1 commit intosmartcmd:mainfrom Mar 2, 2026
Merged
Any Aspect Ratio support with dynamic window resizing#203void2012 merged 1 commit intosmartcmd:mainfrom
void2012 merged 1 commit intosmartcmd:mainfrom
Conversation
Collaborator
Contributor
Author
|
Sure will take a look. |
void2012
added a commit
that referenced
this pull request
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
This PR adds the ability to resize the window while keeping the 3D environment rendering at the correct aspect ratio (not stretched out or squished)
This allows any aspect ratio, both ultrawide and taller ones like 4:3 or even subtle changes like 16:10 for steam deck.
Video demo:
https://www.youtube.com/watch?v=Q860euK_zMU
Note, this has been fully tested after implementing to this repo
Changes
Previous Behavior
Previously, resizing the window causes the game to look stretched out, which is ugly to play with.
Root Cause
The reason for this is it was hardcoded to support 16:9 or 4:3 aspect ratios based on the device and video mode, with Windows64 target only using 16:9.
New Behavior
Now, the aspect ratio changes in real time as you resize the game.
Fix Implementation
The perspective in glWrapper takes in an aspect ratio variable, that was always being passed as 16:9. My implementation updates this to set new variables for the window width and height every time the window is resized, and then use those to calculate the new aspect ratio and pass it in to be rendered.
Known Issues
This fix looks a lot better when stretching out windows, fixing the 3D environment from being stretched, but not the UI components, rendered via SWF flash files, target 16:9 (there are four types of each UI, 480p for 4:3, 720/1080p for 16:9 which the latter is used, and PS Vita which are a bit skinnier than 16:9, I imagine 16:10).
The actual screen size variables in this PR could be used to letterbox/pillarbox the SWF screens dynamically with whitespace, but I couldn't get that part working. Nonetheless, this is a much better implementation of window resizing than default.
Related Issues