Fix default windows size and height in iOS

This commit is contained in:
Benau 2019-07-17 16:55:09 +08:00
parent e722d4a0e5
commit dbb14a2861
2 changed files with 17 additions and 0 deletions

View File

@ -368,6 +368,20 @@ namespace irr
FileSystem->changeWorkingDirectoryTo([[[NSBundle mainBundle] resourcePath] UTF8String]);
if (VideoModeList.getVideoModeCount() == 0)
{
// Add current screen size
CGRect screen_bounds = [[UIScreen mainScreen] nativeBounds];
// nativeBounds is the size in a portrait-up orientation, so reverse width and height
core::dimension2du screen_size =
{
(u32)screen_bounds.size.height,
(u32)screen_bounds.size.width
};
VideoModeList.addMode(screen_size, 32);
VideoModeList.setDesktop(32, screen_size);
}
createWindow();
createViewAndDriver();

View File

@ -337,10 +337,13 @@ void IrrDriver::createListOfVideoModes()
{
const int w = modes->getVideoModeResolution(i).Width;
const int h = modes->getVideoModeResolution(i).Height;
#ifndef IOS_STK
// IOS returns the nativebounds in non uniform size
if ((h < MIN_SUPPORTED_HEIGHT || w < MIN_SUPPORTED_WIDTH) &&
(!(h==600 && w==800 && UserConfigParams::m_artist_debug_mode) &&
(!(h==720 && w==1280 && ALLOW_1280_X_720 == true))))
continue;
#endif
VideoMode mode(w, h);
m_modes.push_back( mode );