mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
Graceful handling for failing to create SDL window
This commit is contained in:
parent
76328677ef
commit
403ce30a35
1 changed files with 21 additions and 4 deletions
|
@ -350,11 +350,28 @@ void OMW::Engine::createWindow(Settings::Manager& settings)
|
||||||
std::cerr << "SDL error: " << SDL_GetError() << std::endl;
|
std::cerr << "SDL error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
mWindow = SDL_CreateWindow("OpenMW", pos_x, pos_y, width, height, flags);
|
while (!mWindow)
|
||||||
if (mWindow == NULL)
|
|
||||||
{
|
{
|
||||||
std::cerr << "Failed to create SDL window: " << SDL_GetError() << std::endl;
|
mWindow = SDL_CreateWindow("OpenMW", pos_x, pos_y, width, height, flags);
|
||||||
return;
|
if (!mWindow)
|
||||||
|
{
|
||||||
|
// Try with a lower AA
|
||||||
|
if (antialiasing > 0)
|
||||||
|
{
|
||||||
|
std::cout << "Note: " << antialiasing << "x antialiasing not supported, trying " << antialiasing/2 << std::endl;
|
||||||
|
antialiasing /= 2;
|
||||||
|
Settings::Manager::setInt("antialiasing", "Video", antialiasing);
|
||||||
|
if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, antialiasing) != 0)
|
||||||
|
std::cerr << "SDL error: " << SDL_GetError() << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::stringstream error;
|
||||||
|
error << "Failed to create SDL window: " << SDL_GetError() << std::endl;
|
||||||
|
throw std::runtime_error(error.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setWindowIcon();
|
setWindowIcon();
|
||||||
|
|
Loading…
Reference in a new issue