ScummVM API documentation
cursors.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 MOHAWK_CURSORS_H
23 #define MOHAWK_CURSORS_H
24 
25 #include "common/scummsys.h"
26 
27 namespace Common {
28 class MacResManager;
29 class WinResources;
30 class SeekableReadStream;
31 class String;
32 }
33 
34 namespace Graphics {
35 struct WinCursorGroup;
36 }
37 
38 #include "mohawk/resource.h"
39 
40 namespace Mohawk {
41 
42 enum {
43  kRivenOpenHandCursor = 2003,
44  kRivenClosedHandCursor = 2004,
45  kRivenMainCursor = 3000,
46  kRivenPelletCursor = 5000,
47  kRivenHideCursor = 9000
48 };
49 
50 class MohawkArchive;
51 class MohawkEngine;
52 
54 public:
55  CursorManager() {}
56  virtual ~CursorManager() {}
57 
58  virtual void showCursor();
59  virtual void hideCursor();
60  virtual void setCursor(uint16 id);
61  virtual void setCursor(const Common::String &name) {}
62  virtual void setDefaultCursor();
63  virtual bool hasSource() const { return false; }
64 
65 protected:
66  // Set a Mac CURS/crsr cursor to the screen
67  void setMacCursor(Common::SeekableReadStream *stream);
68 };
69 
70 // The default Mohawk cursor manager
71 // Uses standard tCUR resources
73 public:
74  explicit DefaultCursorManager(MohawkEngine *vm, uint32 tag = ID_TCUR) : _vm(vm), _tag(tag) {}
75  ~DefaultCursorManager() override {}
76 
77  void setCursor(uint16 id) override;
78  bool hasSource() const override { return true; }
79 
80 private:
81  MohawkEngine *_vm;
82  uint32 _tag;
83 };
84 
85 #ifdef ENABLE_MYST
86 
87 // 803-805 are animated, one large bmp which is in chunks - these are NEVER USED
88 // Other cursors (200, 300, 400, 500, 600, 700) are not the same in each stack
89 enum {
90  kDefaultMystCursor = 100, // The default hand
91  kWhitePageCursor = 800, // Holding a white page
92  kRedPageCursor = 801, // Holding a red page
93  kBluePageCursor = 802, // Holding a blue page
94  // kDroppingWhitePageAnimCursor = 803,
95  // kDroppingRedPageAnimCursor = 804,
96  // kDroppingBluePageAnimCursor = 805,
97  kNewMatchCursor = 900, // Match that has not yet been lit
98  kLitMatchCursor = 901, // Match that's burning
99  kDeadMatchCursor = 902, // Match that's been extinguished
100  kKeyCursor = 903, // Key in Lighthouse in Stoneship
101  kRotateClockwiseCursor = 904, // Rotate gear clockwise (boiler on Myst)
102  kRotateCounterClockwiseCursor = 905, // Rotate gear counter clockwise (boiler on Myst)
103  kMystZipModeCursor = 999 // Zip Mode cursor
104 };
105 
106 class MohawkEngine_Myst;
107 
108 // The cursor manager for Myst
109 // Uses WDIB + CLRC resources
110 class MystCursorManager : public CursorManager {
111 public:
112  explicit MystCursorManager(MohawkEngine_Myst *vm);
113  ~MystCursorManager() override;
114 
115  void showCursor() override;
116  void hideCursor() override;
117  void setCursor(uint16 id) override;
118  void setDefaultCursor() override;
119  bool hasSource() const override { return true; }
120 
121 private:
122  MohawkEngine_Myst *_vm;
123 };
124 
125 #endif // ENABLE_MYST
126 
127 // The cursor manager for Mac applications
129 public:
130  explicit MacCursorManager(const Common::Path &appName);
131  ~MacCursorManager() override;
132 
133  void setCursor(uint16 id) override;
134  bool hasSource() const override { return _resFork != nullptr; }
135 
136 private:
137  Common::MacResManager *_resFork;
138 };
139 
140 // The cursor manager for Living Books v2+ games
141 // Handles custom generated cursors in addition to tCUR resources
143 public:
145  ~LivingBooksCursorManager_v2() override;
146 
147  void setCursor(uint16 id) override;
148  void setCursor(const Common::String &name) override;
149  bool hasSource() const override { return _sysArchive != nullptr; }
150 
151 private:
152  MohawkArchive *_sysArchive;
153 };
154 
155 // The cursor manager for Windows EXE's
157 public:
158  ~WinCursorManager() override;
159 
160  void setCursor(uint16 id) override;
161  bool hasSource() const override { return !_cursors.empty(); }
162 
163 protected:
164  void loadCursors(Common::WinResources *exe);
165 
166 private:
167  struct CursorItem {
168  uint16 id;
169  Graphics::WinCursorGroup *cursorGroup;
170  };
171 
172  Common::Array<CursorItem> _cursors;
173 };
174 
175 // The cursor manager for NE EXE's
177 public:
178  explicit NECursorManager(const Common::Path &appName);
179 };
180 
181 // The cursor manager for PE EXE's
183 public:
184  explicit PECursorManager(const Common::Path &appName);
185 };
186 
187 } // End of namespace Mohawk
188 
189 #endif
Definition: cursors.h:182
Definition: wincursor.h:54
Definition: macresman.h:125
Definition: str.h:59
Definition: cursors.h:128
Definition: path.h:52
Definition: cursors.h:156
Definition: stream.h:745
Definition: cursors.h:53
Definition: myst.h:129
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: mohawk.h:54
Definition: cursors.h:176
Definition: winexe.h:110
Definition: cursors.h:72
Definition: cursors.h:142
Definition: resource.h:171
Definition: bitmap.h:32