mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-30 21:00:39 +00:00
GRAPHICS: Added an arrow cursor to CursorMan
It is meant to be used as a sane cursor when the game is relying on system cursor, like some Windows titles. If you want to improve the cursor graphics, you are welcome.
This commit is contained in:
parent
2f20fc4fd4
commit
5a3a131b09
@ -31,6 +31,32 @@ DECLARE_SINGLETON(Graphics::CursorManager);
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
static const int CURSOR_W = 12;
|
||||
static const int CURSOR_H = 20;
|
||||
static const byte ARROW_CURSOR[CURSOR_W * CURSOR_H] = {
|
||||
1,1,0,0,0,0,0,0,0,0,0,0,
|
||||
1,2,1,0,0,0,0,0,0,0,0,0,
|
||||
1,2,2,1,0,0,0,0,0,0,0,0,
|
||||
1,2,2,2,1,0,0,0,0,0,0,0,
|
||||
1,2,2,2,2,1,0,0,0,0,0,0,
|
||||
1,2,2,2,2,2,1,0,0,0,0,0,
|
||||
1,2,2,2,2,2,2,1,0,0,0,0,
|
||||
1,2,2,2,2,2,2,2,1,0,0,0,
|
||||
1,2,2,2,2,2,2,2,2,1,0,0,
|
||||
1,2,2,2,2,2,2,2,2,2,1,0,
|
||||
1,2,2,2,2,2,2,1,1,1,1,1,
|
||||
1,2,2,2,1,2,2,1,0,0,0,0,
|
||||
1,2,2,1,1,2,2,1,0,0,0,0,
|
||||
1,2,1,0,0,1,2,2,1,0,0,0,
|
||||
1,1,0,0,0,1,2,2,1,0,0,0,
|
||||
1,0,0,0,0,0,1,2,2,1,0,0,
|
||||
0,0,0,0,0,0,1,2,2,1,0,0,
|
||||
0,0,0,0,0,0,0,1,2,2,1,0,
|
||||
0,0,0,0,0,0,0,1,2,2,1,0,
|
||||
0,0,0,0,0,0,0,0,1,1,0,0,
|
||||
};
|
||||
static const byte CURSOR_PALETTE[] = { 0x80, 0x80, 0x80, 0, 0, 0, 0xff, 0xff, 0xff };
|
||||
|
||||
CursorManager::~CursorManager() {
|
||||
for (Common::Stack<Cursor *>::size_type i = 0; i < _cursorStack.size(); ++i)
|
||||
delete _cursorStack[i];
|
||||
@ -275,6 +301,18 @@ void CursorManager::lock(bool locked) {
|
||||
_locked = locked;
|
||||
}
|
||||
|
||||
void CursorManager::setDefaultArrowCursor(bool push) {
|
||||
Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
|
||||
|
||||
if (push) {
|
||||
pushCursorPalette(CURSOR_PALETTE, 0, ARRAYSIZE(CURSOR_PALETTE) / 3);
|
||||
pushCursor(ARROW_CURSOR, CURSOR_W, CURSOR_H, 0, 0, 0, true, &format);
|
||||
} else {
|
||||
replaceCursorPalette(CURSOR_PALETTE, 0, ARRAYSIZE(CURSOR_PALETTE) / 3);
|
||||
replaceCursor(ARROW_CURSOR, CURSOR_W, CURSOR_H, 0, 0, 0, true, &format);
|
||||
}
|
||||
}
|
||||
|
||||
CursorManager::Cursor::Cursor(const Surface &surf, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const byte *mask) {
|
||||
const uint32 keycolor_mask = (((uint32) -1) >> (sizeof(uint32) * 8 - surf.format.bytesPerPixel * 8));
|
||||
_keycolor = keycolor & keycolor_mask;
|
||||
|
@ -242,6 +242,17 @@ public:
|
||||
* and returns false.
|
||||
*/
|
||||
void lock(bool locked);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @param push Specified if cursor should be pushed on replaced (defailt)
|
||||
*/
|
||||
void setDefaultArrowCursor(bool push = false);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Generic class for implementing the singleton design pattern.
|
||||
|
Loading…
Reference in New Issue
Block a user