mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 14:08:42 +00:00
Fixed: screenratio is now ok if we failsafe to window mode
This commit is contained in:
parent
43105f993a
commit
66c378f020
1 changed files with 10 additions and 1 deletions
|
@ -1148,7 +1148,7 @@ void computeCurrentFovAspectRatio(float &fov, float &ar)
|
||||||
|
|
||||||
// get the screen aspect ratio from CFG
|
// get the screen aspect ratio from CFG
|
||||||
ar = ClientCfg.ScreenAspectRatio;
|
ar = ClientCfg.ScreenAspectRatio;
|
||||||
|
//nlinfo("AR: clientcfg ar %f", ar);
|
||||||
// if Driver is not created, we can't get current screen mode
|
// if Driver is not created, we can't get current screen mode
|
||||||
if (!Driver) return;
|
if (!Driver) return;
|
||||||
|
|
||||||
|
@ -1167,18 +1167,21 @@ void computeCurrentFovAspectRatio(float &fov, float &ar)
|
||||||
{
|
{
|
||||||
// auto mode, we are using window aspect ratio
|
// auto mode, we are using window aspect ratio
|
||||||
ar = arWnd;
|
ar = arWnd;
|
||||||
|
//nlinfo("AR: windowed auto => use window size %d %d => %f", wndW, wndH, arWnd);
|
||||||
}
|
}
|
||||||
else if (mode.Width && mode.Height)
|
else if (mode.Width && mode.Height)
|
||||||
{
|
{
|
||||||
// compute screen aspect ratio
|
// compute screen aspect ratio
|
||||||
float arScreen= float(mode.Width) / float(mode.Height);
|
float arScreen= float(mode.Width) / float(mode.Height);
|
||||||
ar *= arWnd / arScreen;
|
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
|
// if fullscreen, must modulate aspect ratio by ScreenResolution
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//nlinfo("AR: fullscreen ratio");
|
||||||
if (ar == 0.f)
|
if (ar == 0.f)
|
||||||
{
|
{
|
||||||
UDriver::CMode mode;
|
UDriver::CMode mode;
|
||||||
|
@ -1445,6 +1448,11 @@ void setVideoMode(const UDriver::CMode &mode)
|
||||||
{
|
{
|
||||||
// failed to switch to mode, fall back to windowed
|
// failed to switch to mode, fall back to windowed
|
||||||
newMode.Windowed = true;
|
newMode.Windowed = true;
|
||||||
|
ClientCfg.Windowed = true;
|
||||||
|
ClientCfg.writeInt("FullScreen", 0);
|
||||||
|
|
||||||
|
// set the window mode
|
||||||
|
Driver->setMode(newMode);
|
||||||
}
|
}
|
||||||
bool isMaximized = isWindowMaximized();
|
bool isMaximized = isWindowMaximized();
|
||||||
if (oldMode.Windowed && !newMode.Windowed) // going to fullscreen ?
|
if (oldMode.Windowed && !newMode.Windowed) // going to fullscreen ?
|
||||||
|
@ -1547,6 +1555,7 @@ sint getRyzomModes(std::vector<NL3D::UDriver::CMode> &videoModes, std::vector<st
|
||||||
{
|
{
|
||||||
nlwarning("Mode %ux%u not found, fall back to windowed", (uint)ClientCfg.Width, (uint)ClientCfg.Height);
|
nlwarning("Mode %ux%u not found, fall back to windowed", (uint)ClientCfg.Width, (uint)ClientCfg.Height);
|
||||||
ClientCfg.Windowed = true;
|
ClientCfg.Windowed = true;
|
||||||
|
ClientCfg.writeInt("FullScreen", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nFoundMode;
|
return nFoundMode;
|
||||||
|
|
Loading…
Reference in a new issue