ScummVM API documentation
cursor.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef SCI_GRAPHICS_CURSOR_H
23#define SCI_GRAPHICS_CURSOR_H
24
25#include "common/array.h"
26#include "common/hashmap.h"
27#include "sci/sci.h"
28#include "sci/graphics/helpers.h"
29#include "sci/util.h"
30
31namespace Sci {
32
33enum {
34 SCI_CURSOR_SCI0_HEIGHTWIDTH = 16,
35 SCI_CURSOR_SCI0_RESOURCESIZE = 68,
36 SCI_CURSOR_SCI0_TRANSPARENCYCOLOR = 1,
37 SCI_CURSOR_SCI1_GRAY = 7
38};
39
40class GfxView;
41class GfxPalette;
42
43typedef Common::HashMap<int, GfxView *> CursorCache;
44
46 SciGameId gameId;
47 int16 newPositionY;
48 int16 newPositionX;
49 int16 rectTop;
50 int16 rectLeft;
51 int16 rectBottom;
52 int16 rectRight;
53};
54
55class GfxCursor {
56public:
57 GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen, GfxCoordAdjuster16 *coordAdjuster, EventManager *eventMan);
58 ~GfxCursor();
59
60 void kernelShow();
61 void kernelHide();
62 bool isVisible();
63 void kernelSetShape(GuiResourceId resourceId);
64 void kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot);
65 void kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNum);
66 void setPosition(Common::Point pos);
67 Common::Point getPosition();
68 void refreshPosition();
69
74
81
92 void kernelSetZoomZone(byte multiplier, Common::Rect zone, GuiResourceId viewNum, int loopNum, int celNum, GuiResourceId picNum, byte zoomColor);
93 void kernelClearZoomZone();
94
95 void kernelSetPos(Common::Point pos);
96 void kernelMoveCursor(Common::Point pos);
97
98private:
99 void purgeCache();
100
101 ResourceManager *_resMan;
102 GfxScreen *_screen;
103 GfxPalette *_palette;
104 GfxCoordAdjuster16 *_coordAdjuster;
105 EventManager *_event;
106
107 int _upscaledHires;
108
109 bool _moveZoneActive;
110 Common::Rect _moveZone; // Rectangle in which the pointer can move
111
112 bool _zoomZoneActive;
113 Common::Rect _zoomZone;
114 GfxView *_zoomCursorView;
115 byte _zoomCursorLoop;
116 byte _zoomCursorCel;
117 GfxView *_zoomPicView;
118 byte _zoomColor;
119 byte _zoomMultiplier;
120 Common::SpanOwner<SciSpan<byte> > _cursorSurface;
121
122 CursorCache _cachedCursors;
123
124 bool _isVisible;
125
126 // The Windows CD versions of KQ6, SQ4 and LB2 and the Windows version of
127 // Pepper have extra sets of black and white cursors. Some games have one
128 // extra set (Pepper, SQ4), some have two extra sets (KQ6, LB2). If one of
129 // the kWinCursorBW alternatives is set (from the windows_cursors ini entry)
130 // then we use these b/w cursors instead of the DOS color cursors, which
131 // are the default in 256 colors mode.
132 // The CD version of SQ4 also contains a complete set of silver mouse
133 // cursors. If kWinCursorSilver is set (from the silver_cursors ini entry),
134 // then we use these instead and replace the game's gold cursors with their
135 // silver equivalents.
136
137 enum WinCursorStyle : int {
138 kWinCursorStyleDefault = 0,
139 kWinCursorStyleBWAlt1,
140 kWinCursorStyleBWAlt2,
141 kWinCursorStyleSilver
142 };
143 WinCursorStyle _winCursorStyle;
144};
145
146} // End of namespace Sci
147
148#endif // SCI_GRAPHICS_CURSOR_H
Definition: span.h:893
Definition: event.h:151
Definition: coordadjuster.h:37
Definition: cursor.h:55
void kernelSetMoveZone(Common::Rect zone)
void kernelResetMoveZone()
void kernelSetZoomZone(byte multiplier, Common::Rect zone, GuiResourceId viewNum, int loopNum, int celNum, GuiResourceId picNum, byte zoomColor)
Definition: palette16.h:41
Definition: screen.h:70
Definition: view.h:59
Definition: resource.h:327
Definition: console.h:28
Definition: rect.h:144
Definition: rect.h:536