summaryrefslogtreecommitdiff
path: root/platform/windows/os_windows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rw-r--r--platform/windows/os_windows.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index bf8b0ee6b5..8bb5de5d5d 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -57,6 +57,13 @@
#include <regstr.h>
#include <process.h>
+#if (_MSC_VER >= 1700)
+#define HIDPI_SUPPORT
+#endif
+
+#ifdef HIDPI_SUPPORT
+#include <ShellScalingAPI.h>
+#endif
static const WORD MAX_CONSOLE_LINES = 1500;
extern "C" {
@@ -854,7 +861,13 @@ BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPR
minfo.rect.pos.y=lprcMonitor->top;
minfo.rect.size.x=lprcMonitor->right - lprcMonitor->left;
minfo.rect.size.y=lprcMonitor->bottom - lprcMonitor->top;
-
+#ifdef HIDPI_SUPPORT
+ UINT dpix,dpiy;
+ GetDpiForMonitor(hMonitor,MDT_EFFECTIVE_DPI,&dpix,&dpiy);
+ minfo.dpi=(dpix + dpiy)/2;
+#else
+ minfo.dpi=72;
+#endif
self->monitor_info.push_back(minfo);
return TRUE;
@@ -1366,6 +1379,14 @@ Size2 OS_Windows::get_screen_size(int p_screen) const{
return Vector2( monitor_info[p_screen].rect.size );
}
+
+int OS_Windows::get_screen_dpi(int p_screen) const {
+
+ ERR_FAIL_INDEX_V(p_screen,monitor_info.size(),72);
+ UINT dpix,dpiy;
+ return monitor_info[p_screen].dpi;
+
+}
Point2 OS_Windows::get_window_position() const{
RECT r;