From 55cb72e5faf954e29991dc88a3e161dd59f01a98 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Fri, 31 Oct 2003 10:11:27 +0000 Subject: add mouse cursor code svn-id: r11015 --- queen/display.cpp | 26 +++++++++++++++++++++++++- queen/display.h | 4 ++++ queen/graphics.cpp | 3 +++ 3 files changed, 32 insertions(+), 1 deletion(-) (limited to 'queen') diff --git a/queen/display.cpp b/queen/display.cpp index fa29ec0cb7..1b926c27c5 100644 --- a/queen/display.cpp +++ b/queen/display.cpp @@ -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, diff --git a/queen/display.h b/queen/display.h index 23d2030d63..da64ce70b2 100644 --- a/queen/display.h +++ b/queen/display.h @@ -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; diff --git a/queen/graphics.cpp b/queen/graphics.cpp index b73533e9b3..52bba6e25c 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -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); } -- cgit v1.2.3