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

Remove screen2 and screenBuf global variables

This commit is contained in:
Ivan Savenko
2025-02-10 14:12:23 +00:00
parent 7e1ce095a1
commit 31e627f128
5 changed files with 4 additions and 47 deletions

View File

@@ -35,8 +35,6 @@ static SDL_Window * mainWindow = nullptr;
SDL_Renderer * mainRenderer = nullptr;
SDL_Texture * screenTexture = nullptr;
SDL_Surface * screen = nullptr; //main screen surface
SDL_Surface * screen2 = nullptr; //and hlp surface (used to store not-active interfaces layer)
SDL_Surface * screenBuf = screen; //points to screen (if only advmapint is present) or screen2 (else) - should be used when updating controls which are not regularly redrawed
static const std::string NAME = GameConstants::VCMI_VERSION; //application name
static constexpr Point heroes3Resolution = Point(800, 600);
@@ -434,18 +432,6 @@ void ScreenHandler::initializeScreenBuffers()
throw std::runtime_error("Unable to create screen texture");
}
screen2 = CSDL_Ext::copySurface(screen);
if(nullptr == screen2)
{
throw std::runtime_error("Unable to copy surface\n");
}
if (GH.windows().count() > 1)
screenBuf = screen2;
else
screenBuf = screen;
clearScreen();
}
@@ -590,15 +576,6 @@ int ScreenHandler::getPreferredRenderingDriver() const
void ScreenHandler::destroyScreenBuffers()
{
// screenBuf is not a separate surface, but points to either screen or screen2 - just set to null
screenBuf = nullptr;
if(nullptr != screen2)
{
SDL_FreeSurface(screen2);
screen2 = nullptr;
}
if(nullptr != screen)
{
SDL_FreeSurface(screen);