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 };
38 
39 class GfxView;
40 class GfxPalette;
41 
42 typedef Common::HashMap<int, GfxView *> CursorCache;
43 
45  SciGameId gameId;
46  int16 newPositionY;
47  int16 newPositionX;
48  int16 rectTop;
49  int16 rectLeft;
50  int16 rectBottom;
51  int16 rectRight;
52 };
53 
54 class GfxCursor {
55 public:
56  GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen, GfxCoordAdjuster16 *coordAdjuster, EventManager *eventMan);
57  ~GfxCursor();
58 
59  void kernelShow();
60  void kernelHide();
61  bool isVisible();
62  void kernelSetShape(GuiResourceId resourceId);
63  void kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot);
64  void kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNum);
65  void setPosition(Common::Point pos);
66  Common::Point getPosition();
67  void refreshPosition();
68 
72  void kernelResetMoveZone();
73 
79  void kernelSetMoveZone(Common::Rect zone);
80 
91  void kernelSetZoomZone(byte multiplier, Common::Rect zone, GuiResourceId viewNum, int loopNum, int celNum, GuiResourceId picNum, byte zoomColor);
92  void kernelClearZoomZone();
93 
94  void kernelSetPos(Common::Point pos);
95  void kernelMoveCursor(Common::Point pos);
96 
97 private:
98  void purgeCache();
99 
100  ResourceManager *_resMan;
101  GfxScreen *_screen;
102  GfxPalette *_palette;
103  GfxCoordAdjuster16 *_coordAdjuster;
104  EventManager *_event;
105 
106  int _upscaledHires;
107 
108  bool _moveZoneActive;
109  Common::Rect _moveZone; // Rectangle in which the pointer can move
110 
111  bool _zoomZoneActive;
112  Common::Rect _zoomZone;
113  GfxView *_zoomCursorView;
114  byte _zoomCursorLoop;
115  byte _zoomCursorCel;
116  GfxView *_zoomPicView;
117  byte _zoomColor;
118  byte _zoomMultiplier;
119  Common::SpanOwner<SciSpan<byte> > _cursorSurface;
120 
121  CursorCache _cachedCursors;
122 
123  bool _isVisible;
124 
125  // KQ6 Windows has different black and white cursors. If this is true (set
126  // from the windows_cursors ini setting), then we use these and don't scale
127  // them by 2x like the rest of the graphics, like SSCI did. These look very
128  // ugly, which is why they aren't enabled by default.
129  bool _useOriginalKQ6WinCursors;
130 
131  // The Windows CD version of SQ4 used its own black and white cursors.
132  // If this is true (set from the windows_cursors ini setting) then we use
133  // them instead of the DOS color cursors, which are the default.
134  bool _useOriginalSQ4WinCursors;
135 
136  // The CD version of SQ4 contains a complete set of silver mouse cursors.
137  // If this is true (set from the silver_cursors ini setting), then we use
138  // these instead and replace the game's gold cursors with their silver
139  // equivalents. If this is true, _useOriginalSQ4WinCursors is ignored.
140  bool _useSilverSQ4CDCursors;
141 };
142 
143 } // End of namespace Sci
144 
145 #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:54
Definition: screen.h:68
Definition: event.h:151
Definition: view.h:59