Make sure that window size is larger than 0
This commit is contained in:
parent
6082a4502b
commit
f019f8622c
@ -349,7 +349,12 @@ void IrrDriver::initDevice()
|
||||
|
||||
video::IVideoModeList* modes = m_device->getVideoModeList();
|
||||
const core::dimension2d<u32> ssize = modes->getDesktopResolution();
|
||||
if (UserConfigParams::m_width > (int)ssize.Width ||
|
||||
|
||||
if (ssize.Width < 1 || ssize.Height < 1)
|
||||
{
|
||||
Log::warn("irr_driver", "Unknown desktop resolution.");
|
||||
}
|
||||
else if (UserConfigParams::m_width > (int)ssize.Width ||
|
||||
UserConfigParams::m_height > (int)ssize.Height)
|
||||
{
|
||||
Log::warn("irr_driver", "The window size specified in "
|
||||
@ -358,13 +363,13 @@ void IrrDriver::initDevice()
|
||||
UserConfigParams::m_height = (int)ssize.Height;
|
||||
}
|
||||
|
||||
core::dimension2d<u32> res = core::dimension2du(UserConfigParams::m_width,
|
||||
UserConfigParams::m_height);
|
||||
|
||||
if (UserConfigParams::m_fullscreen)
|
||||
{
|
||||
if (modes->getVideoModeCount() > 0)
|
||||
{
|
||||
core::dimension2d<u32> res = core::dimension2du(
|
||||
UserConfigParams::m_width,
|
||||
UserConfigParams::m_height);
|
||||
res = modes->getVideoModeResolution(res, res);
|
||||
|
||||
UserConfigParams::m_width = res.Width;
|
||||
@ -372,12 +377,19 @@ void IrrDriver::initDevice()
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::verbose("irr_driver", "Cannot get information about "
|
||||
"resolutions. Try to use the default one.");
|
||||
Log::warn("irr_driver", "Cannot get information about "
|
||||
"resolutions. Disable fullscreen.");
|
||||
UserConfigParams::m_fullscreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_width < 1 || UserConfigParams::m_height < 1)
|
||||
{
|
||||
Log::warn("irr_driver", "Invalid window size. "
|
||||
"Try to use the default one.");
|
||||
UserConfigParams::m_width = MIN_SUPPORTED_WIDTH;
|
||||
UserConfigParams::m_height = MIN_SUPPORTED_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
m_device->closeDevice();
|
||||
m_video_driver = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user