about summary refs log tree commit diff
path: root/src/engine/client/graphics.cpp
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2012-03-04 12:46:55 +0100
committeroy <Tom_Adams@web.de>2013-02-24 17:25:55 +0100
commit2a4af1573b385f1c30ce376eee1385581d42beab (patch)
tree063e19c50895094adef5379eaaa1f8caa5ae8299 /src/engine/client/graphics.cpp
parent38256d0d45ff929796cc85d0dfcb39242290f3ba (diff)
downloadzcatch-2a4af1573b385f1c30ce376eee1385581d42beab.tar.gz
zcatch-2a4af1573b385f1c30ce376eee1385581d42beab.zip
auto adjust the screen resolution on first start. Closes #921
Diffstat (limited to 'src/engine/client/graphics.cpp')
-rw-r--r--src/engine/client/graphics.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp
index ae0fcade..bf432356 100644
--- a/src/engine/client/graphics.cpp
+++ b/src/engine/client/graphics.cpp
@@ -761,12 +761,19 @@ int CGraphics_OpenGL::Init()
 
 int CGraphics_SDL::TryInit()
 {
-	m_ScreenWidth = g_Config.m_GfxScreenWidth;
-	m_ScreenHeight = g_Config.m_GfxScreenHeight;
-
 	const SDL_VideoInfo *pInfo = SDL_GetVideoInfo();
 	SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); // prevent stuck mouse cursor sdl-bug when loosing fullscreen focus in windows
 
+	// use current resolution as default
+	if(g_Config.m_GfxScreenWidth == 0 || g_Config.m_GfxScreenHeight == 0)
+	{
+		g_Config.m_GfxScreenWidth = pInfo->current_w;
+		g_Config.m_GfxScreenHeight = pInfo->current_h;
+	}
+
+	m_ScreenWidth = g_Config.m_GfxScreenWidth;
+	m_ScreenHeight = g_Config.m_GfxScreenHeight;
+
 	// set flags
 	int Flags = SDL_OPENGL;
 	if(g_Config.m_DbgResizable)