Skip to content

Any Aspect Ratio support with dynamic window resizing#203

Merged
void2012 merged 1 commit intosmartcmd:mainfrom
fayaz12g:main
Mar 2, 2026
Merged

Any Aspect Ratio support with dynamic window resizing#203
void2012 merged 1 commit intosmartcmd:mainfrom
fayaz12g:main

Conversation

@fayaz12g
Copy link
Contributor

@fayaz12g fayaz12g commented Mar 2, 2026

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

@void2012
Copy link
Collaborator

void2012 commented Mar 3, 2026

@fayaz12g people report crashes in Wine #222 . Please open a new PR and fix it.

@fayaz12g
Copy link
Contributor Author

fayaz12g commented Mar 3, 2026

Sure will take a look.

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.

Game should force letterboxing to 16:9 instead of stretching to fill screen when in fullscreen

2 participants