From 5a308b93342e7b4ed7e43eee0b29e16b95eb4f3e Mon Sep 17 00:00:00 2001 From: vl Date: Tue, 9 Nov 2010 11:37:19 +0100 Subject: [PATCH] Fixed: screenratio is now ok if we failsafe to window mode --- code/ryzom/client/src/misc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index b093d22c5..7fc84f4e5 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -1148,7 +1148,7 @@ void computeCurrentFovAspectRatio(float &fov, float &ar) // get the screen aspect ratio from CFG ar = ClientCfg.ScreenAspectRatio; - + //nlinfo("AR: clientcfg ar %f", ar); // if Driver is not created, we can't get current screen mode if (!Driver) return; @@ -1167,18 +1167,21 @@ void computeCurrentFovAspectRatio(float &fov, float &ar) { // auto mode, we are using window aspect ratio ar = arWnd; + //nlinfo("AR: windowed auto => use window size %d %d => %f", wndW, wndH, arWnd); } else if (mode.Width && mode.Height) { // compute screen aspect ratio float arScreen= float(mode.Width) / float(mode.Height); ar *= arWnd / arScreen; + //nlinfo("AR: windowed not auto => monitor size %d %d window size %d %d => arsc %f arwnd %f, ar finale %f", mode.Width, mode.Height, wndW, wndH, arScreen, arWnd, ar); } } } // if fullscreen, must modulate aspect ratio by ScreenResolution else { + //nlinfo("AR: fullscreen ratio"); if (ar == 0.f) { UDriver::CMode mode; @@ -1445,6 +1448,11 @@ void setVideoMode(const UDriver::CMode &mode) { // failed to switch to mode, fall back to windowed newMode.Windowed = true; + ClientCfg.Windowed = true; + ClientCfg.writeInt("FullScreen", 0); + + // set the window mode + Driver->setMode(newMode); } bool isMaximized = isWindowMaximized(); if (oldMode.Windowed && !newMode.Windowed) // going to fullscreen ? @@ -1547,6 +1555,7 @@ sint getRyzomModes(std::vector &videoModes, std::vector