1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Added debug information to SDL-related crashes

This commit is contained in:
Ivan Savenko
2023-08-06 13:31:10 +03:00
parent 8b0f9c86f8
commit 5faaf175f9
4 changed files with 35 additions and 1 deletions

View File

@@ -264,7 +264,15 @@ void ScreenHandler::initializeWindow()
mainWindow = createWindow();
if(mainWindow == nullptr)
throw std::runtime_error("Unable to create window\n");
{
const char * error = SDL_GetError();
Point dimensions = getPreferredWindowResolution();
std::string messagePattern = "Failed to create SDL Window of size %d x %d. Reason: %s";
std::string message = boost::str(boost::format(messagePattern) % dimensions.x % dimensions.y % error);
handleFatalError(message);
}
//create first available renderer if preferred not set. Use no flags, so HW accelerated will be preferred but SW renderer also will possible
mainRenderer = SDL_CreateRenderer(mainWindow, getPreferredRenderingDriver(), 0);