SetWindowSize() and Layout() sizes not matching at fractional display scale factors #2978
Open
1 of 11 tasks
Labels
Milestone
Ebitengine Version
v2.7.2
Operating System
Go Version (
go version
)go1.22.2
What steps will reproduce the problem?
Running the following program with a fractional display scale factor (I tested 125%):
What is the expected result?
Layout sizes match most recently set window sizes.
What happens instead?
Running the program with device scale factor 100% makes everything work as expected:
Running the program with device scale factor 125% shows discordances:
We see that we can get to pretty much any window size, but we tend to undershoot the target value.
Running the program with device scale factor 125% and
LayoutF()
, to have a more detailed view of what might be going on internally:Here we can see that at each size increase, we keep getting further away from the target (-0.2, -0.4, -0.6) for a few steps, and then we snap back to the right size.
At first I thought the issue might be the OS not accepting certain sizes, but after the tests, I think this looks quite suspicious on Ebitengine's side.
Anything else you feel useful to add?
I wasn't sure that having SetWindowSize() and Layout() sizes match would even be possible, but after more detailed testing, I think it should be possible, this looks more like an internal scaling calculation mistake than an OS limitation.
For context, having this work correctly is useful for setting perfect windowed sizes on pixel art games.
The text was updated successfully, but these errors were encountered: