1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Show error message on failure to create renderer

This commit is contained in:
Ivan Savenko 2024-01-05 21:46:44 +02:00
parent 121ef77440
commit 3383221f0b

View File

@ -284,7 +284,12 @@ void ScreenHandler::initializeWindow()
mainRenderer = SDL_CreateRenderer(mainWindow, getPreferredRenderingDriver(), rendererFlags);
if(mainRenderer == nullptr)
throw std::runtime_error("Unable to create renderer\n");
{
const char * error = SDL_GetError();
std::string messagePattern = "Failed to create SDL renderer. Reason: %s";
std::string message = boost::str(boost::format(messagePattern) % error);
handleFatalError(message, true);
}
SDL_RendererInfo info;
SDL_GetRendererInfo(mainRenderer, &info);