diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-03 01:11:31 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-03 01:11:31 -0500 |
commit | 24918837c3ff9026d228657d14852c9cf39a5644 (patch) | |
tree | be131a43eb30f164bd70f542cfcaec688fbc3d51 /src/camera_system.h | |
parent | f449345e3aeb599eb497dfeeac7027cf4d1de515 (diff) | |
download | tanetane-24918837c3ff9026d228657d14852c9cf39a5644.tar.gz tanetane-24918837c3ff9026d228657d14852c9cf39a5644.tar.bz2 tanetane-24918837c3ff9026d228657d14852c9cf39a5644.zip |
Added camera system
Diffstat (limited to 'src/camera_system.h')
-rw-r--r-- | src/camera_system.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/camera_system.h b/src/camera_system.h new file mode 100644 index 0000000..3eb8374 --- /dev/null +++ b/src/camera_system.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef CAMERA_SYSTEM_H_D52ADAD3 | ||
2 | #define CAMERA_SYSTEM_H_D52ADAD3 | ||
3 | |||
4 | #include "consts.h" | ||
5 | #include "system.h" | ||
6 | #include "vector.h" | ||
7 | |||
8 | class Game; | ||
9 | |||
10 | class CameraSystem : public System { | ||
11 | public: | ||
12 | |||
13 | static constexpr SystemKey Key = SystemKey::Camera; | ||
14 | |||
15 | CameraSystem(Game& game) : game_(game) {} | ||
16 | |||
17 | const vec2i& getCameraPosition() const { return pos_; } | ||
18 | |||
19 | const vec2i& getFieldOfView() const { return fov_; } | ||
20 | |||
21 | void setFollowingSprite(int spriteId) { followingSprite_ = spriteId; } | ||
22 | |||
23 | void lockCamera() { locked_ = true; } | ||
24 | |||
25 | void unlockCamera() { locked_ = false; } | ||
26 | |||
27 | void tick(double dt) override; | ||
28 | |||
29 | private: | ||
30 | Game& game_; | ||
31 | |||
32 | vec2i pos_; | ||
33 | vec2i fov_ { CANVAS_WIDTH, CANVAS_HEIGHT }; | ||
34 | int followingSprite_; | ||
35 | bool locked_ = true; | ||
36 | }; | ||
37 | |||
38 | #endif /* end of include guard: CAMERA_SYSTEM_H_D52ADAD3 */ | ||