summaryrefslogtreecommitdiffstats
path: root/platform/windows
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-09-12 11:18:16 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-09-12 11:18:16 -0300
commiteb0f9651b3bb12b79db4ee4f8862a3be16a11ea5 (patch)
tree520bd56a564a78827c0a8e4c4a7cdc0886680e07 /platform/windows
parent512b9fbf4aa9eecdf55a8be7d793ff0026aada3e (diff)
downloadredot-engine-eb0f9651b3bb12b79db4ee4f8862a3be16a11ea5.tar.gz
HiDPI support on Windows.. yes this is all it took.
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/os_windows.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 5814d883cd..f6b5edc2c9 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -887,6 +887,13 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
return (dpiX + dpiY) / 2;
}
+typedef enum _SHC_PROCESS_DPI_AWARENESS {
+ SHC_PROCESS_DPI_UNAWARE = 0,
+ SHC_PROCESS_SYSTEM_DPI_AWARE = 1,
+ SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2
+} SHC_PROCESS_DPI_AWARENESS;
+
+
void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
@@ -894,6 +901,21 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
window_has_focus = true;
WNDCLASSEXW wc;
+ if (is_hidpi_allowed()) {
+ HMODULE Shcore = LoadLibraryW(L"Shcore.dll");;
+
+ if (Shcore != NULL) {
+ typedef HRESULT (WINAPI *SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS);
+
+ SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness");
+
+ if (SetProcessDpiAwareness) {
+ SetProcessDpiAwareness(SHC_PROCESS_SYSTEM_DPI_AWARE);
+ }
+ }
+ }
+
+
video_mode = p_desired;
//printf("**************** desired %s, mode %s\n", p_desired.fullscreen?"true":"false", video_mode.fullscreen?"true":"false");
RECT WindowRect;