add mouse cursor code

svn-id: r11015
This commit is contained in:
Gregory Montoir 2003-10-31 10:11:27 +00:00
parent 6011bd6cdc
commit 55cb72e5fa
3 changed files with 32 additions and 1 deletions

View File

@ -275,7 +275,7 @@ void Display::palFadeIn(int start, int end, uint16 roomNum) {
}
}
_pals.dirtyMin = 0;
_pals.dirtyMax = (roomNum >= 114) ? 255 : 223;
_pals.dirtyMax = 255; // (roomNum >= 114) ? 255 : 223; // FIXME: only for tests
_pals.scrollable = true;
}
@ -825,6 +825,30 @@ void Display::waitForTimer() {
}
void Display::mouseCursorInit(uint8 *buf, uint16 w, uint16 h, uint16 xhs, uint16 yhs) {
// change transparency color match the one expected by the backend (0xFF)
uint16 size = w * h;
uint8 *p = buf;
while (size--) {
if (*p == 255) {
*p = 223;
}
else if (*p == 0) {
*p = 255;
}
++p;
}
_system->set_mouse_cursor(buf, w, h, xhs, yhs);
}
void Display::mouseCursorShow(bool show) {
_system->show_mouse(show);
}
const uint8 TextRenderer::FONT[] = {
0xF8, 0xB0, 0xB0, 0x80, 0xB0, 0xB0, 0xC0, 0x00, 0xF8, 0xB0,

View File

@ -104,6 +104,8 @@ public:
void handleTimer();
void waitForTimer();
void mouseCursorInit(uint8* buf, uint16 w, uint16 h, uint16 xhs, uint16 yhs);
void mouseCursorShow(bool show);
private:
@ -140,6 +142,8 @@ private:
bool _gotTick;
uint8 _mouseCursor[14 * 14];
Dynalum _dynalum;
OSystem *_system;

View File

@ -138,6 +138,9 @@ void Graphics::bobSetupControl() {
bankUnpack(3, 3, 17); // Up arrow dialogue
bankUnpack(4, 4, 17); // Down arrow dialogue
bankErase(17);
BobFrame *bf = &_frames[1];
_display->mouseCursorInit(bf->data, bf->width, bf->height, bf->xhotspot, bf->yhotspot);
}