diff --git a/src/gfx.cpp b/src/gfx.cpp index 9f42a7b530..50f00805e7 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1348,6 +1348,9 @@ void ScreenSizeChanged() void UndrawMouseCursor() { + /* Don't undraw mouse cursor if it is handled by the video driver. */ + if (VideoDriver::GetInstance()->UseSystemCursor()) return; + /* Don't undraw the mouse cursor if the screen is not ready */ if (_screen.dst_ptr == nullptr) return; @@ -1361,6 +1364,9 @@ void UndrawMouseCursor() void DrawMouseCursor() { + /* Don't draw mouse cursor if it is handled by the video driver. */ + if (VideoDriver::GetInstance()->UseSystemCursor()) return; + /* Don't draw the mouse cursor if the screen is not ready */ if (_screen.dst_ptr == nullptr) return; diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 9e23d7d2ab..8460f33ed8 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -17,6 +17,7 @@ #include "blitter/factory.hpp" #include "core/math_func.hpp" #include "core/mem_func.hpp" +#include "video/video_driver.hpp" #include "table/sprites.h" #include "table/strings.h" @@ -977,6 +978,8 @@ void GfxClearSpriteCache() SpriteCache *sc = GetSpriteCache(i); if (sc->type != ST_RECOLOUR && sc->ptr != nullptr) DeleteEntryFromSpriteCache(i); } + + VideoDriver::GetInstance()->ClearSystemSprites(); } /* static */ ReusableBuffer SpriteLoader::Sprite::buffer[ZOOM_LVL_COUNT]; diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp index 57945862a1..74bb20f4cf 100644 --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -85,6 +85,20 @@ public: return true; } + /** + * Get whether the mouse cursor is drawn by the video driver. + * @return True if cursor drawing is done by the video driver. + */ + virtual bool UseSystemCursor() + { + return false; + } + + /** + * Clear all cached sprites. + */ + virtual void ClearSystemSprites() {} + /** * Whether the driver has a graphical user interface with the end user. * Or in other words, whether we should spawn a thread for world generation