1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Enable VSync to prevent screen tearing while scrolling across map

Fixes #2935
This commit is contained in:
Alexander Wilms 2023-09-23 23:55:29 +02:00 committed by Alexander Wilms
parent 952c740c73
commit 73ea52c615

View File

@ -275,7 +275,7 @@ void ScreenHandler::initializeWindow()
}
//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);
mainRenderer = SDL_CreateRenderer(mainWindow, getPreferredRenderingDriver(), SDL_RENDERER_PRESENTVSYNC);
if(mainRenderer == nullptr)
throw std::runtime_error("Unable to create renderer\n");
@ -570,4 +570,4 @@ bool ScreenHandler::hasFocus()
{
ui32 flags = SDL_GetWindowFlags(mainWindow);
return flags & SDL_WINDOW_INPUT_FOCUS;
}
}