mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Make high-dpi screen support optional
This commit is contained in:
parent
9f08b68a01
commit
9bd30ce447
|
@ -602,7 +602,7 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
|
|||
}
|
||||
|
||||
// set flags
|
||||
int SdlFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
int SdlFlags = SDL_WINDOW_OPENGL;
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
if(Flags&IGraphicsBackend::INITFLAG_RESIZABLE)
|
||||
SdlFlags |= SDL_WINDOW_RESIZABLE;
|
||||
|
@ -620,6 +620,11 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
|
|||
#endif
|
||||
}
|
||||
|
||||
if(Flags&IGraphicsBackend::INITFLAG_HIGHDPI)
|
||||
SdlFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
else
|
||||
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
|
||||
|
||||
// set gl attributes
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
if(FsaaSamples)
|
||||
|
|
|
@ -787,6 +787,7 @@ int CGraphics_Threaded::IssueInit()
|
|||
if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN;
|
||||
if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC;
|
||||
if(g_Config.m_GfxResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE;
|
||||
if(g_Config.m_GfxHighdpi) Flags |= IGraphicsBackend::INITFLAG_HIGHDPI;
|
||||
|
||||
return m_pBackend->Init("DDNet Client", &g_Config.m_GfxScreen, &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, g_Config.m_GfxFsaaSamples, Flags, &m_DesktopScreenWidth, &m_DesktopScreenHeight);
|
||||
}
|
||||
|
|
|
@ -318,6 +318,7 @@ public:
|
|||
INITFLAG_VSYNC = 2,
|
||||
INITFLAG_RESIZABLE = 4,
|
||||
INITFLAG_BORDERLESS = 8,
|
||||
INITFLAG_HIGHDPI = 16,
|
||||
};
|
||||
|
||||
virtual ~IGraphicsBackend() {}
|
||||
|
|
|
@ -127,6 +127,7 @@ MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 0, 0, 0, CFGFLAG_SAVE|
|
|||
#else
|
||||
MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Render quads as triangles (fixes quad coloring on some GPUs)")
|
||||
#endif
|
||||
MACRO_CONFIG_INT(GfxHighdpi, gfx_highdpi, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use high-dpi screen features")
|
||||
|
||||
MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity")
|
||||
MACRO_CONFIG_INT(InpMouseOld, inp_mouseold, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use old mouse mode (warp mouse instead of raw input)")
|
||||
|
|
|
@ -818,6 +818,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
static int s_GfxFsaaSamples = g_Config.m_GfxFsaaSamples;
|
||||
static int s_GfxTextureQuality = g_Config.m_GfxTextureQuality;
|
||||
static int s_GfxTextureCompression = g_Config.m_GfxTextureCompression;
|
||||
static int s_GfxHighdpi = g_Config.m_GfxHighdpi;
|
||||
|
||||
CUIRect ModeList;
|
||||
MainView.VSplitLeft(300.0f, &MainView, &ModeList);
|
||||
|
@ -937,6 +938,13 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
if(DoButton_CheckBox(&g_Config.m_GfxHighDetail, Localize("High Detail"), g_Config.m_GfxHighDetail, &Button))
|
||||
g_Config.m_GfxHighDetail ^= 1;
|
||||
|
||||
MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
if(DoButton_CheckBox(&g_Config.m_GfxHighdpi, Localize("High-DPI screen support"), g_Config.m_GfxHighdpi, &Button))
|
||||
{
|
||||
g_Config.m_GfxHighdpi ^= 1;
|
||||
CheckSettings = true;
|
||||
}
|
||||
|
||||
// check if the new settings require a restart
|
||||
if(CheckSettings)
|
||||
{
|
||||
|
@ -946,7 +954,8 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
s_GfxVsync == g_Config.m_GfxVsync &&
|
||||
s_GfxFsaaSamples == g_Config.m_GfxFsaaSamples &&
|
||||
s_GfxTextureQuality == g_Config.m_GfxTextureQuality &&
|
||||
s_GfxTextureCompression == g_Config.m_GfxTextureCompression)
|
||||
s_GfxTextureCompression == g_Config.m_GfxTextureCompression &&
|
||||
s_GfxHighdpi == g_Config.m_GfxHighdpi)
|
||||
m_NeedRestartGraphics = false;
|
||||
else
|
||||
m_NeedRestartGraphics = true;
|
||||
|
|
Loading…
Reference in a new issue