mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 08:53:51 +00:00
Added optional parameter to setCursor() to specify which type of cursor you
want. ITE has only one cursor, so in that case the parameter is ignored, and IHNM currently always gets the hourglass cursor. So it could be improved. Lots. :-) svn-id: r18992
This commit is contained in:
parent
1e286ca84f
commit
e330793547
63
saga/gfx.cpp
63
saga/gfx.cpp
@ -396,22 +396,57 @@ void Gfx::showCursor(bool state) {
|
||||
g_system->showMouse(state);
|
||||
}
|
||||
|
||||
void Gfx::setCursor() {
|
||||
// Set up the mouse cursor
|
||||
const byte A = kITEColorLightGrey;
|
||||
const byte B = kITEColorWhite;
|
||||
void Gfx::setCursor(CursorType cursorType) {
|
||||
if (_vm->getGameType() == GType_ITE) {
|
||||
// Set up the mouse cursor
|
||||
const byte A = kITEColorLightGrey;
|
||||
const byte B = kITEColorWhite;
|
||||
|
||||
const byte cursor_img[CURSOR_W * CURSOR_H] = {
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
A, A, A, B, A, A, A,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
};
|
||||
const byte cursor_img[CURSOR_W * CURSOR_H] = {
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
A, A, A, B, A, A, A,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
0, 0, 0, A, 0, 0, 0,
|
||||
};
|
||||
|
||||
_system->setMouseCursor(cursor_img, CURSOR_W, CURSOR_H, 3, 3, 0);
|
||||
_system->setMouseCursor(cursor_img, CURSOR_W, CURSOR_H, 3, 3, 0);
|
||||
} else {
|
||||
uint32 resourceId;
|
||||
|
||||
switch (cursorType) {
|
||||
case kCursorBusy:
|
||||
resourceId = RID_IHNM_HOURGLASS_CURSOR;
|
||||
break;
|
||||
default:
|
||||
// Assume normal cursor
|
||||
// TODO: Find the correct resource for it
|
||||
resourceId = RID_IHNM_HOURGLASS_CURSOR;
|
||||
break;
|
||||
}
|
||||
|
||||
ResourceContext *context = _vm->_resource->getContext(GAME_RESOURCEFILE);
|
||||
|
||||
byte *resource;
|
||||
size_t resourceLength;
|
||||
|
||||
_vm->_resource->loadResource(context, resourceId, resource, resourceLength);
|
||||
|
||||
byte *image;
|
||||
size_t imageLength;
|
||||
int width, height;
|
||||
|
||||
_vm->decodeBGImage(resource, resourceLength, &image, &imageLength, &width, &height);
|
||||
|
||||
// TODO: Hotspot?
|
||||
|
||||
_system->setMouseCursor(image, width, height, 0, 0, 0);
|
||||
|
||||
free(image);
|
||||
free(resource);
|
||||
}
|
||||
}
|
||||
|
||||
bool hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point) {
|
||||
|
@ -33,6 +33,11 @@ namespace Saga {
|
||||
using Common::Point;
|
||||
using Common::Rect;
|
||||
|
||||
enum CursorType {
|
||||
kCursorNormal,
|
||||
kCursorBusy
|
||||
};
|
||||
|
||||
struct ClipData {
|
||||
// input members
|
||||
Rect sourceRect;
|
||||
@ -144,7 +149,7 @@ public:
|
||||
void showCursor(bool state);
|
||||
|
||||
private:
|
||||
void setCursor();
|
||||
void setCursor(CursorType cursorType = kCursorNormal);
|
||||
int _init;
|
||||
Surface _backBuffer;
|
||||
byte _currentPal[PAL_ENTRIES * 4];
|
||||
|
Loading…
x
Reference in New Issue
Block a user