Codechange: Allow video drivers to handle the cursor themselves.

pull/221/head
Michael Lutz 3 years ago
parent 6776229047
commit 3e49aff35c

@ -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;

@ -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::CommonPixel> SpriteLoader::Sprite::buffer[ZOOM_LVL_COUNT];

@ -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

Loading…
Cancel
Save