diff options
author | Alyssa Milburn | 2011-08-17 09:28:51 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-08-17 09:28:51 +0200 |
commit | ae287ccee58ebf68ab6125e5bbb4d8a44874330e (patch) | |
tree | 2f4cee4b2940466b8a578962e0174c6f89077a40 /graphics | |
parent | f5255288eabc0527c4c6b727a9db6b8d09a31206 (diff) | |
parent | e36832bbf84cba88fe6b17e1634fab0d550f13df (diff) | |
download | scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.tar.gz scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.tar.bz2 scummvm-rg350-ae287ccee58ebf68ab6125e5bbb4d8a44874330e.zip |
Merge remote-tracking branch 'origin/master' into soccer
Conflicts:
engines/scumm/he/logic_he.cpp
engines/scumm/he/logic_he.h
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/cursor.h | 63 | ||||
-rw-r--r-- | graphics/maccursor.h | 12 | ||||
-rw-r--r-- | graphics/wincursor.cpp | 57 | ||||
-rw-r--r-- | graphics/wincursor.h | 14 |
4 files changed, 141 insertions, 5 deletions
diff --git a/graphics/cursor.h b/graphics/cursor.h new file mode 100644 index 0000000000..b04d9c04e2 --- /dev/null +++ b/graphics/cursor.h @@ -0,0 +1,63 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef GRAPHICS_CURSOR_H +#define GRAPHICS_CURSOR_H + +#include "common/scummsys.h" + +namespace Graphics { + +/** + * A simple cursor representation + * TODO: Switch to using Graphics::Surface instead of a byte* + */ +class Cursor { +public: + Cursor() {} + virtual ~Cursor() {} + + /** Return the cursor's width. */ + virtual uint16 getWidth() const = 0; + /** Return the cursor's height. */ + virtual uint16 getHeight() const = 0; + /** Return the cursor's hotspot's x coordinate. */ + virtual uint16 getHotspotX() const = 0; + /** Return the cursor's hotspot's y coordinate. */ + virtual uint16 getHotspotY() const = 0; + /** Return the cursor's transparent key. */ + virtual byte getKeyColor() const = 0; + + /** Return the cursor's surface. */ + virtual const byte *getSurface() const = 0; + + /** Return the cursor's palette in RGB format. */ + virtual const byte *getPalette() const = 0; + /** Return the starting index of the palette. */ + virtual byte getPaletteStartIndex() const = 0; + /** Return the number of colors in the palette. */ + virtual uint16 getPaletteCount() const = 0; +}; + +} // End of namespace Graphics + +#endif diff --git a/graphics/maccursor.h b/graphics/maccursor.h index cca7f3456b..f5efc20655 100644 --- a/graphics/maccursor.h +++ b/graphics/maccursor.h @@ -28,18 +28,19 @@ * - scumm */ -#include "common/stream.h" - #ifndef GRAPHICS_MACCURSOR_H #define GRAPHICS_MACCURSOR_H +#include "common/stream.h" + +#include "graphics/cursor.h" + namespace Graphics { /** * A Mac crsr or CURS cursor - * TODO: Think about making a base class with WinCursor */ -class MacCursor { +class MacCursor : public Cursor { public: MacCursor(); ~MacCursor(); @@ -56,7 +57,10 @@ public: byte getKeyColor() const { return 0xFF; } const byte *getSurface() const { return _surface; } + const byte *getPalette() const { return _palette; } + byte getPaletteStartIndex() const { return 0; } + uint16 getPaletteCount() const { return 256; } /** Read the cursor's data out of a stream. */ bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false); diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp index 6208f5f053..2db72a2874 100644 --- a/graphics/wincursor.cpp +++ b/graphics/wincursor.cpp @@ -308,4 +308,61 @@ WinCursorGroup *WinCursorGroup::createCursorGroup(Common::PEResources &exe, cons return group; } +/** + * The default Windows cursor + */ +class DefaultWinCursor : public Cursor { +public: + DefaultWinCursor() {} + ~DefaultWinCursor() {} + + uint16 getWidth() const { return 12; } + uint16 getHeight() const { return 20; } + uint16 getHotspotX() const { return 0; } + uint16 getHotspotY() const { return 0; } + byte getKeyColor() const { return 0; } + + const byte *getSurface() const { + static const byte defaultCursor[] = { + 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, + 1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, + 1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, + 1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, + 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 1, 2, 2, 1, 0, 0, 0, 0, + 1, 2, 2, 1, 1, 2, 2, 1, 0, 0, 0, 0, + 1, 2, 1, 0, 1, 1, 2, 2, 1, 0, 0, 0, + 1, 1, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 + }; + + return defaultCursor; + } + + const byte *getPalette() const { + static const byte bwPalette[] = { + 0x00, 0x00, 0x00, // Black + 0xFF, 0xFF, 0xFF // White + }; + + return bwPalette; + } + byte getPaletteStartIndex() const { return 1; } + uint16 getPaletteCount() const { return 2; } +}; + +Cursor *makeDefaultWinCursor() { + return new DefaultWinCursor(); +} + } // End of namespace Graphics diff --git a/graphics/wincursor.h b/graphics/wincursor.h index 86693db88b..e6b35dc80c 100644 --- a/graphics/wincursor.h +++ b/graphics/wincursor.h @@ -26,6 +26,8 @@ #include "common/array.h" #include "common/winexe.h" +#include "graphics/cursor.h" + namespace Common { class NEResources; class PEResources; @@ -35,7 +37,7 @@ class SeekableReadStream; namespace Graphics { /** A Windows cursor. */ -class WinCursor { +class WinCursor : public Cursor { public: WinCursor(); ~WinCursor(); @@ -52,7 +54,10 @@ public: byte getKeyColor() const; const byte *getSurface() const { return _surface; } + const byte *getPalette() const { return _palette; } + byte getPaletteStartIndex() const { return 0; } + uint16 getPaletteCount() const { return 256; } /** Read the cursor's data out of a stream. */ bool readFromStream(Common::SeekableReadStream &stream); @@ -97,6 +102,13 @@ struct WinCursorGroup { static WinCursorGroup *createCursorGroup(Common::PEResources &exe, const Common::WinResourceID &id); }; +/** + * Create a Cursor for the default Windows cursor. + * + * @note The calling code is responsible for deleting the returned pointer. + */ +Cursor *makeDefaultWinCursor(); + } // End of namespace Graphics #endif |