Public Member Functions | |
bool | isVisible () |
bool | showMouse (bool visible) |
void | pushCursor (const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const Graphics::PixelFormat *format=NULL, const byte *mask=nullptr) |
void | pushCursor (const Surface &surf, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const byte *mask=nullptr) |
void | popCursor () |
void | replaceCursor (const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const Graphics::PixelFormat *format=nullptr, const byte *mask=nullptr) |
void | replaceCursor (const Surface &surf, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale=false, const byte *mask=nullptr) |
void | replaceCursor (const Graphics::Cursor *cursor) |
void | popAllCursors () |
bool | supportsCursorPalettes () |
void | disableCursorPalette (bool disable) |
void | pushCursorPalette (const byte *colors, uint start, uint num) |
void | popCursorPalette () |
void | replaceCursorPalette (const byte *colors, uint start, uint num) |
void | lock (bool locked) |
void | setDefaultArrowCursor (bool push=false) |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< CursorManager > | |
static bool | hasInstance () |
static CursorManager & | instance () |
static void | destroy () |
Protected Types inherited from Common::Singleton< CursorManager > | |
typedef CursorManager | SingletonBaseType |
Static Protected Attributes inherited from Common::Singleton< CursorManager > | |
static CursorManager * | _singleton |
bool Graphics::CursorManager::isVisible | ( | ) |
Return whether the mouse cursor is visible.
bool Graphics::CursorManager::showMouse | ( | bool | visible | ) |
Show or hide the mouse cursor.
This function does not call OSystem::updateScreen, when visible is true. You may need to call OSystem::updateScreen after a call to showMouse(true) to ensure that the mouse cursor becomes visible.
void Graphics::CursorManager::pushCursor | ( | const void * | buf, |
uint | w, | ||
uint | h, | ||
int | hotspotX, | ||
int | hotspotY, | ||
uint32 | keycolor, | ||
bool | dontScale = false , |
||
const Graphics::PixelFormat * | format = NULL , |
||
const byte * | mask = nullptr |
||
) |
Push a new cursor onto the stack, and set it in the backend.
A local copy of the cursor data will be made, so the original buffer can be safely freed afterwards.
buf | New cursor data. |
w | Width. |
h | Height. |
hotspotX | Hotspot X coordinate. |
hotspotY | Hotspot Y coordinate. |
keycolor | Color value for the transparent color. This cannot exceed the maximum color value as defined by format. Does nothing if mask is set. |
dontScale | Whether the cursor should never be scaled. An exception are high PPI displays, where the cursor would be too small to notice otherwise. These are allowed to scale the cursor anyway. |
format | Pointer to the pixel format that the cursor graphic uses. CLUT8 will be used if this is null or not specified. |
mask | Optional pointer to cursor mask containing values from the CursorMaskValue enum. |
void Graphics::CursorManager::pushCursor | ( | const Surface & | surf, |
int | hotspotX, | ||
int | hotspotY, | ||
uint32 | keycolor, | ||
bool | dontScale = false , |
||
const byte * | mask = nullptr |
||
) |
Push a new cursor onto the stack, and set it in the backend.
A local copy of the cursor data will be made, so the original surface can be safely freed afterwards.
surf | New cursor surface. |
hotspotX | Hotspot X coordinate. |
hotspotY | Hotspot Y coordinate. |
keycolor | Color value for the transparent color. This cannot exceed the maximum color value as defined by format. Does nothing if mask is set. |
dontScale | Whether the cursor should never be scaled. An exception are high PPI displays, where the cursor would be too small to notice otherwise. These are allowed to scale the cursor anyway. |
mask | Optional pointer to cursor mask containing values from the CursorMaskValue enum. |
void Graphics::CursorManager::popCursor | ( | ) |
Pop a cursor from the stack, and restore the previous one to the backend.
If there is no previous cursor, the cursor is hidden.
void Graphics::CursorManager::replaceCursor | ( | const void * | buf, |
uint | w, | ||
uint | h, | ||
int | hotspotX, | ||
int | hotspotY, | ||
uint32 | keycolor, | ||
bool | dontScale = false , |
||
const Graphics::PixelFormat * | format = nullptr , |
||
const byte * | mask = nullptr |
||
) |
Replace the current cursor on the stack.
If the stack is empty, the cursor is pushed instead. This is a slightly more optimized way of popping the old cursor before pushing the new one.
buf | New cursor data. |
mask | New cursor mask data. |
w | Width. |
h | Height. |
hotspotX | Hotspot X coordinate. |
hotspotY | Hotspot Y coordinate. |
keycolor | Color value for the transparent color. This cannot exceed the maximum color value as defined by format. Does nothing if mask is set. |
dontScale | Whether the cursor should never be scaled. An exception are high PPI displays, where the cursor would be too small to notice otherwise. These are allowed to scale the cursor anyway. |
format | Pointer to the pixel format that the cursor graphic uses, CLUT8 will be used if this is null or not specified. |
mask | Optional pointer to cursor mask containing values from the CursorMaskValue enum. |
void Graphics::CursorManager::replaceCursor | ( | const Surface & | surf, |
int | hotspotX, | ||
int | hotspotY, | ||
uint32 | keycolor, | ||
bool | dontScale = false , |
||
const byte * | mask = nullptr |
||
) |
Replace the current cursor on the stack.
If the stack is empty, the cursor is pushed instead. This is a slightly more optimized way of popping the old cursor before pushing the new one.
surf | New cursor surface. |
mask | New cursor mask data. |
hotspotX | Hotspot X coordinate. |
hotspotY | Hotspot Y coordinate. |
keycolor | Color value for the transparent color. This cannot exceed the maximum color value as defined by format. Does nothing if mask is set. |
dontScale | Whether the cursor should never be scaled. An exception are high PPI displays, where the cursor would be too small to notice otherwise. These are allowed to scale the cursor anyway. |
mask | Optional pointer to cursor mask containing values from the CursorMaskValue enum. |
void Graphics::CursorManager::replaceCursor | ( | const Graphics::Cursor * | cursor | ) |
Replace the current cursor on the stack.
If the stack is empty, the cursor is pushed instead. This is a slightly more optimized way of popping the old cursor before pushing the new one.
cursor | New cursor. |
void Graphics::CursorManager::popAllCursors | ( | ) |
Pop all cursors and cursor palettes from their respective stacks.
The purpose is to ensure that all unnecessary cursors are removed from the stack when returning to the launcher from an engine.
bool Graphics::CursorManager::supportsCursorPalettes | ( | ) |
Test whether cursor palettes are supported.
This is just a convenience wrapper for checking whether OSystem::kFeatureCursorPalette is supported by OSystem.
void Graphics::CursorManager::disableCursorPalette | ( | bool | disable | ) |
Enable or disable the current cursor palette.
disable |
void Graphics::CursorManager::pushCursorPalette | ( | const byte * | colors, |
uint | start, | ||
uint | num | ||
) |
Push a new cursor palette onto the stack, and set it in the backend.
The palette entries from start
until (start+num-1) will be replaced so a full palette update is accomplished via start=0, num=256.
The palette data is specified in the same interleaved RGB format as used by all backends.
colors | New palette data, in interleaved RGB format. |
start | First palette entry to be updated. |
num | Number of palette entries to be updated. |
void Graphics::CursorManager::popCursorPalette | ( | ) |
Pop a cursor palette from the stack, and restore the previous one to the backend.
If there is no previous palette, the cursor palette is disabled instead.
void Graphics::CursorManager::replaceCursorPalette | ( | const byte * | colors, |
uint | start, | ||
uint | num | ||
) |
Replace the current cursor palette on the stack.
If the stack is empty, the palette is pushed instead. This is a slightly more optimized way of popping the old palette before pushing the new one.
colors | New palette data, in interleaved RGB format. |
start | First palette entry to be updated. |
num | Number of palette entries to be updated. |
void Graphics::CursorManager::lock | ( | bool | locked | ) |
Lock or unlock the visibility state of the cursor.
When the cursor is locked, calling showMouse(bool) does nothing and returns false.
void Graphics::CursorManager::setDefaultArrowCursor | ( | bool | push = false | ) |
Sets default arrow cursor
This is supposed to be used as a sane fallback for system cursor for games that rely on the system cursor
push | Specified if cursor should be pushed on replaced (defailt) |