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