diff options
author | Sven Hesse | 2012-06-28 17:45:02 +0200 |
---|---|---|
committer | Sven Hesse | 2012-07-30 01:44:42 +0200 |
commit | 27782700a5631a25129b12779abb540a906f6a96 (patch) | |
tree | 9c3fc6374dcc626a8696d29cde3973489b973d61 /engines/gob/pregob | |
parent | 38fe3c3cd9e656b3e3f2b35011895d6703a1a896 (diff) | |
download | scummvm-rg350-27782700a5631a25129b12779abb540a906f6a96.tar.gz scummvm-rg350-27782700a5631a25129b12779abb540a906f6a96.tar.bz2 scummvm-rg350-27782700a5631a25129b12779abb540a906f6a96.zip |
GOB: Add some PreGob and Once Upon A Time cursor functions
Diffstat (limited to 'engines/gob/pregob')
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.cpp | 1 | ||||
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.h | 2 | ||||
-rw-r--r-- | engines/gob/pregob/pregob.cpp | 47 | ||||
-rw-r--r-- | engines/gob/pregob/pregob.h | 14 |
4 files changed, 64 insertions, 0 deletions
diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp index 35127cbfb3..7f7dffa7ec 100644 --- a/engines/gob/pregob/onceupon/onceupon.cpp +++ b/engines/gob/pregob/onceupon/onceupon.cpp @@ -23,6 +23,7 @@ #include "gob/gob.h" #include "gob/util.h" #include "gob/dataio.h" +#include "gob/surface.h" #include "gob/draw.h" #include "gob/video.h" diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h index 816d4dc051..c1c4d6fa0d 100644 --- a/engines/gob/pregob/onceupon/onceupon.h +++ b/engines/gob/pregob/onceupon/onceupon.h @@ -29,6 +29,8 @@ namespace Gob { +class Surface; + namespace OnceUpon { class OnceUpon : public PreGob { diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp index aea290214c..18aac50352 100644 --- a/engines/gob/pregob/pregob.cpp +++ b/engines/gob/pregob/pregob.cpp @@ -20,9 +20,12 @@ * */ +#include "graphics/cursorman.h" + #include "gob/gob.h" #include "gob/global.h" #include "gob/util.h" +#include "gob/surface.h" #include "gob/palanim.h" #include "gob/draw.h" #include "gob/video.h" @@ -90,4 +93,48 @@ void PreGob::setPalette(const byte *palette, uint16 size) { _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); } +void PreGob::addCursor() { + CursorMan.pushCursor(0, 0, 0, 0, 0, 0); +} + +void PreGob::removeCursor() { + CursorMan.popCursor(); +} + +void PreGob::setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY) { + CursorMan.replaceCursor(sprite.getData(), sprite.getWidth(), sprite.getHeight(), hotspotX, hotspotY, 0); +} + +void PreGob::setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom, + int16 hotspotX, int16 hotspotY) { + + const int width = right - left + 1; + const int height = bottom - top + 1; + + if ((width <= 0) || (height <= 0)) + return; + + Surface cursor(width, height, 1); + + cursor.blit(sprite, left, top, right, bottom, 0, 0); + + setCursor(cursor, hotspotX, hotspotX); +} + +void PreGob::showCursor() { + CursorMan.showMouse(true); + + _vm->_draw->_showCursor = 4; +} + +void PreGob::hideCursor() { + CursorMan.showMouse(false); + + _vm->_draw->_showCursor = 0; +} + +bool PreGob::isCursorVisible() const { + return CursorMan.isVisible(); +} + } // End of namespace Gob diff --git a/engines/gob/pregob/pregob.h b/engines/gob/pregob/pregob.h index 6418d6fd8a..e0f7ca907d 100644 --- a/engines/gob/pregob/pregob.h +++ b/engines/gob/pregob/pregob.h @@ -26,6 +26,7 @@ namespace Gob { class GobEngine; +class Surface; class PreGob { public: @@ -49,6 +50,19 @@ protected: */ void setPalette(const byte *palette, uint16 size); ///< Change the palette + void addCursor(); + void removeCursor(); + + void setCursor(Surface &sprite, int16 hotspotX, int16 hotspotY); + void setCursor(Surface &sprite, int16 left, int16 top, int16 right, int16 bottom, + int16 hotspotX, int16 hotspotY); + + void showCursor(); + void hideCursor(); + + bool isCursorVisible() const; + + GobEngine *_vm; private: |