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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user