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

GUI should be DPI-aware #168

Open
Reveares opened this issue Aug 28, 2024 · 4 comments
Open

GUI should be DPI-aware #168

Reveares opened this issue Aug 28, 2024 · 4 comments

Comments

@Reveares
Copy link

Reveares commented Aug 28, 2024

To Reproduce
Monitor with 3840x2160 resolution, 27 inches and 150% scaling in Windows.
Also in Systempack Scale=1.5.
With the systempack setting everything is rendered correctly in Gothic, but all menus from GD3DD11 do not change their scaling.

Expected behavior
The scaling setting from the Systempack could be used.
The preferred solution would be for GD3DD11 to implement the corresponding high-DPI APIs so that manual specification of the scaling is no longer necessary.

Screenshots
grafik
grafik

@kirides
Copy link
Owner

kirides commented Aug 28, 2024

Games are usually not DPI aware, but use a fixed/scalable UI size.

I'm working on getting such to work

It looks promising so far, though a bunch of calculations which were already off are now off plus scaled :D

grafik
grafik

@Reveares
Copy link
Author

Games are usually not DPI aware, but use a fixed/scalable UI size.

Modern games are DPI aware - they have to be if they are cross-platform when it comes to smartphone, tablet, laptop, PC or TV screens. Or if you have several monitors with different DPI on your PC and move the window around.
That's why the High DPI API from windows is very practical.
But of course, normally the GUI lib should take care of this. I had a quick look in AntTweakBar and the lib doesn't look very lively.

Nice that you are looking into this!

@Reveares
Copy link
Author

Reveares commented Aug 28, 2024

I found another issue in this regard with the default resolution of GD3DD11, because GetClientRect is not DPI aware and returns 2560x1440 for my setup.

RECT desktopRect;
GetClientRect( GetDesktopWindow(), &desktopRect );
// Match the resolution with the current desktop resolution
LoadedResolution = INT2( desktopRect.right, desktopRect.bottom );

Should I look into this or are you already updating every DPI dependent aspect?

@kirides
Copy link
Owner

kirides commented Aug 29, 2024

yea, "AntTweakBar" (CTRL+F11) itself only barely supports "high dpi" by upscaling fontsizes and the renderers own d2d11 interface (F11) doesn't support any dynamic sizing at all.

luckily in d2d11 world, scaling something is clean and sharp. But correcting all calculations and adding a scaling factor (96/DPI) is a bit of hit and miss.

if i were to force DPI aware manifests with the renderer, a bunch of union plugins which use windowing apis would break, as windows usually accomodates for "no high dpi support" by doing the transformations for the application. Like Union/Systempack itself for the UI Scaling, it doesn't depend on DPI but merely scales the UI by the specified factor.

Thus my only choice to correct this while being as compatible as possible with future and past OSes is to ignore "correct DPI awareness" but implement it anyway

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

No branches or pull requests

2 participants