diff options
author | Jody Northup | 2009-06-13 10:24:52 +0000 |
---|---|---|
committer | Jody Northup | 2009-06-13 10:24:52 +0000 |
commit | 350dc4290fd5dd8f28af9e63713b48ef2c131f09 (patch) | |
tree | af86a10ccd48c275b362ca0407ddfd16180a8c0c /graphics/cursorman.cpp | |
parent | 2ee51a8fa189fc7817fd6d78533664ec870fca48 (diff) | |
download | scummvm-rg350-350dc4290fd5dd8f28af9e63713b48ef2c131f09.tar.gz scummvm-rg350-350dc4290fd5dd8f28af9e63713b48ef2c131f09.tar.bz2 scummvm-rg350-350dc4290fd5dd8f28af9e63713b48ef2c131f09.zip |
Fixed cursor code to keep track of cursor formats so that ThemeEngine and/or GuiManager cursors will render properly over the game (on spacebar hit, for instance)
svn-id: r41491
Diffstat (limited to 'graphics/cursorman.cpp')
-rw-r--r-- | graphics/cursorman.cpp | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index 850b0044dc..e5a86b6bd8 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -101,6 +101,13 @@ void CursorManager::popAllCursors() { } } +#ifdef ENABLE_16BIT + while (!_cursorFormatStack.empty()) { + PixelFormat *form = _cursorFormatStack.pop(); + delete form; + } +#endif + g_system->showMouse(isVisible()); } @@ -118,8 +125,8 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, Cursor *cur = _cursorStack.top(); #ifdef ENABLE_16BIT - uint size; - { //limit the lifespan of the format variable to minimize memory impact + uint size; + { //limit the lifespan of the format variable to minimize memory impact Graphics::PixelFormat f = g_system->getScreenFormat(); size = w * h * (f.bytesPerPixel); } @@ -225,4 +232,48 @@ void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint nu } } +#ifdef ENABLE_16BIT +void CursorManager::pushCursorFormat(PixelFormat format) { +// if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette)) +// return; + PixelFormat *form = new PixelFormat(format); + + _cursorFormatStack.push(form); + g_system->setCursorFormat(format); +} + +void CursorManager::popCursorFormat() { + + if (_cursorFormatStack.empty()) + return; + + PixelFormat *form = _cursorFormatStack.pop(); + delete form; + + if (_cursorFormatStack.empty()) { + g_system->setCursorFormat(g_system->getScreenFormat()); + return; + } + + form = _cursorFormatStack.top(); + disableCursorPalette(form->bytesPerPixel != 1); + + g_system->setCursorFormat(*form); +} + +void CursorManager::replaceCursorFormat(PixelFormat format) { +// if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette)) +// return; + + if (_cursorFormatStack.empty()) { + pushCursorFormat(format); + return; + } + + PixelFormat *form = _cursorFormatStack.top(); + + g_system->setCursorFormat(*form); +} +#endif + } // End of namespace Graphics |