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 NANCY_CURSOR_H
23 #define NANCY_CURSOR_H
24 
25 #include "common/array.h"
26 
27 #include "graphics/managed_surface.h"
28 
29 namespace Nancy {
30 
31 class NancyEngine;
32 
34  friend class NancyEngine;
35 
36 public:
37  enum CursorType {
38  kNormal = 0, // Eyeglass (except in TVD), non-highlighted
39  kHotspot = 1, // Eyeglass (except in TVD), highlighted
40  kMove = 2, // Used for movement in early games
41  kExit = 3, // Used for movement, some games use it for exiting puzzles
42  kRotateCW = 4, // Used in puzzles only
43  kRotateCCW = 5, // Used in puzzles only
44  kMoveLeft = 6, // Used for movement, some games used it for turning in 360 scenes
45  kMoveRight = 7, // Used for movement, some games used it for turning in 360 scenes
46  kMoveForward = 8, // Used for movement
47  kMoveBackward = 9, // Used for movement, some games use it for exiting puzzles
48  kMoveUp = 10, // Used for movement
49  kMoveDown = 11, // Used for movement
50  kRotateLeft = 12, // Used in 360 scenes in nancy6 and up
51  kRotateRight = 13, // Used in 360 scenes in nancy6 and up
52  kInvertedRotateRight = 14, // Used in 360 scenes with inverted rotation; nancy6 and up
53  kInvertedRotateLeft = 15, // Used in 360 scenes with inverted rotation; nancy6 and up
54  kCustom1 = 16, // Custom cursors change between games; Likely used in puzzles
55  kCustom1Hotspot = 17,
56  kCustom2 = 18,
57  kCustom2Hotspot = 19,
58  kNormalArrow,
59  kHotspotArrow
60  };
61 
62  CursorManager();
63 
64  void init(Common::SeekableReadStream *chunkStream);
65 
66  // Change the current cursor ID. Does not change the graphic
67  void setCursor(CursorType type, int16 itemID);
68  void setCursorType(CursorType type);
69  void setCursorItemID(int16 itemID);
70 
71  void warpCursor(const Common::Point &pos);
72 
73  // Change the cursor graphic. Should be called right before drawing to screen
74  void applyCursor();
75 
76  const Common::Point &getCurrentCursorHotspot() { return _cursors[_curCursorID].hotspot;}
77  const Common::Rect &getPrimaryVideoInactiveZone() { return _primaryVideoInactiveZone; }
78  const Common::Point &getPrimaryVideoInitialPos() { return _primaryVideoInitialPos; }
79 
80  const CursorType _puzzleExitCursor;
81 
82 private:
83  void showCursor(bool shouldShow);
84 
85  void adjustCursorHotspot();
86 
87  struct Cursor {
88  Common::Rect bounds;
89  Common::Point hotspot;
90  };
91 
92  // CURS data
93  Common::Array<Cursor> _cursors;
94 
95  Common::Rect _primaryVideoInactiveZone;
96  Common::Point _primaryVideoInitialPos;
97 
98  Graphics::ManagedSurface _invCursorsSurface;
99 
100  Common::Point _warpedMousePos;
101  CursorType _curCursorType;
102  int16 _curItemID;
103  uint _curCursorID;
104  uint _lastCursorID;
105  bool _hasItem;
106  bool _isInitialized;
107  int _numCursorTypes;
108 };
109 
110 } // End of namespace Nancy
111 
112 #endif // NANCY_CURSOR_H
Definition: managed_surface.h:51
Definition: nancy.h:74
Definition: cursor.h:33
Definition: rect.h:144
Definition: stream.h:745
Definition: rect.h:45
Definition: actionmanager.h:32