diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 296419b01..31bf253f7 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -2321,7 +2321,9 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt } // set flags - int SdlFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_ALLOW_HIGHDPI; + int SdlFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN; + if(Flags&IGraphicsBackend::INITFLAG_HIGHDPI) + SdlFlags |= SDL_WINDOW_ALLOW_HIGHDPI; #if defined(SDL_VIDEO_DRIVER_X11) if(Flags&IGraphicsBackend::INITFLAG_RESIZABLE) SdlFlags |= SDL_WINDOW_RESIZABLE; diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index 2d46b93bc..65a6fd39e 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -2049,6 +2049,7 @@ int CGraphics_Threaded::IssueInit() if(g_Config.m_GfxBorderless) Flags |= IGraphicsBackend::INITFLAG_BORDERLESS; if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN; if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC; + if(g_Config.m_GfxHighdpi) Flags |= IGraphicsBackend::INITFLAG_HIGHDPI; #ifndef CONF_VIDEORECORDER if(g_Config.m_GfxResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE; #endif diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index 8fa91fd7d..8d645c1b5 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -561,10 +561,11 @@ class IGraphicsBackend public: enum { - INITFLAG_FULLSCREEN = 1, - INITFLAG_VSYNC = 2, - INITFLAG_RESIZABLE = 4, - INITFLAG_BORDERLESS = 8, + INITFLAG_FULLSCREEN = 1<<0, + INITFLAG_VSYNC = 1<<1, + INITFLAG_RESIZABLE = 1<<2, + INITFLAG_BORDERLESS = 1<<3, + INITFLAG_HIGHDPI = 1 <<4, }; virtual ~IGraphicsBackend() {} diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index dad715d00..5386c26b0 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -91,6 +91,7 @@ MACRO_CONFIG_INT(GfxScreenWidth, gfx_screen_width, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG MACRO_CONFIG_INT(GfxScreenHeight, gfx_screen_height, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution height") MACRO_CONFIG_INT(GfxBorderless, gfx_borderless, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Borderless window (not to be used with fullscreen)") MACRO_CONFIG_INT(GfxFullscreen, gfx_fullscreen, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fullscreen") +MACRO_CONFIG_INT(GfxHighdpi, gfx_highdpi, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Enable high-dpi") MACRO_CONFIG_INT(GfxAlphabits, gfx_alphabits, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Alpha bits for framebuffer (fullscreen only)") MACRO_CONFIG_INT(GfxColorDepth, gfx_color_depth, 24, 16, 24, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Colors bits for framebuffer (fullscreen only)") //MACRO_CONFIG_INT(GfxClear, gfx_clear, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clear screen before rendering") @@ -373,4 +374,3 @@ MACRO_CONFIG_INT(GfxUsePreinitBuffer, gfx_use_preinitialized_buffer, 0, 0, 1, CF #if defined(CONF_VIDEORECORDER) MACRO_CONFIG_INT(ClVideoRecorderFPS, cl_video_recorder_fps, 60, 1, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "At which FPS the videorecorder should record demos.") #endif - diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 734196294..bb2bef06f 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -932,6 +932,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) static int s_GfxOpenGLVersion = g_Config.m_GfxOpenGL3; static int s_GfxEnableTextureUnitOptimization = g_Config.m_GfxEnableTextureUnitOptimization; static int s_GfxUsePreinitBuffer = g_Config.m_GfxUsePreinitBuffer; + static int s_GfxHighdpi = g_Config.m_GfxHighdpi; CUIRect ModeList; MainView.VSplitLeft(300.0f, &MainView, &ModeList); @@ -1077,6 +1078,14 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) } } + MainView.HSplitTop(20.0f, &Button, &MainView); + if(DoButton_CheckBox(&g_Config.m_GfxHighdpi, Localize("Use high DPI"), g_Config.m_GfxHighdpi, &Button)) + { + CheckSettings = true; + g_Config.m_GfxHighdpi ^= 1; + } + + // check if the new settings require a restart if(CheckSettings) { @@ -1089,7 +1098,8 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) s_GfxTextureCompression == g_Config.m_GfxTextureCompression && s_GfxOpenGLVersion == g_Config.m_GfxOpenGL3 && s_GfxUsePreinitBuffer == g_Config.m_GfxUsePreinitBuffer && - s_GfxEnableTextureUnitOptimization == g_Config.m_GfxEnableTextureUnitOptimization) + s_GfxEnableTextureUnitOptimization == g_Config.m_GfxEnableTextureUnitOptimization && + s_GfxHighdpi == g_Config.m_GfxHighdpi) m_NeedRestartGraphics = false; else m_NeedRestartGraphics = true;