From 2c52924e586513c4c715cd0d69cb429ecc50c6e2 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 2 Aug 2020 10:00:04 -0700 Subject: Asteroids demo: disabled DPI scaling --- Projects/Asteroids/src/WinWrapper.cpp | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'Projects/Asteroids/src/WinWrapper.cpp') diff --git a/Projects/Asteroids/src/WinWrapper.cpp b/Projects/Asteroids/src/WinWrapper.cpp index ebdfc33..6bf0e6d 100644 --- a/Projects/Asteroids/src/WinWrapper.cpp +++ b/Projects/Asteroids/src/WinWrapper.cpp @@ -65,23 +65,6 @@ bool CheckDll(char const* dllName) return true; } - -UINT SetupDPI() -{ - // Just do system DPI awareness for now for simplicity... scale the 3D content - SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE); - - UINT dpiX = 0, dpiY; - POINT pt = {1, 1}; - auto hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); - if (SUCCEEDED(GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY))) { - return dpiX; - } else { - return 96; // default - } -} - - void ResetCameraView() { auto center = XMVectorSet(0.0f, -0.4f*SIM_DISC_RADIUS, 0.0f, 0.0f); @@ -144,8 +127,8 @@ LRESULT CALLBACK WindowProc( gSettings.windowWidth = (int)ww; gSettings.windowHeight = (int)wh; - gSettings.renderWidth = (UINT)(double(gSettings.windowWidth) * gSettings.renderScale); - gSettings.renderHeight = (UINT)(double(gSettings.windowHeight) * gSettings.renderScale); + gSettings.renderWidth = gSettings.windowWidth; + gSettings.renderHeight = gSettings.windowHeight; // Update camera projection if(gSettings.renderWidth !=0 && gSettings.renderHeight !=0) @@ -401,15 +384,6 @@ int main(int argc, char** argv) gVulkanAvailable = CheckDll("vulkan-1.dll"); #endif - // Must be done before any windowing-system-like things or else virtualization will kick in - auto dpi = SetupDPI(); - // By default render at the lower resolution and scale up based on system settings - gSettings.renderScale = 96.0 / double(dpi); - - // Scale default window size based on dpi - gSettings.windowWidth *= dpi / 96; - gSettings.windowHeight *= dpi / 96; - gSettings.mode = Settings::RenderMode::Undefined; for (int a = 1; a < argc; ++a) { if (_stricmp(argv[a], "-close_after") == 0 && a + 1 < argc) { @@ -429,8 +403,6 @@ int main(int argc, char** argv) } else if (_stricmp(argv[a], "-window") == 0 && a + 2 < argc) { gSettings.windowWidth = atoi(argv[++a]); gSettings.windowHeight = atoi(argv[++a]); - } else if (_stricmp(argv[a], "-render_scale") == 0 && a + 1 < argc) { - gSettings.renderScale = atof(argv[++a]); } else if (_stricmp(argv[a], "-locked_fps") == 0 && a + 1 < argc) { gSettings.lockedFrameRate = atoi(argv[++a]); } else if (_stricmp(argv[a], "-threads") == 0 && a + 1 < argc) { -- cgit v1.2.3