ScummVM API documentation
camera.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 TWP_CAMERA_H
23 #define TWP_CAMERA_H
24 
25 #include "common/func.h"
26 #include "math/vector2d.h"
27 #include "twp/easing.h"
28 #include "twp/rectf.h"
29 
30 namespace Twp {
31 
32 class Object;
33 class Room;
34 
35 class Camera {
36 public:
37  void setAt(const Math::Vector2d &at);
38  inline Math::Vector2d getAt() const { return _pos; }
39 
40  inline void setBounds(const Rectf &bounds) { _bounds = bounds; }
41  inline Rectf getBounds() const { return _bounds; }
42 
43  inline void setRoom(Common::SharedPtr<Room> room) { _room = room; }
44  inline Common::SharedPtr<Room> getRoom() const { return _room; }
45 
46  inline bool isMoving() const { return _moving; }
47  void panTo(const Math::Vector2d &target, float time, InterpolationKind interpolation);
48 
49  void update(Common::SharedPtr<Room> room, Common::SharedPtr<Object> follow, float elapsed);
50 
51 private:
52  void clamp(const Math::Vector2d &at);
53  void setAtCore(const Math::Vector2d &at);
54 
55 private:
56  Math::Vector2d _pos;
57  Rectf _bounds = Rectf::fromMinMax(Math::Vector2d(-10000, -10000), Math::Vector2d(10000, 10000));
58  bool _moving = false;
59  Math::Vector2d _init, _target;
60  float _elapsed = 0.f;
61  float _time = 0.f;
64  EasingFunc_t _function = {&linear};
65 };
66 } // namespace Twp
67 
68 #endif
Definition: rectf.h:30
Definition: easing.h:33
Definition: ptr.h:159
Definition: camera.h:35
Definition: achievements_tables.h:27