Surface screen DPI and scale in GraphicsOutput#3132
Surface screen DPI and scale in GraphicsOutput#3132Ethereal77 wants to merge 3 commits intostride3d:masterfrom
Conversation
I'm trying to move the logic to a common place that can be used by both Direct3D and Vulkan. I'm finding a little block however. Currently I see no way to distinguish Vulkan+Windows from Vulkan+Linux or Vulkan+MacOS. Direct3D is obviously only Windows, but I do not want to ship the internal I want to use conditional compilation, but only define that I can use is So, what should I do? Options are leaving this as DX-only for now (the only one I can guarantee it is Windows), or modify the SDK to define something like @Kryptos-FR You modernized the SDK recently. Do you think it is feasible and desirable to add something like |
|
I don't have fully grasped the new SDK build system, so excuse if this is not correct. I have modified the following lines in <!-- ================================================================ -->
<!-- Platform Defines - Desktop Frameworks -->
<!-- ================================================================ -->
<PropertyGroup Condition="'$(TargetFramework)' == '$(StrideFramework)' Or '$(TargetFramework)' == '$(StrideFrameworkWindows)'">
<StridePlatformDefines>STRIDE_PLATFORM_DESKTOP</StridePlatformDefines>
<StridePlatformDefines Condition="'$(StridePlatform)' == 'Windows'">$(StridePlatformDefines); STRIDE_PLATFORM_WINDOWS</StridePlatformDefines>
<StridePlatformDefines Condition="'$(StridePlatform)' == 'Linux'">$(StridePlatformDefines); STRIDE_PLATFORM_LINUX</StridePlatformDefines>
<StridePlatformDefines Condition="'$(StridePlatform)' == 'macOS'">$(StridePlatformDefines); STRIDE_PLATFORM_MACOS</StridePlatformDefines>
</PropertyGroup>It seems to work. When checking the MSBuild log, it appears the correct constants are defined in addition to |
ab329f3 to
482bd28
Compare
PR Details
This pull request adds support for retrieving and exposing display DPI (dots per inch) information
in the
GraphicsOutputclass, allowing the engine to be DPI-aware and adapt rendering to differentdisplay scaling settings.
Dpi(horizontal and vertical DPI asInt2) andDpiScale(scale factor relative to 96 DPI) to theGraphicsOutputclass, providing access to the display's DPI and scaling information.GraphicsOutputnow retrieves DPI information for the attached monitor using the Win32GetDpiForMonitorAPI and sets the new properties accordingly.Related Issue
#2906
Types of changes
Checklist
Open questions
(I will be removing these once they are cleared/resolved)
GetDpiForMonitor, which is supported only on Windows 8.1+. If this is a problem, I can look at some alternative. Although Win8.1 is from 2013!GetDpiForWindow) that allows to get the DPI affecting a specific window and respect the per-monitor DPI awareness setting of the application, but it is Windows 10+ only. If there is interest I can implement it onGameWindow.GameWindow.