Fix branch new initialization of iOS STK

This commit is contained in:
Benau 2020-06-15 12:02:16 +08:00
parent 22987062d2
commit 964a13368c
2 changed files with 11 additions and 3 deletions

View File

@ -478,7 +478,7 @@ void CIrrDeviceSDL::createDriver()
{
#ifdef _IRR_COMPILE_WITH_OGLES2_
u32 default_fb = 0;
#ifdef MOBILE_STK
#ifdef IOS_STK
default_fb = Info.info.uikit.framebuffer;
#endif
VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, this, default_fb);
@ -796,6 +796,12 @@ video::IVideoModeList* CIrrDeviceSDL::getVideoModeList()
core::dimension2d<u32>(mode.w * NativeScale, mode.h * NativeScale));
}
#ifdef MOBILE_STK
// SDL2 will return w,h and h,w for mobile STK, as we only use landscape
// so we just use desktop resolution for now
VideoModeList.addMode(core::dimension2d<u32>(mode.w * NativeScale, mode.h * NativeScale),
SDL_BITSPERPIXEL(mode.format));
#else
for (int i = 0; i < mode_count; i++)
{
if (SDL_GetDisplayMode(0, i, &mode) == 0)
@ -804,6 +810,7 @@ video::IVideoModeList* CIrrDeviceSDL::getVideoModeList()
SDL_BITSPERPIXEL(mode.format));
}
}
#endif
}
return &VideoModeList;

View File

@ -348,12 +348,13 @@ void IrrDriver::createListOfVideoModes()
{
const int w = modes->getVideoModeResolution(i).Width;
const int h = modes->getVideoModeResolution(i).Height;
#ifndef MOBILE_STK
// Mobile STK reports only 1 desktop (phone) resolution at native scale
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 );
} // if depth >=24