ScummVM API documentation
mousefollow.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_MISC_MOUSEFOLLOW_H
23 #define NANCY_MISC_MOUSEFOLLOW_H
24 
25 #include "engines/nancy/renderobject.h"
26 #include "engines/nancy/input.h"
27 
28 namespace Nancy {
29 
30 struct VIEW;
31 
32 namespace Misc {
33 
34 // Describes an object that follows the mouse's movement, making
35 // sure that its center stays above the mouse hotspot. The position
36 // of such an object is clipped to the Viewport. Used in puzzles:
37 // - AssemblyPuzzle
38 // - CubePuzzle
39 // - RippedLetterPuzzle
40 // - TowerPuzzle
41 // - TangramPuzzle
43 public:
45  virtual ~MouseFollowObject() {}
46 
47  virtual void pickUp() { _isPickedUp = true; }
48  virtual void putDown() { _isPickedUp = false; }
49 
50  void setZ(uint16 z) { _z = z; _needsRedraw = true; }
51  void handleInput(NancyInput &input);
52 
53 protected:
54  bool isViewportRelative() const override { return true; }
55 
56  bool _isPickedUp = false;
57  byte _rotation = 0;
58 
59  const VIEW *_viewportData = nullptr;
60 };
61 
62 } // End of namespace Misc
63 } // End of namespace Nancy
64 
65 #endif // NANCY_MISC_MOUSEFOLLOW_H
Definition: mousefollow.h:42
Definition: input.h:41
Definition: renderobject.h:36
Definition: enginedata.h:90
Definition: actionmanager.h:32