diff --git a/client/CMT.cpp b/client/CMT.cpp index 9d860a103..caeaad2af 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -930,6 +930,8 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen) logGlobal->errorStream() << SDL_GetError(); throw std::runtime_error("Unable to create surface"); } + //No blending for screen itself. Required for proper cursor rendering. + SDL_SetSurfaceBlendMode(screen, SDL_BLENDMODE_NONE); screenTexture = SDL_CreateTexture(mainRenderer, SDL_PIXELFORMAT_ARGB8888, diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 62fc56dd6..e9106e284 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1580,9 +1580,6 @@ void CPlayerInterface::update() if (settings["general"]["showfps"].Bool()) GH.drawFPSCounter(); - - // draw the mouse cursor and update the screen - CCS->curh->render(); } int CPlayerInterface::getLastIndex( std::string namePrefix) diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 434908e7f..497b9afb8 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -532,18 +532,10 @@ void CGPreGame::update() // check for null othervice crash on finishing a campaign // /FIXME: find out why GH.listInt is empty to begin with if (GH.topInt() != nullptr) -#ifdef VCMI_SDL1 GH.topInt()->show(screen); -#else -//FIXME: find better solution for TTF fonts under cursor glitches - GH.topInt()->showAll(screen); -#endif if (settings["general"]["showfps"].Bool()) GH.drawFPSCounter(); - - // draw the mouse cursor and update the screen - CCS->curh->render(); } void CGPreGame::openCampaignScreen(std::string name) diff --git a/client/gui/CCursorHandler.cpp b/client/gui/CCursorHandler.cpp index c8b4e6d82..5fd52e7df 100644 --- a/client/gui/CCursorHandler.cpp +++ b/client/gui/CCursorHandler.cpp @@ -25,6 +25,10 @@ void CCursorHandler::initCursor() currentCursor = nullptr; help = CSDL_Ext::newSurface(40,40); + #ifndef VCMI_SDL1 + //No blending. Ensure, that we are copying pixels during "screen restore draw" + SDL_SetSurfaceBlendMode(help,SDL_BLENDMODE_NONE); + #endif // VCMI_SDL1 SDL_ShowCursor(SDL_DISABLE); changeGraphic(ECursor::ADVENTURE, 0); diff --git a/client/gui/CGuiHandler.cpp b/client/gui/CGuiHandler.cpp index 734f68a6d..e624c0605 100644 --- a/client/gui/CGuiHandler.cpp +++ b/client/gui/CGuiHandler.cpp @@ -414,6 +414,9 @@ void CGuiHandler::renderFrame() if(curInt) curInt->update(); // calls a update and drawing process of the loaded game interface object at the moment + // draw the mouse cursor and update the screen + CCS->curh->render(); + #ifndef VCMI_SDL1 if(0 != SDL_RenderCopy(mainRenderer, screenTexture, nullptr, nullptr)) logGlobal->errorStream() << __FUNCTION__ << " SDL_RenderCopy " << SDL_GetError();