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 
31 namespace Sci {
32 
33 enum {
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 
40 class GfxView;
41 class GfxPalette;
42 
43 typedef 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 
55 class GfxCursor {
56 public:
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 
73  void kernelResetMoveZone();
74 
80  void kernelSetMoveZone(Common::Rect zone);
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 
98 private:
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  // KQ6 Windows has different black and white cursors. If this is true (set
127  // from the windows_cursors ini setting), then we use these and don't scale
128  // them by 2x like the rest of the graphics, like SSCI did. These look very
129  // ugly, which is why they aren't enabled by default.
130  bool _useOriginalKQ6WinCursors;
131 
132  // The Windows CD version of SQ4 used its own black and white cursors.
133  // If this is true (set from the windows_cursors ini setting) then we use
134  // them instead of the DOS color cursors, which are the default.
135  bool _useOriginalSQ4WinCursors;
136 
137  // The CD version of SQ4 contains a complete set of silver mouse cursors.
138  // If this is true (set from the silver_cursors ini setting), then we use
139  // these instead and replace the game's gold cursors with their silver
140  // equivalents. If this is true, _useOriginalSQ4WinCursors is ignored.
141  bool _useSilverSQ4CDCursors;
142 };
143 
144 } // End of namespace Sci
145 
146 #endif // SCI_GRAPHICS_CURSOR_H
Definition: rect.h:144
Definition: span.h:892
Definition: resource.h:327
Definition: palette.h:41
Definition: coordadjuster.h:37
Definition: rect.h:45
Definition: console.h:28
Definition: cursor.h:55
Definition: screen.h:70
Definition: event.h:151
Definition: view.h:59